diff --git a/html/cgi-bin/ids.cgi b/html/cgi-bin/ids.cgi
index 0dce9e994..0a814f1a1 100644
--- a/html/cgi-bin/ids.cgi
+++ b/html/cgi-bin/ids.cgi
@@ -347,8 +347,63 @@ if ($errormessage) {
&Header::closebox();
}
+# Draw current state of the IDS
&Header::openbox('100%', 'left', $Lang::tr{'intrusion detection system'});
+# Check if the IDS is running and obtain the process-id.
+my $pid = &IDS::ids_is_running();
+
+# Display some useful information, if suricata daemon is running.
+if ($pid) {
+ # Gather used memory.
+ my $memory = &get_memory_usage($pid);
+
+ print <
+
+
$Lang::tr{'intrusion detection'}
+
+
+
+
$Lang::tr{'guardian daemon'}
+
$Lang::tr{'running'}
+
+
+
+
+
PID
+
$Lang::tr{'memory'}
+
+
+
+
+
$pid
+
$memory KB
+
+
+END
+} else {
+ # Otherwise display a hint that the service is not launched.
+ print <
+
+
$Lang::tr{'intrusion detection'}
+
+
+
+
$Lang::tr{'guardian daemon'}
+
$Lang::tr{'stopped'}
+
+
+
+ br>
+END
+}
+&Header::closebox();
+
+# Draw elements for IDS configuration.
+&Header::openbox('100%', 'center', $Lang::tr{'settings'});
+
my $rulesdate;
# Check if a ruleset allready has been downloaded.
@@ -667,3 +722,33 @@ sub readrulesfile ($) {
}
}
}
+
+# Function to get the used memory of a given process-id.
+sub get_memory_usage($) {
+ my $pid = @_;
+
+ my $memory=0;
+
+ # Try to open statm file for the given process-id on the pseudo
+ # file system proc.
+ if (open(FILE, "/proc/$pid/statm")) {
+ # Read file content.
+ my $temp = ;
+
+ # Splitt file content and store in an array.
+ my @memory = split(/ /,$temp);
+
+ # Close file handle.
+ close(FILE);
+
+ # Calculate memory usage.
+ $memory+=$memory[0];
+
+ # Return memory usage.
+ return $memory;
+ }
+
+ # If the file could not be open, return nothing.
+ return;
+}
+