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

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");

View File

@@ -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:";

View File

@@ -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'";
} }
?> ?>

View File

@@ -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:";

View File

@@ -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:";

View File

@@ -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";

View File

@@ -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))
{ {
@@ -116,7 +114,7 @@ foreach ($rrd_list as $i => $rrd)
} elseif (is_numeric($divider)) } elseif (is_numeric($divider))
{ {
$rrd_options .= " CDEF:X=" . $thingX . $plusesX.",".$divider. ",/"; $rrd_options .= " CDEF:X=" . $thingX . $plusesX.",".$divider. ",/";
} else } else
{ {
$rrd_options .= " CDEF:X=" . $thingX . $plusesX; $rrd_options .= " CDEF:X=" . $thingX . $plusesX;
} }
@@ -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:";
} }
?> ?>

View File

@@ -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)

View File

@@ -146,10 +146,10 @@ if ($error_msg) {
$dst_x = '0'; // destination x $dst_x = '0'; // destination x
$dst_y = '0'; // destination y $dst_y = '0'; // destination y
$dst_im = imagecreatetruecolor($src_w, $src_h); $dst_im = imagecreatetruecolor($src_w, $src_h);
imagesavealpha($dst_im, true); imagesavealpha($dst_im, true);
$white = imagecolorallocate($dst_im, 255, 255, 255); $white = imagecolorallocate($dst_im, 255, 255, 255);
$trans_colour = imagecolorallocatealpha($dst_im, 0, 0, 0, 127); $trans_colour = imagecolorallocatealpha($dst_im, 0, 0, 0, 127);
imagefill($dst_im, 0, 0, $trans_colour); imagefill($dst_im, 0, 0, $trans_colour);
imagecopy($dst_im, $src_im, $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h); imagecopy($dst_im, $src_im, $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h);
imagepng($dst_im); imagepng($dst_im);
imagedestroy($dst_im); imagedestroy($dst_im);

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'";

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";
} }
?> ?>

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;

View File

@@ -13,39 +13,37 @@ $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>');
echo('<td class="device-head" width=100px>'.$app_device['app_instance'].'</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_status'].'</td>');
echo('<td></td>'); echo('<td></td>');
echo('</tr>'); echo('</tr>');
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'];
$graph_array_zoom['type'] = "application_".$vars['app']."_".$graph_type; $graph_array_zoom['type'] = "application_".$vars['app']."_".$graph_type;
$graph_array_zoom['id'] = $app_device['app_id']; $graph_array_zoom['id'] = $app_device['app_id'];
$link_array = $graph_array; $link_array = $graph_array;
$link_array['page'] = "graphs"; $link_array['page'] = "graphs";
unset($link_array['height'], $link_array['width']); unset($link_array['height'], $link_array['width']);
$link = generate_url($link_array); $link = generate_url($link_array);
echo(overlib_link($link, generate_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL)); echo(overlib_link($link, generate_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL));
} }
echo('</td>'); echo('</td>');
echo('</tr>'); echo('</tr>');
} }
echo('</table>'); echo('</table>');
?> ?>

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];
@@ -42,7 +40,7 @@ foreach($app_list as $app)
$overlib_link .= generate_graph_tag($graph_array); $overlib_link .= generate_graph_tag($graph_array);
$overlib_content = generate_overlib_content($graph_array, $port['hostname'] . " - " . $port['label']); $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;'>"); text-align: center; float: left; background-color: #f5f5f5;'>");
echo(overlib_link($link, $overlib_link, $overlib_content)); echo(overlib_link($link, $overlib_link, $overlib_content));
echo("</div>"); echo("</div>");

View File

@@ -5,7 +5,7 @@ echo('<h2>'.$app['app_instance'].'</h2>');
$graphs = array('drbd_network_bits' => 'Network Traffic', $graphs = array('drbd_network_bits' => 'Network Traffic',
'drbd_disk_bits' => 'Disk Traffic', 'drbd_disk_bits' => 'Disk Traffic',
'drbd_unsynced' => 'Unsynced Data', 'drbd_unsynced' => 'Unsynced Data',
'drbd_queue' => 'Queues'); 'drbd_queue' => 'Queues');
foreach ($graphs as $key => $text) foreach ($graphs as $key => $text)
{ {
@@ -25,5 +25,4 @@ foreach ($graphs as $key => $text)
echo("</td></tr>"); echo("</td></tr>");
} }
?> ?>

View File

@@ -37,12 +37,12 @@ $graphs['system'] = array(
$graphs['queries'] = array( $graphs['queries'] = array(
'mysql_command_counters' => 'Command Counters', 'mysql_command_counters' => 'Command Counters',
'mysql_query_cache' => 'Query Cache', 'mysql_query_cache' => 'Query Cache',
'mysql_query_cache_memory' => 'Query Cache Memory', 'mysql_query_cache_memory' => 'Query Cache Memory',
'mysql_select_types' => 'Select Types', 'mysql_select_types' => 'Select Types',
'mysql_slow_queries' => 'Slow Queries', 'mysql_slow_queries' => 'Slow Queries',
'mysql_sorts' => 'Sorts', 'mysql_sorts' => 'Sorts',
); );
$graphs['innodb'] = array( $graphs['innodb'] = array(
'mysql_innodb_buffer_pool' => 'InnoDB Buffer Pool', 'mysql_innodb_buffer_pool' => 'InnoDB Buffer Pool',
@@ -54,7 +54,7 @@ $graphs['innodb'] = array(
'mysql_innodb_row_operations' => 'InnoDB Row Operations', 'mysql_innodb_row_operations' => 'InnoDB Row Operations',
'mysql_innodb_semaphores' => 'InnoDB semaphores', 'mysql_innodb_semaphores' => 'InnoDB semaphores',
'mysql_innodb_transactions' => 'InnoDB Transactions', 'mysql_innodb_transactions' => 'InnoDB Transactions',
); );
foreach ($graphs[$vars['app_section']] as $key => $text) foreach ($graphs[$vars['app_section']] as $key => $text)
{ {

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")

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.

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,12 +12,11 @@ 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);
if (!is_file($rrd_filename)) if (!is_file($rrd_filename))
{ {

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']);
?> ?>

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'];

View File

@@ -14,7 +14,7 @@ if (!is_file($sessrrd))
rrdtool_create($sessrrd, " --step 300 \ rrdtool_create($sessrrd, " --step 300 \
DS:allocate:GAUGE:600:0:3000000 \ DS:allocate:GAUGE:600:0:3000000 \
DS:max: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"); rrdtool_update("$sessrrd", "N:$sessalloc:$sessmax:$sessfailed");

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.

View File

@@ -4,12 +4,12 @@ if($device['os_group'] == "unix")
{ {
echo("Observium UNIX Agent: "); echo("Observium UNIX Agent: ");
$port='6556'; $port='6556';
$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 {
@@ -18,25 +18,25 @@ if($device['os_group'] == "unix")
$agent_raw .= fgets($agent, 128); $agent_raw .= fgets($agent, 128);
} }
} }
if(!empty($agent_raw)) if (!empty($agent_raw))
{ {
foreach (explode("<<<", $agent_raw) as $section) foreach (explode("<<<", $agent_raw) as $section)
{ {
list($section, $data) = explode(">>>", $section); list($section, $data) = explode(">>>", $section);
$agent_data[$section] = trim($data); $agent_data[$section] = trim($data);
} }
## FIXME - split these into separate modules which are "autoloaded" when the section exists. ## FIXME - split these into separate modules which are "autoloaded" when the section exists.
### RPM ### RPM
if (!empty($agent_data['rpm'])) if (!empty($agent_data['rpm']))
{ {
echo("\nRPM Packages: "); echo("\nRPM Packages: ");
## Build array of existing packages ## Build array of existing packages
$manager = "rpm"; $manager = "rpm";
$pkgs_db_db = dbFetchRows("SELECT * FROM `packages` WHERE `device_id` = ?", array($device['device_id'])); $pkgs_db_db = dbFetchRows("SELECT * FROM `packages` WHERE `device_id` = ?", array($device['device_id']));
foreach ($pkgs_db_db as $pkg_db) 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']]['version'] = $pkg_db['version'];
$pkgs_db_id[$pkg_db['pkg_id']]['build'] = $pkg_db['build']; $pkgs_db_id[$pkg_db['pkg_id']]['build'] = $pkg_db['build'];
} }
foreach (explode("\n", $agent_data['rpm']) as $package) foreach (explode("\n", $agent_data['rpm']) as $package)
{ {
list($name, $version, $build, $arch, $size) = explode(" ", $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]; $pkgs_id[] = $pkgs[$manager][$name][$arch][$version][$build];
} }
} }
### DPKG ### DPKG
if (!empty($agent_data['dpkg'])) if (!empty($agent_data['dpkg']))
{ {
echo("\nDEB Packages: "); echo("\nDEB Packages: ");
## Build array of existing packages ## Build array of existing packages
$manager = "deb"; $manager = "deb";
$pkgs_db_db = dbFetchRows("SELECT * FROM `packages` WHERE `device_id` = ?", array($device['device_id'])); $pkgs_db_db = dbFetchRows("SELECT * FROM `packages` WHERE `device_id` = ?", array($device['device_id']));
foreach ($pkgs_db_db as $pkg_db) 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']]['version'] = $pkg_db['version'];
$pkgs_db_id[$pkg_db['pkg_id']]['build'] = $pkg_db['build']; $pkgs_db_id[$pkg_db['pkg_id']]['build'] = $pkg_db['build'];
} }
foreach (explode("\n", $agent_data['dpkg']) as $package) foreach (explode("\n", $agent_data['dpkg']) as $package)
{ {
list($name, $version, $arch, $size) = explode(" ", $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]; $pkgs_id[] = $pkgs[$manager][$name][$arch][$version][$build];
} }
} }
## This is run for all "packages" and is common to RPM/DEB/etc ## This is run for all "packages" and is common to RPM/DEB/etc
foreach ($pkgs_id as $pkg) foreach ($pkgs_id as $pkg)
{ {
@@ -111,10 +111,10 @@ if($device['os_group'] == "unix")
$build = $pkg['build']; $build = $pkg['build'];
$arch = $pkg['arch']; $arch = $pkg['arch'];
$size = $pkg['size']; $size = $pkg['size'];
#echo(str_pad($name, 20)." ".str_pad($version, 10)." ".str_pad($build, 10)." ".$arch."\n"); #echo(str_pad($name, 20)." ".str_pad($version, 10)." ".str_pad($build, 10)." ".$arch."\n");
#echo($name." "); #echo($name." ");
if (is_array($pkgs_db[$pkg['manager']][$pkg['name']][$pkg['arch']][$pkg['version']][$pkg['build']])) if (is_array($pkgs_db[$pkg['manager']][$pkg['name']][$pkg['arch']][$pkg['version']][$pkg['build']]))
{ {
### FIXME - packages_history table ### FIXME - packages_history table
@@ -155,7 +155,7 @@ if($device['os_group'] == "unix")
} }
unset($pkg_update); unset($pkg_update);
} }
## Packages ## Packages
foreach ($pkgs_db_id as $id => $pkg) foreach ($pkgs_db_id as $id => $pkg)
{ {
@@ -163,7 +163,7 @@ if($device['os_group'] == "unix")
echo("-".$pkg['text']); echo("-".$pkg['text']);
log_event('Package removed: '.$pkg['name'].' '.$pkg['arch'].' '.$pkg['version'].'-'.$pkg['build'], $device, 'package'); log_event('Package removed: '.$pkg['name'].' '.$pkg['arch'].' '.$pkg['version'].'-'.$pkg['build'], $device, 'package');
} }
### Processes ### Processes
if (!empty($agent_data['ps'])) 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); $process = preg_replace("/\((.*),([0-9]*),([0-9]*),([0-9\.]*)\)\ (.*)/", "\\1|\\2|\\3|\\4|\\5", $process);
list($user, $vsz, $rss, $pcpu, $command) = explode("|", $process, 5); 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); #print_r($processlist);
} }
### Apache ### Apache
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');
} }
} }
### MySQL ### MySQL
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');
} }
} }
### DRBD ### DRBD
if (!empty($agent_data['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) 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');
@@ -219,14 +219,14 @@ if($device['os_group'] == "unix")
} }
} }
} }
unset($pkg); unset($pkg);
unset($pkgs_db_id); unset($pkgs_db_id);
unset($pkg_c); unset($pkg_c);
unset($pkgs); unset($pkgs);
unset($pkgs_db); unset($pkgs_db);
unset($pkgs_db_db); unset($pkgs_db_db);
echo("\n"); echo("\n");
} }