syntaxer run

git-svn-id: http://www.observium.org/svn/observer/trunk@3071 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Tom Laermans
2012-04-21 00:36:55 +00:00
parent bf58e662a9
commit e2dc9b246d
24 changed files with 84 additions and 107 deletions
+1
View File
@@ -68,6 +68,7 @@ $colour_area_in = "91B13C";
$colour_area_out = "8080BD"; $colour_area_out = "8080BD";
include("includes/graphs/generic_multi_seperated.inc.php"); include("includes/graphs/generic_multi_seperated.inc.php");
#include("includes/graphs/generic_multi_bits_separated.inc.php"); #include("includes/graphs/generic_multi_bits_separated.inc.php");
#include("includes/graphs/generic_multi_data.inc.php"); #include("includes/graphs/generic_multi_data.inc.php");
@@ -91,7 +91,6 @@ if($format == "octets" || $format == "bytes")
$format = "bits"; $format = "bits";
} }
$rrd_options .= " COMMENT:'bps Now Ave Max 95th %\\n'"; $rrd_options .= " COMMENT:'bps Now Ave Max 95th %\\n'";
$rrd_options .= " AREA:in".$format."_max#aDEB7B:"; $rrd_options .= " AREA:in".$format."_max#aDEB7B:";
@@ -73,8 +73,6 @@ if($_GET['previous'] == "yes")
} }
} }
$rrd_options .= " AREA:in#".$colour_area_in.":"; $rrd_options .= " AREA:in#".$colour_area_in.":";
$rrd_options .= " COMMENT:'".$unit_text." Now Ave Max"; $rrd_options .= " COMMENT:'".$unit_text." Now Ave Max";
@@ -127,6 +125,4 @@ if($_GET['previous'] == "yes")
$rrd_options .= " LINE1.25:dout".$format."X#666666:'Prev Out'"; $rrd_options .= " LINE1.25:dout".$format."X#666666:'Prev Out'";
} }
?> ?>
@@ -19,7 +19,7 @@ foreach ($rrd_filenames as $key => $rrd_filename)
$seperator = ","; $seperator = ",";
$plus = ",+"; $plus = ",+";
if($_GET['previous']) if ($_GET['previous'])
{ {
$rrd_options .= " DEF:".$in."octets" . $i . "X=".$rrd_filename.":".$ds_in.":AVERAGE:start=".$prev_from.":end=".$from; $rrd_options .= " DEF:".$in."octets" . $i . "X=".$rrd_filename.":".$ds_in.":AVERAGE:start=".$prev_from.":end=".$from;
$rrd_options .= " DEF:".$out."octets" . $i . "X=".$rrd_filename.":".$ds_out.":AVERAGE:start=".$prev_from.":end=".$from; $rrd_options .= " DEF:".$out."octets" . $i . "X=".$rrd_filename.":".$ds_out.":AVERAGE:start=".$prev_from.":end=".$from;
@@ -47,7 +47,7 @@ if ($i)
$rrd_options .= " VDEF:95thout=outbits,95,PERCENT"; $rrd_options .= " VDEF:95thout=outbits,95,PERCENT";
$rrd_options .= " VDEF:d95thout=doutbits,5,PERCENT"; $rrd_options .= " VDEF:d95thout=doutbits,5,PERCENT";
if($_GET['previous'] == "yes") if ($_GET['previous'] == "yes")
{ {
$rrd_options .= " CDEF:".$in."octetsX=" . $in_thingX . $pluses; $rrd_options .= " CDEF:".$in."octetsX=" . $in_thingX . $pluses;
$rrd_options .= " CDEF:".$out."octetsX=" . $out_thingX . $pluses; $rrd_options .= " CDEF:".$out."octetsX=" . $out_thingX . $pluses;
@@ -85,7 +85,7 @@ if ($i)
$rrd_options .= " LINE1:95thin#aa0000"; $rrd_options .= " LINE1:95thin#aa0000";
$rrd_options .= " LINE1:d95thout#aa0000"; $rrd_options .= " LINE1:d95thout#aa0000";
if($_GET['previous'] == "yes") if ($_GET['previous'] == "yes")
{ {
$rrd_options .= " AREA:inbitsX#9999966:"; $rrd_options .= " AREA:inbitsX#9999966:";
$rrd_options .= " AREA:doutbitsX#99999966:"; $rrd_options .= " AREA:doutbitsX#99999966:";
@@ -28,7 +28,7 @@ foreach ($rrd_filenames as $key => $rrd_filename)
$seperator = ","; $seperator = ",";
$plus = ",+"; $plus = ",+";
if($_GET['previous']) if ($_GET['previous'])
{ {
$rrd_options .= " DEF:".$in."octets" . $i . "X=".$rrd_filename.":".$ds_in.":AVERAGE:start=".$prev_from.":end=".$from; $rrd_options .= " DEF:".$in."octets" . $i . "X=".$rrd_filename.":".$ds_in.":AVERAGE:start=".$prev_from.":end=".$from;
$rrd_options .= " DEF:".$out."octets" . $i . "X=".$rrd_filename.":".$ds_out.":AVERAGE:start=".$prev_from.":end=".$from; $rrd_options .= " DEF:".$out."octets" . $i . "X=".$rrd_filename.":".$ds_out.":AVERAGE:start=".$prev_from.":end=".$from;
@@ -56,7 +56,7 @@ if ($i)
$rrd_options .= " VDEF:95thout=outbits,95,PERCENT"; $rrd_options .= " VDEF:95thout=outbits,95,PERCENT";
$rrd_options .= " VDEF:d95thout=doutbits,5,PERCENT"; $rrd_options .= " VDEF:d95thout=doutbits,5,PERCENT";
if($_GET['previous'] == "yes") if ($_GET['previous'] == "yes")
{ {
$rrd_options .= " CDEF:".$in."octetsX=" . $in_thingX . $pluses; $rrd_options .= " CDEF:".$in."octetsX=" . $in_thingX . $pluses;
$rrd_options .= " CDEF:".$out."octetsX=" . $out_thingX . $pluses; $rrd_options .= " CDEF:".$out."octetsX=" . $out_thingX . $pluses;
@@ -94,7 +94,7 @@ if ($i)
$rrd_options .= " LINE1:95thin#aa0000"; $rrd_options .= " LINE1:95thin#aa0000";
$rrd_options .= " LINE1:d95thout#aa0000"; $rrd_options .= " LINE1:d95thout#aa0000";
if($_GET['previous'] == "yes") if ($_GET['previous'] == "yes")
{ {
$rrd_options .= " AREA:in".$format."X#99999999:"; $rrd_options .= " AREA:in".$format."X#99999999:";
$rrd_options .= " AREA:dout".$format."X#99999999:"; $rrd_options .= " AREA:dout".$format."X#99999999:";
@@ -35,7 +35,7 @@ foreach ($rrd_list as $rrd)
$rrd_options .= " CDEF:outB".$i."_neg=outB".$i.",-1,*"; $rrd_options .= " CDEF:outB".$i."_neg=outB".$i.",-1,*";
$rrd_options .= " CDEF:octets".$i."=inB".$i.",outB".$i.",+"; $rrd_options .= " CDEF:octets".$i."=inB".$i.",outB".$i.",+";
if($_GET['previous']) if ($_GET['previous'])
{ {
$rrd_options .= " DEF:".$in."octets" . $i . "X=".$rrd['filename'].":".$ds_in.":AVERAGE:start=".$prev_from.":end=".$from; $rrd_options .= " DEF:".$in."octets" . $i . "X=".$rrd['filename'].":".$ds_in.":AVERAGE:start=".$prev_from.":end=".$from;
$rrd_options .= " DEF:".$out."octets" . $i . "X=".$rrd['filename'].":".$ds_out.":AVERAGE:start=".$prev_from.":end=".$from; $rrd_options .= " DEF:".$out."octets" . $i . "X=".$rrd['filename'].":".$ds_out.":AVERAGE:start=".$prev_from.":end=".$from;
@@ -77,7 +77,7 @@ foreach ($rrd_list as $rrd)
$i++; $iter++; $i++; $iter++;
} }
if($_GET['previous'] == "yes") if ($_GET['previous'] == "yes")
{ {
$rrd_options .= " CDEF:".$in."octetsX=" . $in_thingX . $plusesX; $rrd_options .= " CDEF:".$in."octetsX=" . $in_thingX . $plusesX;
$rrd_options .= " CDEF:".$out."octetsX=" . $out_thingX . $plusesX; $rrd_options .= " CDEF:".$out."octetsX=" . $out_thingX . $plusesX;
@@ -90,7 +90,7 @@ foreach ($rrd_list as $rrd)
$rrd_options .= " VDEF:d95thoutX=doutbitsX,5,PERCENT"; $rrd_options .= " VDEF:d95thoutX=doutbitsX,5,PERCENT";
} }
if($_GET['previous'] == "yes") if ($_GET['previous'] == "yes")
{ {
$rrd_options .= " AREA:in".$format."X#99999999:"; $rrd_options .= " AREA:in".$format."X#99999999:";
$rrd_options .= " AREA:dout".$format."X#99999999:"; $rrd_options .= " AREA:dout".$format."X#99999999:";
@@ -98,7 +98,6 @@ foreach ($rrd_list as $rrd)
$rrd_options .= " LINE1.25:dout".$format."X#666666:"; $rrd_options .= " LINE1.25:dout".$format."X#666666:";
} }
$rrd_options .= $rrd_optionsb; $rrd_options .= $rrd_optionsb;
$rrd_options .= " HRULE:0#999999"; $rrd_options .= " HRULE:0#999999";
@@ -52,7 +52,7 @@ foreach ($rrd_list as $i => $rrd)
$rrd_options .= " DEF:".$rrd['ds'].$i."max=".$rrd['filename'].":".$rrd['ds'].":MAX "; $rrd_options .= " DEF:".$rrd['ds'].$i."max=".$rrd['filename'].":".$rrd['ds'].":MAX ";
} }
if($_GET['previous']) if ($_GET['previous'])
{ {
$rrd_options .= " DEF:".$i . "X=".$rrd['filename'].":".$rrd['ds'].":AVERAGE:start=".$prev_from.":end=".$from; $rrd_options .= " DEF:".$i . "X=".$rrd['filename'].":".$rrd['ds'].":AVERAGE:start=".$prev_from.":end=".$from;
$rrd_options .= " SHIFT:".$i . "X:$period"; $rrd_options .= " SHIFT:".$i . "X:$period";
@@ -88,8 +88,6 @@ foreach ($rrd_list as $i => $rrd)
$rrd_options .= " CDEF:" . $g_defname . $i . "max=" . $rrd['ds'] . $i . "max," . $divider . ",/"; $rrd_options .= " CDEF:" . $g_defname . $i . "max=" . $rrd['ds'] . $i . "max," . $divider . ",/";
} }
## Are our text values related to te multiplier/divisor or not? ## Are our text values related to te multiplier/divisor or not?
if (isset($text_orig) && $text_orig) if (isset($text_orig) && $text_orig)
{ {
@@ -108,7 +106,7 @@ foreach ($rrd_list as $i => $rrd)
$rrd_options .= " COMMENT:'\\n'"; $rrd_options .= " COMMENT:'\\n'";
} }
if($_GET['previous'] == "yes") if ($_GET['previous'] == "yes")
{ {
if (is_numeric($multiplier)) if (is_numeric($multiplier))
{ {
@@ -124,9 +122,6 @@ foreach ($rrd_list as $i => $rrd)
$rrd_options .= " AREA:X#99999999:"; $rrd_options .= " AREA:X#99999999:";
$rrd_options .= " LINE1.25:X#666666:"; $rrd_options .= " LINE1.25:X#666666:";
} }
?> ?>
@@ -73,7 +73,6 @@ if($colour_minmax)
} }
} }
$rrd_options .= " COMMENT:'".$unit_text."Now Ave Max"; $rrd_options .= " COMMENT:'".$unit_text."Now Ave Max";
if ($percentile) if ($percentile)
+2 -3
View File
@@ -17,15 +17,14 @@ $unit_text = "Usage";
include("includes/graphs/generic_simplex.inc.php"); include("includes/graphs/generic_simplex.inc.php");
if($poop) if($poop)
{ {
$scale_min = "0"; $scale_min = "0";
$scale_max = "100"; $scale_max = "100";
include("includes/graphs/common.inc.php"); include("includes/graphs/common.inc.php");
$iter = "1"; $iter = "1";
$rrd_options .= " COMMENT:' Cur Max\\n'"; $rrd_options .= " COMMENT:' Cur Max\\n'";
+2 -1
View File
@@ -33,7 +33,7 @@ $rrd_options .= " GPRINT:size:LAST:%6.2lf%sB";
$rrd_options .= " GPRINT:free:LAST:%6.2lf%sB"; $rrd_options .= " GPRINT:free:LAST:%6.2lf%sB";
$rrd_options .= " GPRINT:perc:LAST:%5.2lf%%\\\\n"; $rrd_options .= " GPRINT:perc:LAST:%5.2lf%%\\\\n";
if($_GET['previous']) if ($_GET['previous'])
{ {
$descr = substr(str_pad("Prev ".$storage[storage_descr], 12),0,12); $descr = substr(str_pad("Prev ".$storage[storage_descr], 12),0,12);
$descr = str_replace(":","\:",$descr); $descr = str_replace(":","\:",$descr);
@@ -53,4 +53,5 @@ if($_GET['previous'])
$rrd_options .= " GPRINT:freeX:LAST:%6.2lf%sB"; $rrd_options .= " GPRINT:freeX:LAST:%6.2lf%sB";
$rrd_options .= " GPRINT:percX:LAST:%5.2lf%%\\\\n"; $rrd_options .= " GPRINT:percX:LAST:%5.2lf%%\\\\n";
} }
?> ?>
+1 -4
View File
@@ -68,7 +68,7 @@ if ($_SESSION['userlevel'] >= '10')
{ {
if (count($cache['device_types'])) if (count($cache['device_types']))
{ {
echo (' echo('
<li><hr width="140" /></li>'); <li><hr width="140" /></li>');
} }
echo(' echo('
@@ -395,8 +395,6 @@ foreach (array_keys($menu_sensors) as $item)
$app_count = dbFetchCell("SELECT COUNT(`app_id`) FROM `applications`"); $app_count = dbFetchCell("SELECT COUNT(`app_id`) FROM `applications`");
if ($_SESSION['userlevel'] >= '5' && ($app_count) > "0") if ($_SESSION['userlevel'] >= '5' && ($app_count) > "0")
{ {
?> ?>
@@ -435,7 +433,6 @@ if ($_SESSION['userlevel'] >= '5' && ($routing_count['bgp']+$routing_count['ospf
<div class="dropdown_1column"><!-- Begin 1 column container --> <div class="dropdown_1column"><!-- Begin 1 column container -->
<ul> <ul>
<?php <?php
$separator = 0; $separator = 0;
+2 -4
View File
@@ -13,11 +13,10 @@ $graphs['mysql'] = array('network_traffic', 'connections', 'command_counters',
$graph_array_zoom['width'] = "400"; $graph_array_zoom['width'] = "400";
$graph_array['legend'] = "no"; $graph_array['legend'] = "no";
echo('<h2>'.$vars['app'].'</h2>'); echo('<h2>'.$vars['app'].'</h2>');
echo('<table cellpadding=5 cellspacing=0 class=devicetable width=100%>'); echo('<table cellpadding=5 cellspacing=0 class=devicetable width=100%>');
$app_devices = dbFetchRows("SELECT * FROM `devices` AS D, `applications` AS A WHERE D.device_id = A.device_id AND A.app_type = ?", array($vars['app'])); $app_devices = dbFetchRows("SELECT * FROM `devices` AS D, `applications` AS A WHERE D.device_id = A.device_id AND A.app_type = ?", array($vars['app']));
foreach($app_devices as $app_device) foreach ($app_devices as $app_device)
{ {
echo('<tr class="list-device">'); echo('<tr class="list-device">');
echo('<td class="device-head" width=300px>'.generate_device_link($device, shorthost($app_device['hostname']), array('tab'=>'apps','app'=>$vars['app'])).'</td>'); echo('<td class="device-head" width=300px>'.generate_device_link($device, shorthost($app_device['hostname']), array('tab'=>'apps','app'=>$vars['app'])).'</td>');
@@ -28,7 +27,7 @@ $graphs['mysql'] = array('network_traffic', 'connections', 'command_counters',
echo('<tr class="list-device">'); echo('<tr class="list-device">');
echo('<td colspan=4>'); echo('<td colspan=4>');
foreach($graphs[$vars['app']] as $graph_type) foreach ($graphs[$vars['app']] as $graph_type)
{ {
$graph_array['type'] = "application_".$vars['app']."_".$graph_type; $graph_array['type'] = "application_".$vars['app']."_".$graph_type;
$graph_array['id'] = $app_device['app_id']; $graph_array['id'] = $app_device['app_id'];
@@ -47,5 +46,4 @@ $graphs['mysql'] = array('network_traffic', 'connections', 'command_counters',
} }
echo('</table>'); echo('</table>');
?> ?>
+2 -4
View File
@@ -13,14 +13,12 @@ $graph_array_zoom['height'] = "150";
$graph_array_zoom['width'] = "400"; $graph_array_zoom['width'] = "400";
$graph_array['legend'] = "no"; $graph_array['legend'] = "no";
foreach ($app_list as $app)
foreach($app_list as $app)
{ {
echo('<div style="clear: both;">'); echo('<div style="clear: both;">');
echo('<h2>'.generate_link(ucfirst($app['app_type']),array('page'=>'apps','app'=>$app['app_type'])).'</h2>'); echo('<h2>'.generate_link(ucfirst($app['app_type']),array('page'=>'apps','app'=>$app['app_type'])).'</h2>');
$app_devices = dbFetchRows("SELECT * FROM `devices` AS D, `applications` AS A WHERE D.device_id = A.device_id AND A.app_type = ?", array($app['app_type'])); $app_devices = dbFetchRows("SELECT * FROM `devices` AS D, `applications` AS A WHERE D.device_id = A.device_id AND A.app_type = ?", array($app['app_type']));
foreach($app_devices as $app_device) foreach ($app_devices as $app_device)
{ {
$graph_type = $graphs[$app['app_type']][0]; $graph_type = $graphs[$app['app_type']][0];
-1
View File
@@ -25,5 +25,4 @@ foreach ($graphs as $key => $text)
echo("</td></tr>"); echo("</td></tr>");
} }
?> ?>
+2 -2
View File
@@ -39,7 +39,7 @@ if (!$auth)
} }
# Load our list of available graphtypes for this object # Load our list of available graphtypes for this object
# Fixme not all of these are going to be valid # FIXME not all of these are going to be valid
if ($handle = opendir($config['install_dir'] . "/html/includes/graphs/".$type."/")) if ($handle = opendir($config['install_dir'] . "/html/includes/graphs/".$type."/"))
{ {
while (false !== ($file = readdir($handle))) while (false !== ($file = readdir($handle)))
@@ -231,7 +231,7 @@ if (!$auth)
} }
### FIXME : do this properly ### FIXME : do this properly
# if($type == "port" && $subtype == "bits") # if ($type == "port" && $subtype == "bits")
# { # {
echo(' | '); echo(' | ');
if ($vars['previous'] == "yes") if ($vars['previous'] == "yes")
-1
View File
@@ -454,7 +454,6 @@ $config['poller_modules']['entity-physical'] = 1;
$config['poller_modules']['unix-agent'] = 0; $config['poller_modules']['unix-agent'] = 0;
$config['poller_modules']['applications'] = 1; $config['poller_modules']['applications'] = 1;
## List of discovery modules. Need to be in this array to be ## List of discovery modules. Need to be in this array to be
## considered for execution. ## considered for execution.
+2 -3
View File
@@ -2,7 +2,7 @@
## Polls Apache statistics from script via SNMP ## Polls Apache statistics from script via SNMP
if(!empty($agent_data['apache'])) if (!empty($agent_data['apache']))
{ {
$apache = $agent_data['apache']; $apache = $agent_data['apache'];
} else { } else {
@@ -12,10 +12,9 @@ if(!empty($agent_data['apache']))
} }
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/app-apache-".$app['app_id'].".rrd"; $rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/app-apache-".$app['app_id'].".rrd";
echo(" apache"); echo(" apache");
list ($total_access, $total_kbyte, $cpuload, $uptime, $reqpersec, $bytespersec, $bytesperreq, $busyworkers, $idleworkers, list ($total_access, $total_kbyte, $cpuload, $uptime, $reqpersec, $bytespersec, $bytesperreq, $busyworkers, $idleworkers,
$score_wait, $score_start, $score_reading, $score_writing, $score_keepalive, $score_dns, $score_closing, $score_logging, $score_wait, $score_start, $score_reading, $score_writing, $score_keepalive, $score_dns, $score_closing, $score_logging,
$score_graceful, $score_idle, $score_open) = explode("\n", $apache); $score_graceful, $score_idle, $score_open) = explode("\n", $apache);
+2 -4
View File
@@ -5,11 +5,10 @@ $drbd_data = $agent_data['drbd'][$drbd_dev];
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/app-drbd-".$drbd_dev.".rrd"; $rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/app-drbd-".$drbd_dev.".rrd";
foreach (explode("|", $drbd_data) as $part)
foreach(explode("|", $drbd_data) as $part)
{ {
list($stat, $val) = explode("=", $part); list($stat, $val) = explode("=", $part);
if(!empty($stat)) if (!empty($stat))
{ {
$drbd[$stat] = $val; $drbd[$stat] = $val;
} }
@@ -32,5 +31,4 @@ $rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/app-drbd-".$
rrdtool_update($rrd_filename, "N:".$drbd['ns'].":".$drbd['nr'].":".$drbd['dw'].":".$drbd['dr'].":".$drbd['al'].":".$drbd['bm'].":".$drbd['lo'].":".$drbd['pe'].":".$drbd['ua'].":".$drbd['ap'].":".$drbd['oop']); rrdtool_update($rrd_filename, "N:".$drbd['ns'].":".$drbd['nr'].":".$drbd['dw'].":".$drbd['dr'].":".$drbd['al'].":".$drbd['bm'].":".$drbd['lo'].":".$drbd['pe'].":".$drbd['ua'].":".$drbd['ap'].":".$drbd['oop']);
?> ?>
+1 -1
View File
@@ -1,6 +1,6 @@
<?php <?php
### Fixme - this is lame ### FIXME - this is lame
if(!empty($agent_data['mysql'])) if(!empty($agent_data['mysql']))
{ {
$mysql = $agent_data['mysql']; $mysql = $agent_data['mysql'];
+1 -1
View File
@@ -333,7 +333,7 @@ foreach ($ports as $port)
echo('bytes('.formatStorage($port['stats']['ifInOctets_diff']).'/'.formatStorage($port['stats']['ifOutOctets_diff']).')'); echo('bytes('.formatStorage($port['stats']['ifInOctets_diff']).'/'.formatStorage($port['stats']['ifOutOctets_diff']).')');
echo('pkts('.format_si($port['stats']['ifInUcastPkts_rate']).'pps/'.format_si($port['stats']['ifOutUcastPkts_rate']).'pps)'); echo('pkts('.format_si($port['stats']['ifInUcastPkts_rate']).'pps/'.format_si($port['stats']['ifOutUcastPkts_rate']).'pps)');
### Port utilisation % threshold alerting. ## Fixme allow setting threshold per-port. probably 90% of ports we don't care about. ### Port utilisation % threshold alerting. ## FIXME allow setting threshold per-port. probably 90% of ports we don't care about.
if ($config['alerts']['port_util_alert']) if ($config['alerts']['port_util_alert'])
{ {
// Check for port saturation of $config['alerts']['port_util_perc'] or higher. Alert if we see this. // Check for port saturation of $config['alerts']['port_util_perc'] or higher. Alert if we see this.
+6 -6
View File
@@ -9,7 +9,7 @@ if($device['os_group'] == "unix")
$agent = fsockopen($device['hostname'], $port, $errno, $errstr, 10); $agent = fsockopen($device['hostname'], $port, $errno, $errstr, 10);
if(!$agent) if (!$agent)
{ {
echo "Connection to UNIX agent failed on port ".$port."."; echo "Connection to UNIX agent failed on port ".$port.".";
} else { } else {
@@ -19,7 +19,7 @@ if($device['os_group'] == "unix")
} }
} }
if(!empty($agent_raw)) if (!empty($agent_raw))
{ {
foreach (explode("<<<", $agent_raw) as $section) foreach (explode("<<<", $agent_raw) as $section)
{ {
@@ -181,7 +181,7 @@ if($device['os_group'] == "unix")
if (!empty($agent_data['apache'])) if (!empty($agent_data['apache']))
{ {
$app_found['apache'] = TRUE; $app_found['apache'] = TRUE;
if(dbFetchCell("SELECT COUNT(*) FROM `applications` WHERE `device_id` = ? AND `app_type` = ?", array($device['device_id'], 'apache')) == "0") if (dbFetchCell("SELECT COUNT(*) FROM `applications` WHERE `device_id` = ? AND `app_type` = ?", array($device['device_id'], 'apache')) == "0")
{ {
echo("Found new application 'Apache'\n"); echo("Found new application 'Apache'\n");
dbInsert(array('device_id' => $device['device_id'], 'app_type' => 'apache'), 'applications'); dbInsert(array('device_id' => $device['device_id'], 'app_type' => 'apache'), 'applications');
@@ -192,7 +192,7 @@ if($device['os_group'] == "unix")
if (!empty($agent_data['mysql'])) if (!empty($agent_data['mysql']))
{ {
$app_found['mysql'] = TRUE; $app_found['mysql'] = TRUE;
if(dbFetchCell("SELECT COUNT(*) FROM `applications` WHERE `device_id` = ? AND `app_type` = ?", array($device['device_id'], 'mysql')) == "0") if (dbFetchCell("SELECT COUNT(*) FROM `applications` WHERE `device_id` = ? AND `app_type` = ?", array($device['device_id'], 'mysql')) == "0")
{ {
echo("Found new application 'MySQL'\n"); echo("Found new application 'MySQL'\n");
dbInsert(array('device_id' => $device['device_id'], 'app_type' => 'mysql'), 'applications'); dbInsert(array('device_id' => $device['device_id'], 'app_type' => 'mysql'), 'applications');
@@ -207,10 +207,10 @@ if($device['os_group'] == "unix")
foreach (explode("\n", $agent_data['drbd_raw']) as $drbd_entry) foreach (explode("\n", $agent_data['drbd_raw']) as $drbd_entry)
{ {
list($drbd_dev, $drbd_data) = explode(":", $drbd_entry); list($drbd_dev, $drbd_data) = explode(":", $drbd_entry);
if(preg_match("/^drbd/", $drbd_dev)) if (preg_match("/^drbd/", $drbd_dev))
{ {
$agent_data['drbd'][$drbd_dev] = $drbd_data; $agent_data['drbd'][$drbd_dev] = $drbd_data;
if(dbFetchCell("SELECT COUNT(*) FROM `applications` WHERE `device_id` = ? AND `app_type` = ? AND `app_instance` = ?", array($device['device_id'], 'drbd', $drbd_dev)) == "0") if (dbFetchCell("SELECT COUNT(*) FROM `applications` WHERE `device_id` = ? AND `app_type` = ? AND `app_instance` = ?", array($device['device_id'], 'drbd', $drbd_dev)) == "0")
{ {
echo("Found new application 'DRBd' $drbd_dev\n"); echo("Found new application 'DRBd' $drbd_dev\n");
dbInsert(array('device_id' => $device['device_id'], 'app_type' => 'drbd', 'app_instance' => $drbd_dev), 'applications'); dbInsert(array('device_id' => $device['device_id'], 'app_type' => 'drbd', 'app_instance' => $drbd_dev), 'applications');