$local_log_string = str_replace(" ", " ", $dbms->db_result_row[6]);
$local_logline_array = explode (" ", $local_log_string);
- switch (strtolower($local_logline_array[4]))
+ $service_type = $dbms->db_result_row[3];
+ switch (strtolower($service_type))
{
- case "kernel:":
+ case "kernel":
//This is a kernel logline now discover which type kernel-record we have
//Detect if this is a network-line
}
else
{
+
+ //This line is a kernel line writing about a device.
if (strtolower($local_logline_array[4]) == 'device')
{
+ echo $local_log_string;
+
$local_result = linux_kernel_device();
return $local_result;
+
}
+
else
+
{
+
if ($developrelease == 'TRUE')
+
{
+
$local_failing_string = "Failing string: ".$dbms->db_result_row[5];
syslog (LOG_INFO, "Unrecognized kernelline:".$local_log_string);
syslog (LOG_INFO, $local_failing_string);
+
}
return "FALSE";
}
- } // <=== We were missing this brace
+ }
break;
+ case "anacron":
+ $local_result = linux_daemon();
+ break;
+
+ case "apmd":
+ $local_result = linux_daemon();
+ break;
+
+ case "atd":
+ $local_result = linux_daemon();
+ break;
+
+ case "crond":
+ $local_result = linux_daemon();
+ break;
+
+ case "httpd":
+ $local_result = linux_daemon();
+ break;
+
+ case "lpd":
+ $local_result = linux_daemon();
+ break;
+
+ case "mysqld":
+ $local_result = linux_daemon();
+ break;
+
+ case "postfix":
+ $local_result = linux_daemon();
+ break;
+
+ case "random":
+ $local_result = linux_daemon();
+ break;
+
+ case "rhnsd":
+ $local_result = linux_daemon();
+ break;
+
+ case "syslog":
+ $local_result = linux_daemon();
+ break;
+
+ case "syslogd":
+ $local_result = linux_daemon();
+ break;
+
+ case "xinetd":
+ $local_result = linux_daemon();
+ break;
+
default:
break;
}
RETURN "TRUE";
}
+
function linux_kernel_device() {
/* This function is able to deal with the output of kernel-network messages
* coming from device related processes. Typically networkcard and other
global $dbms, $dbms_working;
}
+
+function linux_daemon() {
+ /* This function is able to deal with the output of kernel-network messages
+ * coming from device related processes. Typically networkcard and other
+ * hardware-related data will show-up here
+ * INPUT : NONE
+ * GLOBALS : $dbms, $dbms_working
+ * OUTPUT : "TRUE" for success and "FALSE" for failure.
+ */
+
+ global $dbms, $dbms_working;
+
+ $local_log_line = strtolower($dbms->db_result_row[6]);
+
+ //Find a sign of stop
+ //Using the word shutdown
+ $pos = strpos($local_log_line, "shutdown");
+ if ($pos > 0) {
+ $local_sql = "INSERT INTO log_adv_daemon (logid, detailed_table, service, event) VALUES ";
+ $local_sql .= "('".$dbms->db_result_row[0]."', 'log_adv_daemon', '".$dbms->db_result_row[3]."', 'stop')";
+ $dbms_working->query($local_sql);
+ } else {
+ //Using the word stop
+ $pos = strpos($local_log_line, "stop");
+ if ($pos > 0) {
+ $local_sql = "INSERT INTO log_adv_daemon (logid, detailed_table, service, event) VALUES ";
+ $local_sql .= "('".$dbms->db_result_row[0]."', 'log_adv_daemon', '".$dbms->db_result_row[3]."', 'stop')";
+ $dbms_working->query($local_sql);
+ } else {
+ //As the word restart
+ $pos = strpos($local_log_line, "restart");
+ if ($pos > 0) {
+ $local_sql = "INSERT INTO log_adv_daemon (logid, detailed_table, service, event) VALUES ";
+ $local_sql .= "('".$dbms->db_result_row[0]."', 'log_adv_daemon', '".$dbms->db_result_row[3]."', 'stop')";
+ $dbms_working->query($local_sql);
+
+ $local_sql = "INSERT INTO log_adv_daemon (logid, detailed_table, service, event) VALUES ";
+ $local_sql .= "('".$dbms->db_result_row[0]."', 'log_adv_daemon', '".$dbms->db_result_row[3]."', 'start')";
+ $dbms_working->query($local_sql);
+ } else {
+ //As the word start this is an else for restart.
+ //If we wouldn't do so restart would also give a positive on start
+ $pos = strpos($local_log_line, "start");
+ if ($pos > 0) {
+ $local_sql = "INSERT INTO log_adv_daemon (logid, detailed_table, service, event) VALUES ";
+ $local_sql .= "('".$dbms->db_result_row[0]."', 'log_adv_daemon', '".$dbms->db_result_row[3]."', 'start')";
+ $dbms_working->query($local_sql);
+ }
+ }
+ }
+ }
+
+ return "ok";
+
+ }
?>