Minor fixes, some cleanups, and standardising on echo("x") instead of echo "x"

git-svn-id: http://www.observium.org/svn/observer/trunk@1728 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Tom Laermans
2010-11-20 14:04:07 +00:00
parent 0cd548f0f2
commit 30bdd952ee
63 changed files with 199 additions and 283 deletions

View File

@ -11,7 +11,7 @@ if (file_exists('html/includes/authentication/' . $config['auth_mechanism'] . '.
}
else
{
echo "ERROR: no valid auth_mechanism defined.\n";
echo("ERROR: no valid auth_mechanism defined.\n)";
exit();
}
@ -31,7 +31,7 @@ if (auth_usermanagement())
}
else
{
echo "Auth module does not allow adding users!\n";
echo("Auth module does not allow adding users!\n");
}
?>

View File

@ -11,7 +11,7 @@ if($argv[1]) {
$host = strtolower($argv[1]);
$id = getidbyname($host);
if($id) {
echo delete_device($id);
echo(delete_device($id));
echo("Removed $host\n");
} else {
echo("Host doesn't exist!\n");

View File

@ -89,7 +89,7 @@ if (file_exists('.svn'))
if ($dbu_rev+0 > $db_rev)
{
echo "SVN revision changed.\n";
echo("SVN revision changed.\n");
if($db_rev+0 < "1000") {
echo("Running pre-revision 1000 SQL update script...\n");
shell_exec("scripts/update-sql.php database-update-pre1000.sql");
@ -124,7 +124,7 @@ while ($device = mysql_fetch_array($device_query))
mysql_query("UPDATE `devices` SET `os` = '".strtolower($device['os'])."' WHERE device_id = '".$device['device_id']."'");
$device['os'] = strtolower($device['os']); echo("OS lowercased.");
}
if($config['os'][$device['os']]['group']) {$device['os_group'] = $config['os'][$device['os']]['group']; echo "(".$device['os_group'].")";}
if($config['os'][$device['os']]['group']) {$device['os_group'] = $config['os'][$device['os']]['group']; echo("(".$device['os_group'].")");}
echo("\n");
@ -184,6 +184,7 @@ if($discovered_devices) {
$string = $argv[0] . " $doing " . date("F j, Y, G:i") . " - $discovered_devices devices discovered in $proctime secs";
if ($debug) echo("$string\n");
# FIXME EWW
shell_exec("echo '".$string."' >> ".$config['log_file']);
?>

View File

@ -13,14 +13,14 @@
$rrdcached = " --daemon " . $config['rrdcached'];
}
echo $count . " Files \n";
echo($count . " Files \n");
$start = date("U");
$i = 0;
foreach($files as $file){
fixRdd($file);
$i++;
if(date("U") - $start > 1)
echo round(($i / $count) * 100, 2) . "% \r";
echo(round(($i / $count) * 100, 2) . "% \r");
}
function getDirectoryTree( $outerDir, &$files = array()){
@ -201,7 +201,7 @@ THIRD;
}
echo "\n";
echo("\n");
?>

View File

@ -1,6 +1,6 @@
<?php
if($_GET['debug']) {
if ($_GET['debug']) {
ini_set('display_errors', 1);
ini_set('display_startup_errors', 0);
ini_set('log_errors', 0);
@ -8,21 +8,22 @@ if($_GET['debug']) {
ini_set('error_reporting', E_ALL);
}
include("../includes/defaults.inc.php");
include("../config.php");
include("includes/functions.inc.php");
include("../includes/common.php");
include("../includes/rewrites.php");
include("includes/authenticate.inc.php");
include("../includes/defaults.inc.php");
include("../config.php");
include("includes/functions.inc.php");
include("../includes/common.php");
include("../includes/rewrites.php");
include("includes/authenticate.inc.php");
if(!$_SESSION['authenticated']) { echo("unauthenticated"); exit; }
if (!$_SESSION['authenticated']) { echo("unauthenticated"); exit; }
if(is_numeric($_GET['device_id'])){
$ports = mysql_query("SELECT * FROM ports WHERE device_id = '".$_GET['device_id']."'");
while($interface = mysql_fetch_array($ports)) {
echo "obj.options[obj.options.length] = new Option('".$interface['ifDescr']." - ".$interface['ifAlias']."','".$interface['interface_id']."');\n";
if (is_numeric($_GET['device_id']))
{
$ports = mysql_query("SELECT * FROM ports WHERE device_id = '".$_GET['device_id']."'");
while($interface = mysql_fetch_array($ports))
{
echo("obj.options[obj.options.length] = new Option('".$interface['ifDescr']." - ".$interface['ifAlias']."','".$interface['interface_id']."');\n");
}
}

View File

@ -6,17 +6,13 @@ session_start();
// Preflight checks
if(!is_dir($config['rrd_dir']))
echo "<div class='errorbox'>RRD Log Directory is missing ({$config['rrd_dir']}). Graphing may fail.</div>";
### RRD dir probably shouldn't be writable by apache :>
#if(!$config['rrdcached'] && !is_writable($config['rrd_dir']))
# echo "<div class='errorbox'>RRD Log Directory is not writable ({$config['rrd_dir']}). Graphing may fail.</div>";
echo("<div class='errorbox'>RRD Log Directory is missing ({$config['rrd_dir']}). Graphing may fail.</div>");
if(!is_dir($config['temp_dir']))
echo "<div class='errorbox'>Temp Directory is missing ({$config['tmp_dir']}). Graphing may fail.</div>";
echo("<div class='errorbox'>Temp Directory is missing ({$config['tmp_dir']}). Graphing may fail.</div>");
if(!is_writable($config['temp_dir']))
echo "<div class='errorbox'>Temp Directory is not writable ({$config['tmp_dir']}). Graphing may fail.</div>";
echo("<div class='errorbox'>Temp Directory is not writable ({$config['tmp_dir']}). Graphing may fail.</div>");
if(isset($_GET['logout']) && $_SESSION['authenticated']) {
mysql_query("INSERT INTO authlog (`user`,`address`,`result`) VALUES ('" . $_SESSION['username'] . "', '".$_SERVER["REMOTE_ADDR"]."', 'logged out')");
@ -50,7 +46,7 @@ if (file_exists('includes/authentication/' . $config['auth_mechanism'] . '.inc.p
}
else
{
echo "<div class='errorbox'>ERROR: no valid auth_mechanism defined</div>";
echo("<div class='errorbox'>ERROR: no valid auth_mechanism defined</div>");
exit();
}

View File

@ -27,7 +27,7 @@ function authenticate($username,$password)
}
else
{
echo ldap_error($ds);
echo(ldap_error($ds));
}
}
else

View File

@ -93,7 +93,7 @@ function generate_graph_popup($graph_array)
function print_graph_popup($graph_array)
{
echo (generate_graph_popup($graph_array));
echo(generate_graph_popup($graph_array));
}
@ -185,7 +185,7 @@ function device_permitted($device_id)
function print_graph_tag ($args)
{
echo generate_graph_tag ($args);
echo(generate_graph_tag ($args));
}
function generate_graph_tag ($args)
@ -260,7 +260,7 @@ function generate_port_thumbnail($args)
if(!$args['bg']) { $args['bg'] = "FFFFF"; }
$args['content'] = "<img src='graph.php?type=".$args['graph_type']."&id=".$args['interface_id']."&from=".$args['from']."&to=".$args['to']."&width=".$args['width']."&height=".$args['height']."&legend=no&bg=".$args['bg']."'>";
$output = generate_port_link($args, $args['content']);
echo $output;
echo($output);
}
function print_optionbar_start ($height = 20, $width = 0, $marginbottom = 5)

View File

@ -2,7 +2,7 @@
$iftype = fixiftype($interface[ifType]);
echo ("<p class=interface-header>$inf</p>");
echo("<p class=interface-header>$inf</p>");
if($ifalias && $ifalias != "") { echo("<span class=box-desc>$ifalias</span><br />"); }
if($iftype && $iftype != "") { echo("<span class=box-desc>$iftype</span> ");
if($mac && $mac != "") { echo("<span class=box-desc>$mac</span><br />");
@ -17,6 +17,6 @@
echo("</span>");
}
echo ("<span class=box-desc><b>$status</b></span>");
echo("<span class=box-desc><b>$status</b></span>");
?>

View File

@ -54,12 +54,12 @@ if (isset($config['enable_bgp']) && $config['enable_bgp'])
foreach ($config['device_types'] as $devtype)
{
echo ' <li><a href="devices/' . $devtype['type'] . '/"><img src="images/icons/' . $devtype['icon'] . '" border="0" align="absmiddle" /> ' . $devtype['text'] . '</a></li>';
echo(' <li><a href="devices/' . $devtype['type'] . '/"><img src="images/icons/' . $devtype['icon'] . '" border="0" align="absmiddle" /> ' . $devtype['text'] . '</a></li>');
}
?>
<li><hr width="140" /></li>
<li><a href="devices/alerted/"><img src="images/16/server_error.png" border="0" align="absmiddle" /> Alerts (<?php echo $device_alerts ?>)</a></li>
<li><a href="devices/alerted/"><img src="images/16/server_error.png" border="0" align="absmiddle" /> Alerts (<?php echo($device_alerts) ?>)</a></li>
<?php
if ($_SESSION['userlevel'] >= '10') {
echo('
@ -118,7 +118,7 @@ if ($config['show_locations'])
{
if ($row['location'] != '')
{
echo ' <li><a href="?page=devices&location=' . urlencode($row['location']) . '"><img src="images/16/building.png" border="0" align="absmiddle" /> ' . $row['location'] . ' </a></li>';
echo(' <li><a href="?page=devices&location=' . urlencode($row['location']) . '"><img src="images/16/building.png" border="0" align="absmiddle" /> ' . $row['location'] . ' </a></li>');
}
}
?>
@ -277,7 +277,7 @@ echo(' <li><hr /></li>
<li><a href="?page=edituser"><img src="images/16/user_edit.png" border="0" align="absmiddle" /> Edit User</a></li>
<li><hr width="140" /></li>');
}
echo ('
echo('
<li><a href="authlog/"><img src="images/16/lock.png" border="0" align="absmiddle" /> Authlog</a></li>');
} ?>
</ul>

View File

@ -48,39 +48,39 @@ if($services['down']) { $services['bgcolour'] = "#ffcccc"; } else { $services['b
<table cellpadding="2" cellspacing="0" border="0">
<tr style="background-color: <?php echo $devices[bgcolour]; ?>">
<tr style="background-color: <?php echo($devices[bgcolour]); ?>">
<td width="5"></td>
<td>Devices : </td>
<td><?php echo $devices['count'] ?></td>
<td><?php echo($devices['count']) ?></td>
<td> ( </td>
<td style="text-align: right"><span class="green"> <?php echo $devices['up'] ?> up</span></td>
<td style="text-align: right"><span class="red"> <?php echo $devices['down'] ?> down</span></td>
<td style="text-align: right"><span class="black"> <?php echo $devices['ignored'] ?> ignored</span> </td>
<td style="text-align: right"><span class="grey"> <?php echo $devices['disabled'] ?> disabled</span></td>
<td style="text-align: right"><span class="green"> <?php echo($devices['up']) ?> up</span></td>
<td style="text-align: right"><span class="red"> <?php echo($devices['down']) ?> down</span></td>
<td style="text-align: right"><span class="black"> <?php echo($devices['ignored']) ?> ignored</span> </td>
<td style="text-align: right"><span class="grey"> <?php echo($devices['disabled']) ?> disabled</span></td>
<td> ) </td>
<td width="5"></td>
</tr>
<tr style="background-color: <?php echo $ports['bgcolour'] ?>">
<tr style="background-color: <?php echo($ports['bgcolour']) ?>">
<td width="5"></td><td>Ports : </td>
<td><?php echo $ports['count'] ?></td>
<td><?php echo($ports['count']) ?></td>
<td> ( </td>
<td style="text-align: right"><span class="green"> <?php echo $ports['up'] ?> up </span></td>
<td style="text-align: right"><span class="red"> <?php echo $ports['down'] ?> down </span></td>
<td style="text-align: right"><span class="black"> <?php echo $ports['ignored'] ?> ignored </span></td>
<td style="text-align: right"><span class="grey"> <?php echo $ports['shutdown'] ?> shutdown</span></td>
<td style="text-align: right"><span class="green"> <?php echo($ports['up']) ?> up </span></td>
<td style="text-align: right"><span class="red"> <?php echo($ports['down']) ?> down </span></td>
<td style="text-align: right"><span class="black"> <?php echo($ports['ignored']) ?> ignored </span></td>
<td style="text-align: right"><span class="grey"> <?php echo($ports['shutdown']) ?> shutdown</span></td>
<td> ) </td>
<td width="5"></td>
</tr>
<?php if ($config['show_services']) { ?>
<tr style="background-color: <?php echo $services['bgcolour'] ?>">
<tr style="background-color: <?php echo($services['bgcolour']) ?>">
<td width="5"></td>
<td>Services : </td>
<td><?php echo $services['count'] ?></td>
<td><?php echo($services['count']) ?></td>
<td> ( </td>
<td style="text-align: right"><span class="green"><?php echo $services['up'] ?> up</span></td>
<td style="text-align: right"><span class="red"> <?php echo $services['down'] ?> down</span></td>
<td style="text-align: right"><span class="black"> <?php echo $services['ignored'] ?> ignored</span> </td>
<td style="text-align: right"><span class="grey"> <?php echo $services['disabled'] ?> disabled</span></td>
<td style="text-align: right"><span class="green"><?php echo($services['up']) ?> up</span></td>
<td style="text-align: right"><span class="red"> <?php echo($services['down']) ?> down</span></td>
<td style="text-align: right"><span class="black"> <?php echo($services['ignored']) ?> ignored</span> </td>
<td style="text-align: right"><span class="grey"> <?php echo($services['disabled']) ?> disabled</span></td>
<td> ) </td>
<td width="5"></td>
</tr>

View File

@ -43,8 +43,6 @@ if(strpos($_SERVER['REQUEST_URI'], "debug")) {
eval("\$config['" . $confitem . "'] = \$confval;");
}
}
} else {
# echo "Please check config.php.default and adjust your settings to reflect the new Multi-Tenancy configuration.";
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
@ -113,24 +111,24 @@ function popUp(URL) {
$end = utime(); $run = $end - $start;
$gentime = substr($run, 0, 5);
echo '<br /> <br /> <br /> <br /> <div id="footer">' . (isset($config['footer']) ? $config['footer'] : '');
echo '<br />Powered by <a href="http://www.observium.org" target="_blank">Observium ' . $config['version'];
echo('<br /> <br /> <br /> <br /> <div id="footer">' . (isset($config['footer']) ? $config['footer'] : ''));
echo('<br />Powered by <a href="http://www.observium.org" target="_blank">Observium ' . $config['version']);
if (file_exists('.svn/entries'))
{
$svn = File('.svn/entries');
echo '-SVN r' . trim($svn[3]);
echo('-SVN r' . trim($svn[3]));
unset($svn);
}
echo '</a>. Copyright &copy; 2006-'. date("Y"). ' by Adam Armstrong. All rights reserved.';
echo('</a>. Copyright &copy; 2006-'. date("Y"). ' by Adam Armstrong. All rights reserved.');
if ($config['page_gen']) {
echo '<br />Generated in ' . $gentime . ' seconds.';
if ($config['page_gen'])
{
echo('<br />Generated in ' . $gentime . ' seconds.');
}
echo '</div>';
echo('</div>');
?>
</body>
</html>

View File

@ -164,10 +164,10 @@ else
{
if ($_SESSION['authenticated']) ## FIXME level 10 only?
{
echo '<center>
echo('<center>
<object data="'. $config['base_url'] . '/map.php?format=svg" type="image/svg+xml">
</object>
</center>';
</center>');
}
}
?>

View File

@ -1,6 +1,8 @@
<meta http-equiv="refresh" content="60">
<?php
# FIXME is this used anywhere??
if($_GET['del']) {
$id = mres($_GET['del']);
$query = "DELETE FROM `alerts` WHERE `id` = '$id'";
@ -37,7 +39,7 @@ case "0":
}
if(!$argh) {
echo ("
echo("
<tr style=\"background-color: $bg;\">
<td width=10></td>
<td class=syslog width=200>

View File

@ -7,8 +7,7 @@ if ($_SESSION['userlevel'] < '5')
else
{
echo("<div style='margin: 5px;'><table border=0 cellspacing=0 cellpadding=5 width=100%>");
echo '<tr style="height: 30px"><td width=1></td><th>Local address</th><th></th><th>Peer address</th><th>Type</th><th>Remote AS</th><th>State</th><th>Uptime</th></tr>';
echo('<tr style="height: 30px"><td width=1></td><th>Local address</th><th></th><th>Peer address</th><th>Type</th><th>Remote AS</th><th>State</th><th>Uptime</th></tr>');
$i = "1";

View File

@ -42,13 +42,13 @@ $bill_data_types = array ('cdr' => 'CDR with 95th', 'quota' => 'Monthly Quota');
$unknown = 1;
foreach ($bill_data_types as $type => $text)
{
echo ' <option value="'.$type.'"';
echo(' <option value="'.$type.'"');
if ($bill_data['bill_type'] == $type)
{
echo 'selected="1"';
echo('selected="1"');
$unknown = 0;
}
echo ' >' . ucfirst($text) . '</option>';
echo(' >' . ucfirst($text) . '</option>');
}
echo("
</select>

View File

@ -5,10 +5,8 @@ if($_SESSION['userlevel'] < 10) {
exit;
}
if($_POST['id']) {
echo delete_device(mres($_POST['id']));
} elseif ($_GET['id']) {
echo delete_device(mres($_GET['id']));
if($_REQUEST['id']) {
echo(delete_device(mres($_REQUEST['id'])));
}
?>

View File

@ -71,17 +71,17 @@ echo("<table cellpadding=0 cellspacing=0><tr><td>
$unknown = 1;
foreach ($device_types as $type)
{
echo ' <option value="'.$type.'"';
echo(' <option value="'.$type.'"');
if ($device['type'] == $type)
{
echo 'selected="1"';
echo('selected="1"');
$unknown = 0;
}
echo ' >' . ucfirst($type) . '</option>';
echo(' >' . ucfirst($type) . '</option>');
}
if ($unknown)
{
echo ' <option value="other">Other</option>';
echo(' <option value="other">Other</option>');
}
echo("
</select>

View File

@ -24,23 +24,23 @@ echo("<div style='float: left;'>
$query = mysql_query("SELECT * FROM `ports` WHERE device_id='".$device['device_id']."' ORDER BY `ifIndex` ");
while($device = mysql_fetch_array($query)) {
echo "<tr>";
echo "<td align=right>". $device['ifIndex']."</td>";
echo "<td align=left>".$device['ifDescr'] . "</td>";
echo "<td align=right>". $device['ifAdminStatus']."</td>";
echo("<tr>");
echo("<td align=right>". $device['ifIndex']."</td>");
echo("<td align=left>".$device['ifDescr'] . "</td>");
echo("<td align=right>". $device['ifAdminStatus']."</td>");
# Mark interfaces which are down yet not ignored, or up - yet ignored - as to draw the attention
# to a possible problem.
#
$outofsync = ($device['ignore'] == ($device['ifOperStatus'] == 'down' ? 1 : 0)) ? "" : "class=red";
echo "<td align=right><span ".$outofsync.">". $device['ifOperStatus']."</span></td>";
echo("<td align=right><span ".$outofsync.">". $device['ifOperStatus']."</span></td>");
echo "<td>";
echo "<input type=checkbox name='ignore_".$device['interface_id']."'".($device['ignore'] ? 'checked' : '').">";
echo "<input type=hidden name='oldval_".$device['interface_id']."' value=".($device['ignore'] ? 1 : 0).">";
echo "</td>";
echo "</tr>";
echo("<td>");
echo("<input type=checkbox name='ignore_".$device['interface_id']."'".($device['ignore'] ? 'checked' : '').">");
echo("<input type=hidden name='oldval_".$device['interface_id']."' value=".($device['ignore'] ? 1 : 0).">");
echo("</td>");
echo("</tr>");
}
echo('<tr><td></td><td></td><td></td><td></td><td><input type="submit" value="Save"></td></tr>');

View File

@ -52,14 +52,14 @@ echo("<div style='clear: both;'>");
print_optionbar_start();
echo ("<a href='".$config['base_url']."/device/" . $device['device_id'] . "/interface/".$interface['interface_id']."/'>Graphs</a> | ");
echo("<a href='".$config['base_url']."/device/" . $device['device_id'] . "/interface/".$interface['interface_id']."/'>Graphs</a> | ");
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `ports_adsl` WHERE `interface_id` = '".$interface['interface_id']."'"),0))
{
echo("<a href='".$config['base_url']."/device/".$device['device_id']."/interface/".$interface['interface_id']."/adsl/'>ADSL</a> | ");
}
echo ("<a href='".$config['base_url']."/device/" . $device['device_id'] . "/interface/".$interface['interface_id']."/arp/'>ARP Table</a>$pagp");
echo("<a href='".$config['base_url']."/device/" . $device['device_id'] . "/interface/".$interface['interface_id']."/arp/'>ARP Table</a>$pagp");

View File

@ -29,8 +29,7 @@ if($_SESSION['userlevel'] >= "7") {
$geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS);
$geshi->set_overall_style('color: black;');
#$geshi->set_line_style('color: #999999');
echo $geshi->parse_code();
echo($geshi->parse_code());
}
?>

View File

@ -5,7 +5,7 @@
<tr>
<td><img src="images/login-hamster.png" alt="Login required" /></td>
<td>
<form action="<?php echo $_SERVER['REQUEST_URI'] ?>" method="post" name="logonform">
<form action="<?php echo($_SERVER['REQUEST_URI']) ?>" method="post" name="logonform">
<h3>Please log in:</h3>
<div style="height: 0px;"></div>
<table border="0" align="left">

View File

@ -38,7 +38,7 @@
$old_mac = mysql_fetch_row(mysql_query("SELECT mac_address from ipv4_mac WHERE ipv4_address='$ip' AND interface_id = '".$interface['interface_id']."'"));
if($clean_mac != $old_mac[0])
{
if ($debug) { echo "Changed mac address for $ip from $old_mac[0] to $clean_mac\n"; }
if ($debug) { echo("Changed mac address for $ip from $old_mac[0] to $clean_mac\n"); }
log_event("MAC change: $ip : " . mac_clean_to_readable($old_mac[0]) . " -> " . mac_clean_to_readable($clean_mac), $device, "interface", $interface['interface_id']);
}
mysql_query($sql);

View File

@ -31,7 +31,7 @@ if ($config['enable_bgp'])
if($peer && $peer_ip != "0.0.0.0")
{
if ($debug) echo "Found peer $peer_ip (AS$peer_as)\n";
if ($debug) echo("Found peer $peer_ip (AS$peer_as)\n");
$peerlist[] = array('ip' => $peer_ip, 'as' => $peer_as);
}
} # Foreach
@ -51,7 +51,7 @@ if ($config['enable_bgp'])
if($peer)
{
if ($debug) echo "Found peer $peer_ip (AS$peer_as)\n";
if ($debug) echo("Found peer $peer_ip (AS$peer_as)\n");
$peerlist[] = array('ip' => $peer_ip, 'as' => $peer_as);
}
} # Foreach

View File

@ -40,7 +40,7 @@ if ($device['os'] == "apc")
{
$descr = "Output";
}
echo discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, NULL, $warnlimit, $limit, $current);
echo(discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, NULL, $warnlimit, $limit, $current));
}
}
@ -60,7 +60,7 @@ if ($device['os'] == "apc")
$warnlimit = snmp_get($device, $warnlimit_oid, "-Oqv", ""); # No / $precision here! Nice, APC!
$descr = "Output Feed";
echo discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, NULL, $warnlimit, $limit, $current);
echo(discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, NULL, $warnlimit, $limit, $current));
}
}

View File

@ -2,9 +2,10 @@
global $valid_sensor;
if ($device['os'] == "gamatronicups") {
for($i = 1; $i <= 3 ;$i++) {
if ($device['os'] == "gamatronicups")
{
for ($i = 1; $i <= 3; $i++)
{
$current_oid = "GAMATRONIC-MIB::gamatronicLTD.5.4.1.1.3.$i";
$descr = "Input Phase $i";
$current = snmp_get($device, $current_oid, "-Oqv");
@ -15,13 +16,11 @@ if ($device['os'] == "gamatronicups") {
$warnlimit = NULL;
$limit = NULL;
echo discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '1', '1', $lowlimit, NULL, NULL, NULL, $current);
echo(discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '1', '1', $lowlimit, NULL, NULL, NULL, $current));
}
for($i = 1; $i <= 3 ;$i++) {
for ($i = 1; $i <= 3; $i++)
{
$current_oid = "GAMATRONIC-MIB::gamatronicLTD.5.5.1.1.3.$i";
$descr = "Output Phase $i";
$current = snmp_get($device, $current_oid, "-Oqv");
@ -31,8 +30,8 @@ if ($device['os'] == "gamatronicups") {
$lowlimit = 0;
$warnlimit = NULL;
$limit = NULL;
echo discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '1', '1', $lowlimit, NULL, NULL, NULL, $current);
}
echo(discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '1', '1', $lowlimit, NULL, NULL, NULL, $current));
}
}
?>

View File

@ -40,7 +40,7 @@ if ($device['os'] == "ipoman")
$descr = (trim($ipoman_array['in'][$index]['inletConfigDesc'],'"') != '' ? trim($ipoman_array['in'][$index]['inletConfigDesc'],'"') : "Inlet $index");
$current = $entry['inletStatusCurrent'] / $divisor;
$high_limit = $entry['inletConfigCurrentHigh'];
echo discover_sensor($valid_sensor, 'current', $device, $cur_oid, '1.3.1.3.'.$index, 'ipoman', $descr, $divisor, '1', NULL, NULL, NULL, $high_limit, $current);
echo(discover_sensor($valid_sensor, 'current', $device, $cur_oid, '1.3.1.3.'.$index, 'ipoman', $descr, $divisor, '1', NULL, NULL, NULL, $high_limit, $current));
# FIXME: iPoMan 1201 also says it has 2 inlets, at least until firmware 1.06 - wtf?
}
}
@ -54,7 +54,7 @@ if ($device['os'] == "ipoman")
$descr = (trim($ipoman_array['out'][$index]['outletConfigDesc'],'"') != '' ? trim($ipoman_array['out'][$index]['outletConfigDesc'],'"') : "Output $index");
$current = $entry['outletStatusCurrent'] / $divisor;
$high_limit = $entry['outletConfigCurrentHigh'];
echo discover_sensor($valid_sensor, 'current', $device, $cur_oid, '2.3.1.3.'.$index, $type, $descr, $divisor, '1', NULL, NULL, NULL, $high_limit, $current);
echo(discover_sensor($valid_sensor, 'current', $device, $cur_oid, '2.3.1.3.'.$index, $type, $descr, $divisor, '1', NULL, NULL, NULL, $high_limit, $current));
}
}
}

View File

@ -28,7 +28,7 @@ if ($device['os'] == "mgeups")
$lowlimit = 0;
$limit = NULL;
$lowwarnlimit = NULL;
echo discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, $lowwarnlimit, $warnlimit, $limit, $current);
echo(discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, $lowwarnlimit, $warnlimit, $limit, $current));
}
$oids = trim(snmp_walk($device, "1.3.6.1.4.1.705.1.6.1", "-OsqnU"));
@ -53,7 +53,7 @@ if ($device['os'] == "mgeups")
$lowlimit = 0;
$limit = NULL;
$lowwarnlimit = NULL;
echo discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, $lowwarnlimit, $warnlimit, $limit, $current);
echo(discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, $lowwarnlimit, $warnlimit, $limit, $current));
}
}
?>

View File

@ -24,7 +24,7 @@ if ($device['os'] == "netmanplus" || $device['os'] == "deltaups")
$descr = "Battery" . (count(explode("\n",$oids)) == 1 ? '' : ' ' . ($current_id+1));
$type = "rfc1628";
$index = 500+$current_id;
echo discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '10', '1', NULL, NULL, NULL, NULL, $current);
echo(discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '10', '1', NULL, NULL, NULL, NULL, $current));
}
}
@ -39,7 +39,7 @@ if ($device['os'] == "netmanplus" || $device['os'] == "deltaups")
$type = "rfc1628";
$precision = 1;
$index = $i;
echo discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '1', '1', NULL, NULL, NULL, NULL, $current);
echo(discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '1', '1', NULL, NULL, NULL, NULL, $current));
}
$oids = trim(snmp_walk($device, "1.3.6.1.2.1.33.1.3.2.0", "-OsqnU"));
@ -53,7 +53,7 @@ if ($device['os'] == "netmanplus" || $device['os'] == "deltaups")
$type = "rfc1628";
$precision = 1;
$index = 100+$i;
echo discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '1', '1', NULL, NULL, NULL, NULL, $current);
echo(discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '1', '1', NULL, NULL, NULL, NULL, $current));
}
$oids = trim(snmp_walk($device, "1.3.6.1.2.1.33.1.5.2.0", "-OsqnU"));
@ -67,7 +67,7 @@ if ($device['os'] == "netmanplus" || $device['os'] == "deltaups")
$type = "rfc1628";
$precision = 1;
$index = 200+$i;
echo discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '1', '1', NULL, NULL, NULL, NULL, $current);
echo(discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '1', '1', NULL, NULL, NULL, NULL, $current));
}
}

View File

@ -24,7 +24,7 @@ if ($device['os'] == "powerware")
$descr = "Battery" . (count(explode("\n",$oids)) == 1 ? '' : ' ' . ($current_id+1));
$type = "xups";
$index = "1.2.3.".$current_id;
echo discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
echo(discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current));
}
}
@ -39,7 +39,7 @@ if ($device['os'] == "powerware")
$type = "xups";
$divisor = 1;
$index = "4.4.1.3.".$i;
echo discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
echo(discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current));
}
$oids = trim(snmp_walk($device, "xupsInputCurrent", "-OsqnU", "XUPS-MIB"));
@ -53,7 +53,7 @@ if ($device['os'] == "powerware")
$type = "xups";
$divisor = 1;
$index = "3.4.1.3.".$i;
echo discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
echo(discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current));
}
}

View File

@ -1,6 +1,6 @@
<?php
echo "Discovery protocols:";
echo("Discovery protocols:");
$community = $device['community'];

View File

@ -36,7 +36,7 @@ if ($device['os'] == "ipoman")
$current = $entry['inletStatusFrequency'] / 10;
$low_limit = $entry['inletConfigFrequencyLow'];
$high_limit = $entry['inletConfigFrequencyHigh'];
echo discover_sensor($valid_sensor, 'freq', $device, $freq_oid, $index, 'ipoman', $descr, $divisor, '1', $low_limit, NULL, NULL, $high_limit, $current);
echo(discover_sensor($valid_sensor, 'freq', $device, $freq_oid, $index, 'ipoman', $descr, $divisor, '1', $low_limit, NULL, NULL, $high_limit, $current));
# FIXME: iPoMan 1201 also says it has 2 inlets, at least until firmware 1.06 - wtf?
}
}

View File

@ -23,7 +23,7 @@ if ($device['os'] == "mgeups")
$type = "mge-ups";
$divisor = 10;
$index = $i;
echo discover_sensor($valid_sensor, 'freq', $device, $freq_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
echo(discover_sensor($valid_sensor, 'freq', $device, $freq_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current));
}
$oids = trim(snmp_walk($device, "1.3.6.1.4.1.705.1.6.1", "-OsqnU"));
if ($debug) { echo($oids."\n"); }
@ -42,7 +42,7 @@ if ($device['os'] == "mgeups")
$type = "mge-ups";
$divisor = 10;
$index = 100+$i;
echo discover_sensor($valid_sensor, 'freq', $device, $freq_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
echo(discover_sensor($valid_sensor, 'freq', $device, $freq_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current));
}
}
?>

View File

@ -18,7 +18,7 @@ if ($device['os'] == "netmanplus" || $device['os'] == "deltaups")
$type = "rfc1628";
$divisor = 10;
$index = '3.2.0.'.$i;
echo discover_sensor($valid_sensor, 'freq', $device, $freq_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
echo(discover_sensor($valid_sensor, 'freq', $device, $freq_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current));
}
$freq_oid = "1.3.6.1.2.1.33.1.4.2.0";
@ -27,7 +27,7 @@ if ($device['os'] == "netmanplus" || $device['os'] == "deltaups")
$type = "rfc1628";
$divisor = 10;
$index = '4.2.0';
echo discover_sensor($valid_sensor, 'freq', $device, $freq_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
echo(discover_sensor($valid_sensor, 'freq', $device, $freq_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current));
$freq_oid = "1.3.6.1.2.1.33.1.5.1.0";
$descr = "Bypass";
@ -35,6 +35,6 @@ if ($device['os'] == "netmanplus" || $device['os'] == "deltaups")
$type = "rfc1628";
$divisor = 10;
$index = '5.1.0';
echo discover_sensor($valid_sensor, 'freq', $device, $freq_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
echo(discover_sensor($valid_sensor, 'freq', $device, $freq_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current));
}
?>

View File

@ -16,7 +16,7 @@ if ($device['os'] == "powerware")
$current = snmp_get($device, $freq_oid, "-Oqv") / $divisor;
$type = "xups";
$index = '3.1.0';
echo discover_sensor($valid_sensor, 'freq', $device, $freq_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
echo(discover_sensor($valid_sensor, 'freq', $device, $freq_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current));
# XUPS-MIB::xupsOutputFrequency.0 = INTEGER: 500
$freq_oid = "1.3.6.1.4.1.534.1.4.2.0";
@ -25,7 +25,7 @@ if ($device['os'] == "powerware")
$current = snmp_get($device, $freq_oid, "-Oqv") / $divisor;
$type = "xups";
$index = '4.2.0';
echo discover_sensor($valid_sensor, 'freq', $device, $freq_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
echo(discover_sensor($valid_sensor, 'freq', $device, $freq_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current));
# XUPS-MIB::xupsBypassFrequency.0 = INTEGER: 500
$freq_oid = "1.3.6.1.4.1.534.1.5.1.0";
@ -38,7 +38,7 @@ if ($device['os'] == "powerware")
$current /= $divisor;
$type = "xups";
$index = '5.1.0';
echo discover_sensor($valid_sensor, 'freq', $device, $freq_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
echo(discover_sensor($valid_sensor, 'freq', $device, $freq_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current));
}
}
?>

View File

@ -32,7 +32,7 @@ if ($config['enable_printers'])
$current = $current / $capacity * 100;
$type = "jetdirect";
if (isHexString($descr)) { $descr = snmp_hexstring($descr); }
echo discover_toner($valid_toner,$device, $toner_oid, $index, $type, $descr, $capacity, $current);
echo(discover_toner($valid_toner,$device, $toner_oid, $index, $type, $descr, $capacity, $current));
}
}
}

View File

@ -20,7 +20,7 @@ if ($device['os'] == "apc")
$index = $split_oid[count($split_oid)-3];
$oid = "1.3.6.1.4.1.318.1.1.8.5.3.3.1.3." . $index . ".1.1";
$descr = "Input Feed " . chr(64+$index);
echo discover_sensor($valid_sensor, 'voltage', $device, $oid, "3.3.1.3.$index", $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
echo(discover_sensor($valid_sensor, 'voltage', $device, $oid, "3.3.1.3.$index", $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current));
}
}
@ -40,7 +40,7 @@ if ($device['os'] == "apc")
$index = $split_oid[count($split_oid)-3];
$oid = "1.3.6.1.4.1.318.1.1.8.5.4.3.1.3." . $index . ".1.1";
$descr = "Output Feed"; if (count(explode("\n", $oids)) > 1) { $descr .= " $index"; }
echo discover_sensor($valid_sensor, 'voltage', $device, $oid, "4.3.1.3.$index", $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
echo(discover_sensor($valid_sensor, 'voltage', $device, $oid, "4.3.1.3.$index", $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current));
}
}
@ -54,7 +54,7 @@ if ($device['os'] == "apc")
$type = "apc";
$index = "3.2.1.0";
$descr = "Input";
echo discover_sensor($valid_sensor, 'voltage', $device, $oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
echo(discover_sensor($valid_sensor, 'voltage', $device, $oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current));
}
$oids = snmp_get($device, "1.3.6.1.4.1.318.1.1.1.4.2.1.0", "-OsqnU", "");
@ -67,7 +67,7 @@ if ($device['os'] == "apc")
$type = "apc";
$index = "4.2.1.0";
$descr = "Output";
echo discover_sensor($valid_sensor, 'voltage', $device, $oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
echo(discover_sensor($valid_sensor, 'voltage', $device, $oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current));
}
}
?>

View File

@ -22,7 +22,7 @@ if ($device['os'] == "areca")
$current = snmp_get($device, $oid, "-Oqv", "") / $divisor;
if ($descr != '"Battery Status"' || $current != 0.255) # FIXME not sure if this is supposed to be a voltage, but without BBU it's 225, then ignore.
{
echo discover_sensor($valid_sensor, 'voltage', $device, $oid, $index, $type, trim($descr,'"'), $divisor, '1', NULL, NULL, NULL, NULL, $current);
echo(discover_sensor($valid_sensor, 'voltage', $device, $oid, $index, $type, trim($descr,'"'), $divisor, '1', NULL, NULL, NULL, NULL, $current));
}
}
}

View File

@ -14,7 +14,7 @@ if ($device['os'] == "gamatronicups")
$index = $i;
$lowlimit = 0;
$limit = NULL;
echo discover_sensor($valid_sensor, 'voltage', $device, $volt_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $volt);
echo(discover_sensor($valid_sensor, 'voltage', $device, $volt_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $volt));
}
for($i = 1; $i <= 3 ;$i++)
@ -27,7 +27,7 @@ if ($device['os'] == "gamatronicups")
$index = 100+$i;
$lowlimit = 0;
$limit = NULL;
echo discover_sensor($valid_sensor, 'voltage', $device, $volt_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $volt);
echo(discover_sensor($valid_sensor, 'voltage', $device, $volt_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $volt));
}
}

View File

@ -36,7 +36,7 @@ if ($device['os'] == "ipoman")
$current = $entry['inletStatusVoltage'] / 10;
$low_limit = $entry['inletConfigVoltageLow'];
$high_limit = $entry['inletConfigVoltageHigh'];
echo discover_sensor($valid_sensor, 'voltage', $device, $volt_oid, $index, 'ipoman', $descr, $divisor, '1', $low_limit, NULL, NULL, $high_limit, $current);
echo(discover_sensor($valid_sensor, 'voltage', $device, $volt_oid, $index, 'ipoman', $descr, $divisor, '1', $low_limit, NULL, NULL, $high_limit, $current));
# FIXME: iPoMan 1201 also says it has 2 inlets, at least until firmware 1.06 - wtf?
}
}

View File

@ -20,7 +20,7 @@ if ($device['os'] == "linux")
$index = $split_oid[count($split_oid)-1];
$oid = "1.3.6.1.4.1.2021.13.16.4.1.3." . $index;
$current = snmp_get($device, $oid, "-Oqv", "LM-SENSORS-MIB") / $divisor;
echo discover_sensor($valid_sensor, 'voltage', $device, $oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
echo(discover_sensor($valid_sensor, 'voltage', $device, $oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current));
}
}
}

View File

@ -23,8 +23,9 @@ if ($device['os'] == "mgeups")
$type = "mge-ups";
$divisor = 10;
$index = $i;
echo discover_sensor($valid_sensor, 'voltage', $device, $volt_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
echo(discover_sensor($valid_sensor, 'voltage', $device, $volt_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current));
}
$oids = trim(snmp_walk($device, "mgeinputVoltage", "-OsqnU", "MG-SNMP-UPS-MIB"));
if ($debug) { echo($oids."\n"); }
$numPhase = count(explode("\n",$oids));
@ -42,7 +43,7 @@ if ($device['os'] == "mgeups")
$type = "mge-ups";
$divisor = 10;
$index = 100+$i;
echo discover_sensor($valid_sensor, 'voltage', $device, $volt_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
echo(discover_sensor($valid_sensor, 'voltage', $device, $volt_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current));
}
}
?>

View File

@ -25,7 +25,7 @@ if ($device['os'] == "netmanplus" || $device['os'] == "deltaups")
$descr = "Battery" . (count(explode("\n",$oids)) == 1 ? '' : ' ' . ($volt_id+1));
$type = "rfc1628";
$index = "1.2.5.".$volt_id;
echo discover_sensor($valid_sensor, 'voltage', $device, $volt_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $volt);
echo(discover_sensor($valid_sensor, 'voltage', $device, $volt_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $volt));
}
}
@ -40,7 +40,7 @@ if ($device['os'] == "netmanplus" || $device['os'] == "deltaups")
$divisor = 10; if ($device['os'] == "netmanplus") { $divisor = 1; };
$current = snmp_get($device, $volt_oid, "-Oqv") / $divisor;
$index = $i;
echo discover_sensor($valid_sensor, 'voltage', $device, $volt_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
echo(discover_sensor($valid_sensor, 'voltage', $device, $volt_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current));
}
$oids = trim(snmp_walk($device, "1.3.6.1.2.1.33.1.3.2.0", "-OsqnU"));
@ -54,7 +54,7 @@ if ($device['os'] == "netmanplus" || $device['os'] == "deltaups")
$divisor = 10; if ($device['os'] == "netmanplus") { $divisor = 1; };
$current = snmp_get($device, $volt_oid, "-Oqv") / $divisor;
$index = 100+$i;
echo discover_sensor($valid_sensor, 'voltage', $device, $volt_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
echo(discover_sensor($valid_sensor, 'voltage', $device, $volt_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current));
}
$oids = trim(snmp_walk($device, "1.3.6.1.2.1.33.1.5.2.0", "-OsqnU"));
@ -68,7 +68,7 @@ if ($device['os'] == "netmanplus" || $device['os'] == "deltaups")
$divisor = 10; if ($device['os'] == "netmanplus") { $divisor = 1; };
$current = snmp_get($device, $volt_oid, "-Oqv") / $divisor;
$index = 200+$i;
echo discover_sensor($valid_sensor, 'voltage', $device, $volt_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
echo(discover_sensor($valid_sensor, 'voltage', $device, $volt_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current));
}
}
?>

View File

@ -36,7 +36,7 @@ if ($device['os'] == "linux")
if ($monitor == 'true')
{
echo discover_sensor($valid_sensor, 'voltage', $device, $volt_oid, $index, $type, $descr, $divisor, '1', $lowlimit, NULL, NULL, $limit, $current);
echo(discover_sensor($valid_sensor, 'voltage', $device, $volt_oid, $index, $type, $descr, $divisor, '1', $lowlimit, NULL, NULL, $limit, $current));
}
}
}

View File

@ -25,7 +25,7 @@ if ($device['os'] == "powerware")
$descr = "Battery" . (count(explode("\n",$oids)) == 1 ? '' : ' ' . ($volt_id+1));
$type = "xups";
$index = '1.2.5.'.$volt_id;
echo discover_sensor($valid_sensor, 'voltage', $device, $volt_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $volt);
echo(discover_sensor($valid_sensor, 'voltage', $device, $volt_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $volt));
}
}
@ -42,7 +42,7 @@ if ($device['os'] == "powerware")
$divisor = 1;
$current = snmp_get($device, $volt_oid, "-Oqv") / $divisor;
$index = '3.4.1.2.'.$i;
echo discover_sensor($valid_sensor, 'voltage', $device, $volt_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
echo(discover_sensor($valid_sensor, 'voltage', $device, $volt_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current));
}
# XUPS-MIB::xupsOutputNumPhases.0 = INTEGER: 1
@ -58,7 +58,7 @@ if ($device['os'] == "powerware")
$divisor = 1;
$current = snmp_get($device, $volt_oid, "-Oqv") / $divisor;
$index = '4.4.1.2.'.$i;
echo discover_sensor($valid_sensor, 'voltage', $device, $volt_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
echo(discover_sensor($valid_sensor, 'voltage', $device, $volt_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current));
}
# XUPS-MIB::xupsBypassNumPhases.0 = INTEGER: 1
@ -73,7 +73,7 @@ if ($device['os'] == "powerware")
$divisor = 1;
$current = snmp_get($device, $volt_oid, "-Oqv") / $divisor;
$index = '5.3.1.2.'.$i;
echo discover_sensor($valid_sensor, 'voltage', $device, $volt_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
echo(discover_sensor($valid_sensor, 'voltage', $device, $volt_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current));
}
}
?>

View File

@ -10,7 +10,6 @@ include_once("Net/IPv6.php");
include_once($config['install_dir'] . "/includes/common.php");
include_once($config['install_dir'] . "/includes/rrdtool.inc.php");
include_once($config['install_dir'] . "/includes/generic.php");
include_once($config['install_dir'] . "/includes/procurve.php");
include_once($config['install_dir'] . "/includes/print-functions.php");
include_once($config['install_dir'] . "/includes/billing.php");
include_once($config['install_dir'] . "/includes/cisco-entities.php");

View File

@ -8,7 +8,7 @@ $mysql_cmd .= " nsExtendOutputFull.5.109.121.115.113.108";
$mysql = shell_exec($mysql_cmd);
echo " mysql...";
echo(" mysql...");
$data = explode("\n", $mysql);
@ -110,5 +110,5 @@ if (!is_file($mysql_rrd)) {
}
rrdtool_update($mysql_rrd, "N:$nstring");
echo "done ";
echo("done ");
?>

View File

@ -8,7 +8,7 @@ $nginx_cmd .= " nsExtendOutputFull.5.110.103.105.110.120";
$nginx = shell_exec($nginx_cmd);
echo " nginx statistics\n";
echo(" nginx statistics\n");
list($active, $reading, $writing, $waiting, $req) = explode("\n", $nginx);
if (!is_file($nginx_rrd)) {

View File

@ -15,7 +15,7 @@ while($peer = mysql_fetch_array($peers)) {
if (!strstr($peer['bgpPeerIdentifier'],':'))
{
# v4 BGP4 MIB
## FIX ME - needs moved to function
## FIXME - needs moved to function
$peer_cmd = $config['snmpget'] . " -M ".$config['mibdir'] . " -m BGP4-MIB -OUvq -" . $device['snmpver'] . " -c" . $device['community'] . " " . $device['hostname'].":".$device['port'] . " ";
$peer_cmd .= "bgpPeerState." . $peer['bgpPeerIdentifier'] . " bgpPeerAdminStatus." . $peer['bgpPeerIdentifier'] . " bgpPeerInUpdates." . $peer['bgpPeerIdentifier'] . " bgpPeerOutUpdates." . $peer['bgpPeerIdentifier'] . " bgpPeerInTotalMessages." . $peer['bgpPeerIdentifier'] . " ";
$peer_cmd .= "bgpPeerOutTotalMessages." . $peer['bgpPeerIdentifier'] . " bgpPeerFsmEstablishedTime." . $peer['bgpPeerIdentifier'] . " bgpPeerInUpdateElapsedTime." . $peer['bgpPeerIdentifier'] . " ";
@ -31,8 +31,8 @@ if ($device['os'] == "junos")
if (!isset($junos_v6))
{
echo "\nCaching Oids...";
## FIX ME - needs moved to function
echo("\nCaching Oids...");
## FIXME - needs moved to function
$peer_cmd = $config['snmpwalk'] . " -M ".$config['mibdir'] . "/junos -m BGP4-V2-MIB-JUNIPER -OUnq -" . $device['snmpver'] . " -c" . $device['community'] . " " . $device['hostname'].":".$device['port'];
$peer_cmd .= " jnxBgpM2PeerStatus.0.ipv6";
foreach (explode("\n",trim(`$peer_cmd`)) as $oid)
@ -42,7 +42,7 @@ if ($device['os'] == "junos")
$junos_v6[implode('.',array_slice($peer_id,35))] = implode('.',array_slice($peer_id,18));
}
}
## FIX ME - move to function (and clean up, wtf?)
## FIXME - move to function (and clean up, wtf?)
$peer_cmd = $config['snmpget'] . " -M ".$config['mibdir'] . "/junos -m BGP4-V2-MIB-JUNIPER -OUvq -" . $device['snmpver'] . " -c" . $device['community'] . " " . $device['hostname'].":".$device['port'];
$peer_cmd .= " jnxBgpM2PeerState.0.ipv6." . $junos_v6[$peer_ip];
$peer_cmd .= " jnxBgpM2PeerStatus.0.ipv6." . $junos_v6[$peer_ip]; # Should be jnxBgpM2CfgPeerAdminStatus but doesn't seem to be implemented?
@ -54,11 +54,11 @@ if ($device['os'] == "junos")
$peer_cmd .= " jnxBgpM2PeerInUpdatesElapsedTime.0.ipv6." . $junos_v6[$peer_ip];
$peer_cmd .= " jnxBgpM2PeerLocalAddr.0.ipv6." . $junos_v6[$peer_ip];
$peer_cmd .= ' -M"' . $config['install_dir'] . '/mibs/junos"|grep -v "No Such Instance"';
if ($debug) echo "\n$peer_cmd\n";
if ($debug) echo("\n$peer_cmd\n");
$peer_data = trim(`$peer_cmd`);
list($bgpPeerState, $bgpPeerAdminStatus, $bgpPeerInUpdates, $bgpPeerOutUpdates, $bgpPeerInTotalMessages, $bgpPeerOutTotalMessages, $bgpPeerFsmEstablishedTime, $bgpPeerInUpdateElapsedTime, $bgpLocalAddr) = explode("\n", $peer_data);
if ($debug) { echo "State = $bgpPeerState - AdminStatus: $bgpPeerAdminStatus\n"; }
if ($debug) { echo("State = $bgpPeerState - AdminStatus: $bgpPeerAdminStatus\n"); }
$bgpLocalAddr = str_replace('"','',str_replace(' ','',$bgpLocalAddr));
if ($bgpLocalAddr == "00000000000000000000000000000000")
@ -131,7 +131,7 @@ if ($device['os'] == "junos")
$afi = $peer_afi['afi'];
$safi = $peer_afi['safi'];
if($debug) { echo("$afi $safi". $config['afi'][$afi][$safi]. "\n"); }
## FIX ME - move to function
## FIXME - move to function
$cbgp_cmd = $config['snmpget'] . " -M ".$config['mibdir'] . " -m CISCO-BGP4-MIB -Ovq -" . $device['snmpver'] . " -c" . $device['community'] . " " . $device['hostname'].":".$device['port'];
$cbgp_cmd .= " cbgpPeerAcceptedPrefixes." . $peer['bgpPeerIdentifier'] . ".$afi.$safi";
$cbgp_cmd .= " cbgpPeerDeniedPrefixes." . $peer['bgpPeerIdentifier'] . ".$afi.$safi";

View File

@ -28,12 +28,11 @@ while($fanspeed = mysql_fetch_array($fan_data)) {
rrdtool_update($fanrrd,"N:$fan");
if($fanspeed['sensor_current'] > $fanspeed['sensor_limit'] && $fan <= $fanspeed['sensor_limit']) {
if($device['sysContact']) { $email = $device['sysContact']; } else { $email = $config['email_default']; }
$msg = "Fan Alarm: " . $device['hostname'] . " " . $fanspeed['sensor_descr'] . " is " . $fan . "rpm (Limit " . $fanspeed['sensor_limit'];
$msg .= "rpm) at " . date($config['timestamp_format']);
notify($device, "Fan Alarm: " . $device['hostname'] . " " . $fanspeed['sensor_descr'], $msg);
echo("Alerting for " . $device['hostname'] . " " . $fanspeed['sensor_descr'] . "\n");
log_event('Fan speed ' . $fanspeed['sensor_descr'] . " under threshold: " . $fanspeed['sensor_current'] . " rpm (&gt; " . $fanspeed['sensor_limit'] . " rpm)", $device['device_id'], 'fanspeed', $fanspeed['sensor_id']);
log_event('Fan speed ' . $fanspeed['sensor_descr'] . " under threshold: " . $fanspeed['sensor_current'] . " rpm (> " . $fanspeed['sensor_limit'] . " rpm)", $device['device_id'], 'fanspeed', $fanspeed['sensor_id']);
}
mysql_query("UPDATE sensors SET sensor_current = '$fan' WHERE sensor_class='fanspeed' AND sensor_id = '" . $fanspeed['sensor_id'] . "'");

View File

@ -29,7 +29,6 @@ while($sensor = mysql_fetch_array($sensor_data)) {
if($sensor['sensor_current'] > $sensor['sensor_limit_low'] && $freq <= $sensor['sensor_limit_low'])
{
if($device['sysContact']) { $email = $device['sysContact']; } else { $email = $config['email_default']; }
$msg = "Frequency Alarm: " . $device['hostname'] . " " . $sensor['sensor_descr'] . " is " . $freq . "Hz (Limit " . $sensor['sensor_limit'];
$msg .= "Hz) at " . date($config['timestamp_format']);
notify($device, "Frequency Alarm: " . $device['hostname'] . " " . $sensor['sensor_descr'], $msg);
@ -38,7 +37,6 @@ while($sensor = mysql_fetch_array($sensor_data)) {
}
else if($sensor['sensor_current'] < $sensor['sensor_limit'] && $freq >= $sensor['sensor_limit'])
{
if($device['sysContact']) { $email = $device['sysContact']; } else { $email = $config['email_default']; }
$msg = "Frequency Alarm: " . $device['hostname'] . " " . $sensor['sensor_descr'] . " is " . $freq . "Hz (Limit " . $sensor['sensor_limit'];
$msg .= "Hz) at " . date($config['timestamp_format']);
notify($device, "Frequency Alarm: " . $device['hostname'] . " " . $sensor['sensor_descr'], $msg);

View File

@ -32,7 +32,6 @@ while($humidity = mysql_fetch_array($hum_data)) {
if($humidity['sensor_current'] > $humidity['sensor_limit_low'] && $hum <= $humidity['sensor_limit_low'])
{
if($device['sysContact']) { $email = $device['sysContact']; } else { $email = $config['email_default']; }
$msg = "Humidity Alarm: " . $device['hostname'] . " " . $humidity['sensor_descr'] . " is " . $hum . "% (Limit " . $humidity['sensor_limit'];
$msg .= "%) at " . date($config['timestamp_format']);
notify($device, "Humidity Alarm: " . $device['hostname'] . " " . $humidity['sensor_descr'], $msg);
@ -41,7 +40,6 @@ while($humidity = mysql_fetch_array($hum_data)) {
}
else if($humidity['sensor_current'] < $humidity['sensor_limit'] && $hum >= $humidity['sensor_limit'])
{
if($device['sysContact']) { $email = $device['sysContact']; } else { $email = $config['email_default']; }
$msg = "Humidity Alarm: " . $device['hostname'] . " " . $humidity['sensor_descr'] . " is " . $hum . "% (Limit " . $humidity['sensor_limit'];
$msg .= "%) at " . date($config['timestamp_format']);
notify($device, "Humidity Alarm: " . $device['hostname'] . " " . $humidity['sensor_descr'], $msg);

View File

@ -40,7 +40,7 @@ if (is_numeric($cpu_usage))
RRA:MIN:0.5:24:2000 \
RRA:MIN:0.5:288:2000");
}
echo "CPU: $cpu_usage%\n";
echo("CPU: $cpu_usage%\n");
rrdtool_update($cpurrd, " N:$cpu_usage");
}

View File

@ -8,7 +8,7 @@ while($temperature = mysql_fetch_array($temp_data)) {
for ($i = 0;$i < 5;$i++) # Try 5 times to get a valid temp reading
{
if ($debug) echo "Attempt $i ";
if ($debug) echo("Attempt $i ");
$temp_cmd = $config['snmpget'] . " -M ".$config['mibdir'] . " -m SNMPv2-MIB -O Uqnv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " " . $temperature['sensor_oid'] . "|grep -v \"No Such Instance\"";
$temp = trim(str_replace("\"", "", shell_exec($temp_cmd)));
@ -46,13 +46,13 @@ while($temperature = mysql_fetch_array($temp_data)) {
rrdtool_update($rrd_file,"N:$temp");
if($temperature['sensor_current'] < $temperature['sensor_limit'] && $temp >= $temperature['sensor_limit']) {
if($device['sysContact']) { $email = $device['sysContact']; } else { $email = $config['email_default']; }
if($temperature['sensor_current'] < $temperature['sensor_limit'] && $temp >= $temperature['sensor_limit'])
{
$msg = "Temp Alarm: " . $device['hostname'] . " " . $temperature['sensor_descr'] . " is " . $temp . " (Limit " . $temperature['sensor_limit'];
$msg .= ") at " . date($config['timestamp_format']);
notify($device, "Temp Alarm: " . $device['hostname'] . " " . $temperature['sensor_descr'], $msg);
echo("Alerting for " . $device['hostname'] . " " . $temperature['sensor_descr'] . "\n");
log_event('Temperature ' . $temperature['sensor_descr'] . " over threshold: " . $temp . " <EFBFBD>C (> " . $temperature['sensor_limit'] . " <EFBFBD>C)", $device['device_id'], 'temperature', $temperature['sensor_id']);
log_event('Temperature ' . $temperature['sensor_descr'] . " over threshold: " . $temp . " " . html_entity_decode('&deg;') . "C (> " . $temperature['sensor_limit'] . " " . html_entity_decode('&deg;') . 'C)', $device['device_id'], 'temperature', $temperature['sensor_id']);
}
mysql_query("UPDATE sensors SET sensor_current = '$temp' WHERE sensor_class='temperature' AND sensor_id = '" . $temperature['sensor_id'] . "'");

View File

@ -32,7 +32,6 @@ while($sensor = mysql_fetch_array($volt_data)) {
if($sensor['sensor_current'] > $sensor['sensor_limit_low'] && $volt <= $sensor['sensor_limit_low'])
{
if($device['sysContact']) { $email = $device['sysContact']; } else { $email = $config['email_default']; }
$msg = "Voltage Alarm: " . $device['hostname'] . " " . $sensor['sensor_descr'] . " is " . $volt . "V (Limit " . $sensor['sensor_limit'];
$msg .= "V) at " . date($config['timestamp_format']);
notify($device, "Voltage Alarm: " . $device['hostname'] . " " . $sensor['sensor_descr'], $msg);
@ -41,7 +40,6 @@ while($sensor = mysql_fetch_array($volt_data)) {
}
else if($sensor['sensor_current'] < $sensor['sensor_limit'] && $volt >= $sensor['sensor_limit'])
{
if($device['sysContact']) { $email = $device['sysContact']; } else { $email = $config['email_default']; }
$msg = "Voltage Alarm: " . $device['hostname'] . " " . $sensor['sensor_descr'] . " is " . $volt . "V (Limit " . $sensor['sensor_limit'];
$msg .= "V) at " . date($config['timestamp_format']);
notify($device, "Voltage Alarm: " . $device['hostname'] . " " . $sensor['sensor_descr'], $msg);

View File

@ -1,6 +1,6 @@
<?php
echo "Wireless: ";
echo("Wireless: ");
if ($device['type'] == 'network')
{
@ -9,7 +9,7 @@ if ($device['type'] == 'network')
if ($device['os'] == 'airport')
{
echo "Checking Airport Wireless clients... ";
echo("Checking Airport Wireless clients... ");
$wificlients1 = snmp_get($device, "wirelessNumber.0", "-OUqnv", "AIRPORT-BASESTATION-3-MIB") +0;
@ -21,12 +21,12 @@ if ($device['type'] == 'network')
if ($device['os'] == 'ios' and substr($device['hardware'],0,4) == 'AIR-')
{
echo "Checking Aironet Wireless clients... ";
echo("Checking Aironet Wireless clients... ");
$wificlients1 = snmp_get($device, "cDot11ActiveWirelessClients.1", "-OUqnv", "CISCO-DOT11-ASSOCIATION-MIB");
$wificlients2 = snmp_get($device, "cDot11ActiveWirelessClients.2", "-OUqnv", "CISCO-DOT11-ASSOCIATION-MIB");
echo ($wificlients1 +0) . " clients on dot11Radio0, " . ($wificlients2 +0) . " clients on dot11Radio1\n";
echo(($wificlients1 +0) . " clients on dot11Radio0, " . ($wificlients2 +0) . " clients on dot11Radio1\n");
}
@ -76,6 +76,6 @@ if ($device['type'] == 'network')
}
echo "\n";
echo("\n");
?>

View File

@ -1,67 +0,0 @@
<?php
function cpugraphHP ($rrd, $graph , $from, $to, $width, $height)
{
global $config;
$database = "rrd/" . $rrd;
$optsa = array( "--start", $from, "--width", $width, "--height", $height, "--vertical-label", $vertical, "--alt-autoscale-max",
"-l 0",
"-E",
"--title", $title,
"DEF:load=$database:LOAD:AVERAGE",
"AREA:load#FAFDCE:",
"LINE1.25:load#dd8800:Load",
"GPRINT:load:LAST:Cur\:%3.2lf",
"GPRINT:load:AVERAGE:Avg\:%3.2lf",
"GPRINT:load:MIN:Min\:%3.2lf",
"GPRINT:load:MAX:Max\:%3.2lf\\n");
if($width <= "300") {$optsb = array("--font", "LEGEND:7:".$config['mono_font']."",
"--font", "AXIS:6:".$config['mono_font']."",
"--font-render-mode", "normal");}
$opts = array_merge($config['rrdgraph_defaults'], $$optsa, $optsb);
$ret = rrd_graph("$graph", $opts, count($opts));
if( !is_array($ret) ) {
$err = rrd_error();
#echo "rrd_graph() ERROR: $err\n";
return FALSE;
} else {
return $graph;
}
}
function memgraphHP ($rrd, $graph , $from, $to, $width, $height, $title, $vertical)
{
global $config, $installdir;
$database = "rrd/" . $rrd;
$memrrd = $database;
$opts = array("--start", "$from", "--alt-autoscale-max", "--width", "$width", "--height", "$height",
"-l", "0", "-E", "-b", "1024",
"DEF:TOTAL=$memrrd:TOTAL:AVERAGE",
"DEF:FREE=$memrrd:FREE:AVERAGE",
"DEF:USED=$memrrd:USED:AVERAGE",
"AREA:USED#ee9900:Used",
"AREA:FREE#FAFDCE:Free:STACK",
"LINE1.5:TOTAL#cc0000:");
if($width <= "300") {$optsb = array("--font", "LEGEND:7:".$config['mono_font']."",
"--font", "AXIS:6:".$config['mono_font']."",
"--font-render-mode", "normal");}
$opts = array_merge($config['rrdgraph_defaults'], $$opts, $optsb);
$ret = rrd_graph("$graph", $opts, count($opts));
if( !is_array($ret) ) {
$err = rrd_error();
#echo "rrd_graph() ERROR: $err\n";
return FALSE;
} else {
return $graph;
}
}

View File

@ -1,5 +0,0 @@
<?php
include("procurve-graphing.php");
?>

View File

@ -3,7 +3,7 @@
function add_service($service) {
global $id;
global $hostname;
echo "$service ";
echo("$service ");
$sql = "INSERT INTO `services` (`device_id`,`service_ip`,`service_type`,`service_desc`,`service_param`,`service_ignore`)
VALUES ('" . mres($id). "','" . mres($hostname) . "','" . mres($service) . "',
'" . mres("auto discovered: $service") . "','" . mres("") . "','0')";

View File

@ -1,5 +1,7 @@
<?php
# FIXME not used, do we still need this?
function callsgraphSNOM ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
global $config;
$database = $config['rrd_dir'] . "/" . $rrd;
@ -24,7 +26,7 @@ function callsgraphSNOM ($rrd, $graph, $from, $to, $width, $height, $title, $ver
if( !is_array($ret) ) {
$err = rrd_error();
echo "rrd_graph() ERROR: $err\n";
echo("rrd_graph() ERROR: $err\n");
return FALSE;
} else {
return $imgfile;

View File

@ -777,7 +777,7 @@ $config['mib_dir'] = $config['mibdir'];
if(isset($config['enable_nagios']) && $config['enable_nagios']) {
$nagios_link = mysql_connect($config['nagios_db_host'], $config['nagios_db_user'], $config['nagios_db_pass']);
if (!$nagios_link) {
echo "<h2>Nagios MySQL Error</h2>";
echo("<h2>Nagios MySQL Error</h2>");
die;
}
$nagios_db = mysql_select_db($config['nagios_db_name'], $nagios_link);
@ -793,8 +793,8 @@ if(isset($_SERVER['HTTPS']))
$observium_link = mysql_pconnect($config['db_host'], $config['db_user'], $config['db_pass']);
if (!$observium_link)
{
echo "<h2>Observer MySQL Error</h2>";
echo mysql_error();
echo("<h2>Observer MySQL Error</h2>");
echo(mysql_error());
die;
}
$observium_db = mysql_select_db($config['db_name'], $observium_link);

View File

@ -1,11 +1,11 @@
#!/usr/bin/env php
<?php
echo("PLEASE USE 'poller.php' INSTEAD!");
echo("\nPLEASE USE 'poller.php' INSTEAD!\n");
include("poller.php");
echo("PLEASE USE 'poller.php' INSTEAD!");
echo("\nPLEASE USE 'poller.php' INSTEAD!\n");
?>

View File

@ -72,7 +72,7 @@ while ($device = mysql_fetch_assoc($device_query))
$device_start = utime(); // Start counting device poll time
echo($device['hostname'] . " ".$device['device_id']." ".$device['os']." ");
if($config['os'][$device['os']]['group']) {$device['os_group'] = $config['os'][$device['os']]['group']; echo "(".$device['os_group'].")";}
if($config['os'][$device['os']]['group']) {$device['os_group'] = $config['os'][$device['os']]['group']; echo("(".$device['os_group'].")");}
echo("\n");
unset($poll_update); unset($poll_update_query); unset($poll_separator); unset($version); unset($uptime); unset($features);