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";
include("includes/graphs/generic_multi_seperated.inc.php");
#include("includes/graphs/generic_multi_bits_separated.inc.php");
#include("includes/graphs/generic_multi_data.inc.php");
@@ -91,7 +91,6 @@ if($format == "octets" || $format == "bytes")
$format = "bits";
}
$rrd_options .= " COMMENT:'bps Now Ave Max 95th %\\n'";
$rrd_options .= " AREA:in".$format."_max#aDEB7B:";
@@ -73,8 +73,6 @@ if($_GET['previous'] == "yes")
}
}
$rrd_options .= " AREA:in#".$colour_area_in.":";
$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'";
}
?>
@@ -19,7 +19,7 @@ foreach ($rrd_filenames as $key => $rrd_filename)
$seperator = ",";
$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:".$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:d95thout=doutbits,5,PERCENT";
if($_GET['previous'] == "yes")
if ($_GET['previous'] == "yes")
{
$rrd_options .= " CDEF:".$in."octetsX=" . $in_thingX . $pluses;
$rrd_options .= " CDEF:".$out."octetsX=" . $out_thingX . $pluses;
@@ -85,7 +85,7 @@ if ($i)
$rrd_options .= " LINE1:95thin#aa0000";
$rrd_options .= " LINE1:d95thout#aa0000";
if($_GET['previous'] == "yes")
if ($_GET['previous'] == "yes")
{
$rrd_options .= " AREA:inbitsX#9999966:";
$rrd_options .= " AREA:doutbitsX#99999966:";
@@ -28,7 +28,7 @@ foreach ($rrd_filenames as $key => $rrd_filename)
$seperator = ",";
$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:".$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:d95thout=doutbits,5,PERCENT";
if($_GET['previous'] == "yes")
if ($_GET['previous'] == "yes")
{
$rrd_options .= " CDEF:".$in."octetsX=" . $in_thingX . $pluses;
$rrd_options .= " CDEF:".$out."octetsX=" . $out_thingX . $pluses;
@@ -94,7 +94,7 @@ if ($i)
$rrd_options .= " LINE1:95thin#aa0000";
$rrd_options .= " LINE1:d95thout#aa0000";
if($_GET['previous'] == "yes")
if ($_GET['previous'] == "yes")
{
$rrd_options .= " AREA:in".$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: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:".$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++;
}
if($_GET['previous'] == "yes")
if ($_GET['previous'] == "yes")
{
$rrd_options .= " CDEF:".$in."octetsX=" . $in_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";
}
if($_GET['previous'] == "yes")
if ($_GET['previous'] == "yes")
{
$rrd_options .= " AREA:in".$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 .= $rrd_optionsb;
$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 ";
}
if($_GET['previous'])
if ($_GET['previous'])
{
$rrd_options .= " DEF:".$i . "X=".$rrd['filename'].":".$rrd['ds'].":AVERAGE:start=".$prev_from.":end=".$from;
$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 . ",/";
}
## Are our text values related to te multiplier/divisor or not?
if (isset($text_orig) && $text_orig)
{
@@ -108,7 +106,7 @@ foreach ($rrd_list as $i => $rrd)
$rrd_options .= " COMMENT:'\\n'";
}
if($_GET['previous'] == "yes")
if ($_GET['previous'] == "yes")
{
if (is_numeric($multiplier))
{
@@ -116,7 +114,7 @@ foreach ($rrd_list as $i => $rrd)
} elseif (is_numeric($divider))
{
$rrd_options .= " CDEF:X=" . $thingX . $plusesX.",".$divider. ",/";
} else
} else
{
$rrd_options .= " CDEF:X=" . $thingX . $plusesX;
}
@@ -124,9 +122,6 @@ foreach ($rrd_list as $i => $rrd)
$rrd_options .= " AREA:X#99999999:";
$rrd_options .= " LINE1.25:X#666666:";
}
?>
@@ -73,7 +73,6 @@ if($colour_minmax)
}
}
$rrd_options .= " COMMENT:'".$unit_text."Now Ave Max";
if ($percentile)
+3 -3
View File
@@ -146,10 +146,10 @@ if ($error_msg) {
$dst_x = '0'; // destination x
$dst_y = '0'; // destination y
$dst_im = imagecreatetruecolor($src_w, $src_h);
imagesavealpha($dst_im, true);
imagesavealpha($dst_im, true);
$white = imagecolorallocate($dst_im, 255, 255, 255);
$trans_colour = imagecolorallocatealpha($dst_im, 0, 0, 0, 127);
imagefill($dst_im, 0, 0, $trans_colour);
$trans_colour = imagecolorallocatealpha($dst_im, 0, 0, 0, 127);
imagefill($dst_im, 0, 0, $trans_colour);
imagecopy($dst_im, $src_im, $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h);
imagepng($dst_im);
imagedestroy($dst_im);
+2 -3
View File
@@ -17,15 +17,14 @@ $unit_text = "Usage";
include("includes/graphs/generic_simplex.inc.php");
if($poop)
{
$scale_min = "0";
$scale_max = "100";
include("includes/graphs/common.inc.php");
$iter = "1";
$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:perc:LAST:%5.2lf%%\\\\n";
if($_GET['previous'])
if ($_GET['previous'])
{
$descr = substr(str_pad("Prev ".$storage[storage_descr], 12),0,12);
$descr = str_replace(":","\:",$descr);
@@ -53,4 +53,5 @@ if($_GET['previous'])
$rrd_options .= " GPRINT:freeX:LAST:%6.2lf%sB";
$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']))
{
echo ('
echo('
<li><hr width="140" /></li>');
}
echo('
@@ -395,8 +395,6 @@ foreach (array_keys($menu_sensors) as $item)
$app_count = dbFetchCell("SELECT COUNT(`app_id`) FROM `applications`");
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 -->
<ul>
<?php
$separator = 0;
+16 -18
View File
@@ -13,39 +13,37 @@ $graphs['mysql'] = array('network_traffic', 'connections', 'command_counters',
$graph_array_zoom['width'] = "400";
$graph_array['legend'] = "no";
echo('<h2>'.$vars['app'].'</h2>');
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']));
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=100px>'.$app_device['app_instance'].'</td>');
echo('<td class="device-head" width=100px>'.$app_device['app_status'].'</td>');
echo('<td class="device-head" width=100px>'.$app_device['app_instance'].'</td>');
echo('<td class="device-head" width=100px>'.$app_device['app_status'].'</td>');
echo('<td></td>');
echo('</tr>');
echo('<tr class="list-device">');
echo('<td colspan=4>');
echo('<tr class="list-device">');
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['id'] = $app_device['app_id'];
$graph_array_zoom['type'] = "application_".$vars['app']."_".$graph_type;
$graph_array['type'] = "application_".$vars['app']."_".$graph_type;
$graph_array['id'] = $app_device['app_id'];
$graph_array_zoom['type'] = "application_".$vars['app']."_".$graph_type;
$graph_array_zoom['id'] = $app_device['app_id'];
$link_array = $graph_array;
$link_array['page'] = "graphs";
unset($link_array['height'], $link_array['width']);
$link = generate_url($link_array);
echo(overlib_link($link, generate_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL));
$link_array = $graph_array;
$link_array['page'] = "graphs";
unset($link_array['height'], $link_array['width']);
$link = generate_url($link_array);
echo(overlib_link($link, generate_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL));
}
echo('</td>');
echo('</tr>');
}
echo('</table>');
?>
+3 -5
View File
@@ -13,14 +13,12 @@ $graph_array_zoom['height'] = "150";
$graph_array_zoom['width'] = "400";
$graph_array['legend'] = "no";
foreach($app_list as $app)
foreach ($app_list as $app)
{
echo('<div style="clear: both;">');
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']));
foreach($app_devices as $app_device)
foreach ($app_devices as $app_device)
{
$graph_type = $graphs[$app['app_type']][0];
@@ -42,7 +40,7 @@ foreach($app_list as $app)
$overlib_link .= generate_graph_tag($graph_array);
$overlib_content = generate_overlib_content($graph_array, $port['hostname'] . " - " . $port['label']);
echo("<div style='display: block; padding: 1px; margin: 2px; min-width: ".$width_div."px; max-width:".$width_div."px; min-height:180px; max-height:180px;
echo("<div style='display: block; padding: 1px; margin: 2px; min-width: ".$width_div."px; max-width:".$width_div."px; min-height:180px; max-height:180px;
text-align: center; float: left; background-color: #f5f5f5;'>");
echo(overlib_link($link, $overlib_link, $overlib_content));
echo("</div>");
+1 -2
View File
@@ -5,7 +5,7 @@ echo('<h2>'.$app['app_instance'].'</h2>');
$graphs = array('drbd_network_bits' => 'Network Traffic',
'drbd_disk_bits' => 'Disk Traffic',
'drbd_unsynced' => 'Unsynced Data',
'drbd_queue' => 'Queues');
'drbd_queue' => 'Queues');
foreach ($graphs as $key => $text)
{
@@ -25,5 +25,4 @@ foreach ($graphs as $key => $text)
echo("</td></tr>");
}
?>
+3 -3
View File
@@ -37,12 +37,12 @@ $graphs['system'] = array(
$graphs['queries'] = array(
'mysql_command_counters' => 'Command Counters',
'mysql_query_cache' => 'Query Cache',
'mysql_query_cache' => 'Query Cache',
'mysql_query_cache_memory' => 'Query Cache Memory',
'mysql_select_types' => 'Select Types',
'mysql_slow_queries' => 'Slow Queries',
'mysql_sorts' => 'Sorts',
);
);
$graphs['innodb'] = array(
'mysql_innodb_buffer_pool' => 'InnoDB Buffer Pool',
@@ -54,7 +54,7 @@ $graphs['innodb'] = array(
'mysql_innodb_row_operations' => 'InnoDB Row Operations',
'mysql_innodb_semaphores' => 'InnoDB semaphores',
'mysql_innodb_transactions' => 'InnoDB Transactions',
);
);
foreach ($graphs[$vars['app_section']] as $key => $text)
{
+2 -2
View File
@@ -39,7 +39,7 @@ if (!$auth)
}
# 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."/"))
{
while (false !== ($file = readdir($handle)))
@@ -231,7 +231,7 @@ if (!$auth)
}
### FIXME : do this properly
# if($type == "port" && $subtype == "bits")
# if ($type == "port" && $subtype == "bits")
# {
echo(' | ');
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']['applications'] = 1;
## List of discovery modules. Need to be in this array to be
## considered for execution.
+4 -5
View File
@@ -2,7 +2,7 @@
## Polls Apache statistics from script via SNMP
if(!empty($agent_data['apache']))
if (!empty($agent_data['apache']))
{
$apache = $agent_data['apache'];
} else {
@@ -12,12 +12,11 @@ if(!empty($agent_data['apache']))
}
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/app-apache-".$app['app_id'].".rrd";
echo(" apache");
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_graceful, $score_idle, $score_open) = explode("\n", $apache);
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_graceful, $score_idle, $score_open) = explode("\n", $apache);
if (!is_file($rrd_filename))
{
+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";
foreach(explode("|", $drbd_data) as $part)
foreach (explode("|", $drbd_data) as $part)
{
list($stat, $val) = explode("=", $part);
if(!empty($stat))
if (!empty($stat))
{
$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']);
?>
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
### Fixme - this is lame
### FIXME - this is lame
if(!empty($agent_data['mysql']))
{
$mysql = $agent_data['mysql'];
+1 -1
View File
@@ -14,7 +14,7 @@ if (!is_file($sessrrd))
rrdtool_create($sessrrd, " --step 300 \
DS:allocate:GAUGE:600:0:3000000 \
DS:max:GAUGE:600:0:3000000 \
DS:failed:GAUGE:600:0:1000 ".$config['rrd_rra']);
DS:failed:GAUGE:600:0:1000 ".$config['rrd_rra']);
}
rrdtool_update("$sessrrd", "N:$sessalloc:$sessmax:$sessfailed");
+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('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'])
{
// Check for port saturation of $config['alerts']['port_util_perc'] or higher. Alert if we see this.
+29 -29
View File
@@ -4,12 +4,12 @@ if($device['os_group'] == "unix")
{
echo("Observium UNIX Agent: ");
$port='6556';
$agent = fsockopen($device['hostname'], $port, $errno, $errstr, 10);
if(!$agent)
if (!$agent)
{
echo "Connection to UNIX agent failed on port ".$port.".";
} else {
@@ -18,25 +18,25 @@ if($device['os_group'] == "unix")
$agent_raw .= fgets($agent, 128);
}
}
if(!empty($agent_raw))
if (!empty($agent_raw))
{
foreach (explode("<<<", $agent_raw) as $section)
{
list($section, $data) = explode(">>>", $section);
$agent_data[$section] = trim($data);
}
## FIXME - split these into separate modules which are "autoloaded" when the section exists.
### RPM
if (!empty($agent_data['rpm']))
{
echo("\nRPM Packages: ");
## Build array of existing packages
$manager = "rpm";
$pkgs_db_db = dbFetchRows("SELECT * FROM `packages` WHERE `device_id` = ?", array($device['device_id']));
foreach ($pkgs_db_db as $pkg_db)
{
@@ -50,7 +50,7 @@ if($device['os_group'] == "unix")
$pkgs_db_id[$pkg_db['pkg_id']]['version'] = $pkg_db['version'];
$pkgs_db_id[$pkg_db['pkg_id']]['build'] = $pkg_db['build'];
}
foreach (explode("\n", $agent_data['rpm']) as $package)
{
list($name, $version, $build, $arch, $size) = explode(" ", $package);
@@ -65,14 +65,14 @@ if($device['os_group'] == "unix")
$pkgs_id[] = $pkgs[$manager][$name][$arch][$version][$build];
}
}
### DPKG
if (!empty($agent_data['dpkg']))
{
echo("\nDEB Packages: ");
## Build array of existing packages
$manager = "deb";
$pkgs_db_db = dbFetchRows("SELECT * FROM `packages` WHERE `device_id` = ?", array($device['device_id']));
foreach ($pkgs_db_db as $pkg_db)
{
@@ -86,7 +86,7 @@ if($device['os_group'] == "unix")
$pkgs_db_id[$pkg_db['pkg_id']]['version'] = $pkg_db['version'];
$pkgs_db_id[$pkg_db['pkg_id']]['build'] = $pkg_db['build'];
}
foreach (explode("\n", $agent_data['dpkg']) as $package)
{
list($name, $version, $arch, $size) = explode(" ", $package);
@@ -102,7 +102,7 @@ if($device['os_group'] == "unix")
$pkgs_id[] = $pkgs[$manager][$name][$arch][$version][$build];
}
}
## This is run for all "packages" and is common to RPM/DEB/etc
foreach ($pkgs_id as $pkg)
{
@@ -111,10 +111,10 @@ if($device['os_group'] == "unix")
$build = $pkg['build'];
$arch = $pkg['arch'];
$size = $pkg['size'];
#echo(str_pad($name, 20)." ".str_pad($version, 10)." ".str_pad($build, 10)." ".$arch."\n");
#echo($name." ");
if (is_array($pkgs_db[$pkg['manager']][$pkg['name']][$pkg['arch']][$pkg['version']][$pkg['build']]))
{
### FIXME - packages_history table
@@ -155,7 +155,7 @@ if($device['os_group'] == "unix")
}
unset($pkg_update);
}
## Packages
foreach ($pkgs_db_id as $id => $pkg)
{
@@ -163,7 +163,7 @@ if($device['os_group'] == "unix")
echo("-".$pkg['text']);
log_event('Package removed: '.$pkg['name'].' '.$pkg['arch'].' '.$pkg['version'].'-'.$pkg['build'], $device, 'package');
}
### Processes
if (!empty($agent_data['ps']))
{
@@ -172,33 +172,33 @@ if($device['os_group'] == "unix")
{
$process = preg_replace("/\((.*),([0-9]*),([0-9]*),([0-9\.]*)\)\ (.*)/", "\\1|\\2|\\3|\\4|\\5", $process);
list($user, $vsz, $rss, $pcpu, $command) = explode("|", $process, 5);
$processlist[] = array('user' => $user, 'vsz' => $vsz, 'rss' => $rss, 'pcpu' => $pcpu, 'command' => $command);
$processlist[] = array('user' => $user, 'vsz' => $vsz, 'rss' => $rss, 'pcpu' => $pcpu, 'command' => $command);
}
#print_r($processlist);
}
### Apache
if (!empty($agent_data['apache']))
{
$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");
dbInsert(array('device_id' => $device['device_id'], 'app_type' => 'apache'), 'applications');
}
}
### MySQL
if (!empty($agent_data['mysql']))
{
$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");
dbInsert(array('device_id' => $device['device_id'], 'app_type' => 'mysql'), 'applications');
}
}
### DRBD
if (!empty($agent_data['drbd']))
{
@@ -207,10 +207,10 @@ if($device['os_group'] == "unix")
foreach (explode("\n", $agent_data['drbd_raw']) as $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;
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");
dbInsert(array('device_id' => $device['device_id'], 'app_type' => 'drbd', 'app_instance' => $drbd_dev), 'applications');
@@ -219,14 +219,14 @@ if($device['os_group'] == "unix")
}
}
}
unset($pkg);
unset($pkgs_db_id);
unset($pkg_c);
unset($pkgs);
unset($pkgs_db);
unset($pkgs_db_db);
echo("\n");
}