From 30bdd952ee531fc273369f57fe18edabd4e8f2e7 Mon Sep 17 00:00:00 2001 From: Tom Laermans Date: Sat, 20 Nov 2010 14:04:07 +0000 Subject: [PATCH] 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 --- adduser.php | 4 +- delhost.php | 2 +- discovery.php | 5 +- fix-port-rrd.php | 6 +- html/ajax_listports.php | 27 ++++---- html/includes/authenticate.inc.php | 12 ++-- html/includes/authentication/ldap.inc.php | 2 +- html/includes/functions.inc.php | 6 +- html/includes/ifbox.inc | 4 +- html/includes/print-menubar.php | 8 +-- html/includes/topnav.inc | 36 +++++----- html/index.php | 18 +++-- html/map.php | 4 +- html/pages/alerts.inc.php | 4 +- html/pages/bgp.inc.php | 3 +- html/pages/bill/edit.inc.php | 6 +- html/pages/delhost.inc.php | 6 +- html/pages/device/edit/device.inc.php | 8 +-- html/pages/device/edit/ports.inc.php | 20 +++--- html/pages/device/interface.inc.php | 4 +- html/pages/device/showconfig.inc.php | 3 +- html/pages/logon.inc.php | 2 +- includes/discovery/arp-table.inc.php | 2 +- includes/discovery/bgp-peers.inc.php | 4 +- includes/discovery/current/apc.inc.php | 4 +- .../discovery/current/gamatronicups.inc.php | 57 ++++++++-------- includes/discovery/current/ipoman.inc.php | 4 +- includes/discovery/current/mgeups.inc.php | 4 +- includes/discovery/current/rfc1628.inc.php | 8 +-- includes/discovery/current/xups.inc.php | 6 +- .../discovery/discovery-protocols.inc.php | 2 +- includes/discovery/frequencies/ipoman.inc.php | 2 +- includes/discovery/frequencies/mgeups.inc.php | 4 +- .../discovery/frequencies/rfc1628.inc.php | 6 +- includes/discovery/frequencies/xups.inc.php | 6 +- includes/discovery/toner.inc.php | 2 +- includes/discovery/voltages/apc.inc.php | 8 +-- includes/discovery/voltages/areca.inc.php | 2 +- .../discovery/voltages/gamatronicups.inc.php | 4 +- includes/discovery/voltages/ipoman.inc.php | 2 +- includes/discovery/voltages/linux.inc.php | 2 +- includes/discovery/voltages/mgeups.inc.php | 5 +- includes/discovery/voltages/rfc1628.inc.php | 8 +-- .../discovery/voltages/supermicro.inc.php | 2 +- includes/discovery/voltages/xups.inc.php | 8 +-- includes/functions.php | 1 - includes/polling/applications/mysql.inc.php | 4 +- includes/polling/applications/nginx.inc.php | 2 +- includes/polling/bgp-peers.inc.php | 14 ++-- includes/polling/fanspeeds.inc.php | 3 +- includes/polling/frequencies.inc.php | 2 - includes/polling/humidity.inc.php | 2 - includes/polling/os/junos.inc.php | 2 +- includes/polling/temperatures.inc.php | 8 +-- includes/polling/voltages.inc.php | 2 - includes/polling/wifi.inc.php | 10 +-- includes/procurve-graphing.php | 67 ------------------- includes/procurve.php | 5 -- includes/services.inc.php | 2 +- includes/snom-graphing.php | 4 +- includes/static-config.php | 6 +- poll-device.php | 4 +- poller.php | 2 +- 63 files changed, 199 insertions(+), 283 deletions(-) delete mode 100755 includes/procurve-graphing.php delete mode 100755 includes/procurve.php diff --git a/adduser.php b/adduser.php index d90e87b66f..ad2852c4ab 100755 --- a/adduser.php +++ b/adduser.php @@ -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"); } ?> diff --git a/delhost.php b/delhost.php index aa23da162b..9384652ef8 100755 --- a/delhost.php +++ b/delhost.php @@ -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"); diff --git a/discovery.php b/discovery.php index e4ffbfcd0f..1961a0cb50 100755 --- a/discovery.php +++ b/discovery.php @@ -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']); ?> diff --git a/fix-port-rrd.php b/fix-port-rrd.php index 9dbec19b85..3b0c00a4a5 100755 --- a/fix-port-rrd.php +++ b/fix-port-rrd.php @@ -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"); ?> diff --git a/html/ajax_listports.php b/html/ajax_listports.php index 815e3e5e5c..7bd3a40f08 100755 --- a/html/ajax_listports.php +++ b/html/ajax_listports.php @@ -1,6 +1,6 @@ RRD Log Directory is missing ({$config['rrd_dir']}). Graphing may fail."; - -### RRD dir probably shouldn't be writable by apache :> -#if(!$config['rrdcached'] && !is_writable($config['rrd_dir'])) -# echo "
RRD Log Directory is not writable ({$config['rrd_dir']}). Graphing may fail.
"; + echo("
RRD Log Directory is missing ({$config['rrd_dir']}). Graphing may fail.
"); if(!is_dir($config['temp_dir'])) - echo "
Temp Directory is missing ({$config['tmp_dir']}). Graphing may fail.
"; + echo("
Temp Directory is missing ({$config['tmp_dir']}). Graphing may fail.
"); if(!is_writable($config['temp_dir'])) - echo "
Temp Directory is not writable ({$config['tmp_dir']}). Graphing may fail.
"; + echo("
Temp Directory is not writable ({$config['tmp_dir']}). Graphing may fail.
"); 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 "
ERROR: no valid auth_mechanism defined
"; + echo("
ERROR: no valid auth_mechanism defined
"); exit(); } diff --git a/html/includes/authentication/ldap.inc.php b/html/includes/authentication/ldap.inc.php index 1d8477d5da..cb178e3f44 100644 --- a/html/includes/authentication/ldap.inc.php +++ b/html/includes/authentication/ldap.inc.php @@ -27,7 +27,7 @@ function authenticate($username,$password) } else { - echo ldap_error($ds); + echo(ldap_error($ds)); } } else diff --git a/html/includes/functions.inc.php b/html/includes/functions.inc.php index 1351e87d61..6881e499f4 100644 --- a/html/includes/functions.inc.php +++ b/html/includes/functions.inc.php @@ -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'] = ""; $output = generate_port_link($args, $args['content']); - echo $output; + echo($output); } function print_optionbar_start ($height = 20, $width = 0, $marginbottom = 5) diff --git a/html/includes/ifbox.inc b/html/includes/ifbox.inc index 2b06ec1858..d5f57cba4c 100644 --- a/html/includes/ifbox.inc +++ b/html/includes/ifbox.inc @@ -2,7 +2,7 @@ $iftype = fixiftype($interface[ifType]); - echo ("

$inf

"); + echo("

$inf

"); if($ifalias && $ifalias != "") { echo("$ifalias
"); } if($iftype && $iftype != "") { echo("$iftype "); if($mac && $mac != "") { echo("$mac
"); @@ -17,6 +17,6 @@ echo(""); } - echo ("$status"); + echo("$status"); ?> diff --git a/html/includes/print-menubar.php b/html/includes/print-menubar.php index d7d0b61e9f..41040604fd 100644 --- a/html/includes/print-menubar.php +++ b/html/includes/print-menubar.php @@ -54,12 +54,12 @@ if (isset($config['enable_bgp']) && $config['enable_bgp']) foreach ($config['device_types'] as $devtype) { - echo '
  • ' . $devtype['text'] . '
  • '; + echo('
  • ' . $devtype['text'] . '
  • '); } ?>

  • -
  • Alerts ()
  • +
  • Alerts ()
  • = '10') { echo(' @@ -118,7 +118,7 @@ if ($config['show_locations']) { if ($row['location'] != '') { - echo '
  • ' . $row['location'] . '
  • '; + echo('
  • ' . $row['location'] . '
  • '); } } ?> @@ -277,7 +277,7 @@ echo('

  • Edit User

  • '); } - echo (' + echo('
  • Authlog
  • '); } ?> diff --git a/html/includes/topnav.inc b/html/includes/topnav.inc index 9b552c7488..f3554a25a9 100644 --- a/html/includes/topnav.inc +++ b/html/includes/topnav.inc @@ -48,39 +48,39 @@ if($services['down']) { $services['bgcolour'] = "#ffcccc"; } else { $services['b - + - + - - - - + + + + - + - + - - - - + + + + - + - + - - - - + + + + diff --git a/html/index.php b/html/index.php index e244584b35..326849110a 100755 --- a/html/index.php +++ b/html/index.php @@ -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."; } ?> @@ -113,24 +111,24 @@ function popUp(URL) { $end = utime(); $run = $end - $start; $gentime = substr($run, 0, 5); - - echo '



    '); ?> diff --git a/html/map.php b/html/map.php index 26b82c2e35..77e04c910e 100755 --- a/html/map.php +++ b/html/map.php @@ -164,10 +164,10 @@ else { if ($_SESSION['authenticated']) ## FIXME level 10 only? { - echo '
    + echo('
    -
    '; +
    '); } } ?> diff --git a/html/pages/alerts.inc.php b/html/pages/alerts.inc.php index bb335d073f..42232c2fb7 100644 --- a/html/pages/alerts.inc.php +++ b/html/pages/alerts.inc.php @@ -1,6 +1,8 @@
    Devices : ( up down ignored disabled up down ignored disabled )
    Ports : ( up down ignored shutdown up down ignored shutdown )
    Services : ( up down ignored disabled up down ignored disabled )
    diff --git a/html/pages/bgp.inc.php b/html/pages/bgp.inc.php index 8ccca1ad04..70c46e1212 100644 --- a/html/pages/bgp.inc.php +++ b/html/pages/bgp.inc.php @@ -7,8 +7,7 @@ if ($_SESSION['userlevel'] < '5') else { echo("
    "); - - echo ''; + echo(''); $i = "1"; diff --git a/html/pages/bill/edit.inc.php b/html/pages/bill/edit.inc.php index 9c578dc060..9df629bb61 100644 --- a/html/pages/bill/edit.inc.php +++ b/html/pages/bill/edit.inc.php @@ -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 ' '; + echo(' >' . ucfirst($text) . ''); } echo(" diff --git a/html/pages/delhost.inc.php b/html/pages/delhost.inc.php index 66bc44170d..305470a0a5 100644 --- a/html/pages/delhost.inc.php +++ b/html/pages/delhost.inc.php @@ -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']))); } ?> diff --git a/html/pages/device/edit/device.inc.php b/html/pages/device/edit/device.inc.php index a346af80e0..de81339f0c 100644 --- a/html/pages/device/edit/device.inc.php +++ b/html/pages/device/edit/device.inc.php @@ -71,17 +71,17 @@ echo("
    Local addressPeer addressTypeRemote ASStateUptime
    Local addressPeer addressTypeRemote ASStateUptime
    "; - echo ""; - echo ""; - echo ""; + echo(""); + echo(""); + echo(""); + echo(""); # 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 ""; + echo(""); - echo ""; - echo ""; + echo(""); + echo(""); } echo(''); diff --git a/html/pages/device/interface.inc.php b/html/pages/device/interface.inc.php index a4fea523cc..5f26cf4275 100644 --- a/html/pages/device/interface.inc.php +++ b/html/pages/device/interface.inc.php @@ -52,14 +52,14 @@ echo("
    "); print_optionbar_start(); -echo ("Graphs | "); +echo("Graphs | "); if(mysql_result(mysql_query("SELECT COUNT(*) FROM `ports_adsl` WHERE `interface_id` = '".$interface['interface_id']."'"),0)) { echo("ADSL | "); } -echo ("ARP Table$pagp"); +echo("ARP Table$pagp"); diff --git a/html/pages/device/showconfig.inc.php b/html/pages/device/showconfig.inc.php index 5fbf807f96..af99abe724 100644 --- a/html/pages/device/showconfig.inc.php +++ b/html/pages/device/showconfig.inc.php @@ -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()); } ?> diff --git a/html/pages/logon.inc.php b/html/pages/logon.inc.php index 108c6f1fdf..32dc101cb2 100644 --- a/html/pages/logon.inc.php +++ b/html/pages/logon.inc.php @@ -5,7 +5,7 @@
    $unknown = 1; foreach ($device_types as $type) { - echo ' '; + echo(' >' . ucfirst($type) . ''); } if ($unknown) { - echo ' '; + echo(' '); } echo(" diff --git a/html/pages/device/edit/ports.inc.php b/html/pages/device/edit/ports.inc.php index c0c587f47d..03eddabb9d 100644 --- a/html/pages/device/edit/ports.inc.php +++ b/html/pages/device/edit/ports.inc.php @@ -24,23 +24,23 @@ echo("
    $query = mysql_query("SELECT * FROM `ports` WHERE device_id='".$device['device_id']."' ORDER BY `ifIndex` "); while($device = mysql_fetch_array($query)) { - echo "
    ". $device['ifIndex']."".$device['ifDescr'] . "". $device['ifAdminStatus']."
    ". $device['ifIndex']."".$device['ifDescr'] . "". $device['ifAdminStatus']."". $device['ifOperStatus']."". $device['ifOperStatus'].""; - echo ""; - echo ""; - echo "
    "); + echo(""); + echo(""); + echo("
    Login required -
    +

    Please log in:

    diff --git a/includes/discovery/arp-table.inc.php b/includes/discovery/arp-table.inc.php index bc7016312f..a76e069ec9 100644 --- a/includes/discovery/arp-table.inc.php +++ b/includes/discovery/arp-table.inc.php @@ -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); diff --git a/includes/discovery/bgp-peers.inc.php b/includes/discovery/bgp-peers.inc.php index 8fb9f03af6..816482ff1d 100755 --- a/includes/discovery/bgp-peers.inc.php +++ b/includes/discovery/bgp-peers.inc.php @@ -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 diff --git a/includes/discovery/current/apc.inc.php b/includes/discovery/current/apc.inc.php index 7e27fefd8a..ab4e0f2fc1 100644 --- a/includes/discovery/current/apc.inc.php +++ b/includes/discovery/current/apc.inc.php @@ -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)); } } diff --git a/includes/discovery/current/gamatronicups.inc.php b/includes/discovery/current/gamatronicups.inc.php index bea0162380..a6a4810d06 100644 --- a/includes/discovery/current/gamatronicups.inc.php +++ b/includes/discovery/current/gamatronicups.inc.php @@ -2,37 +2,36 @@ global $valid_sensor; -if ($device['os'] == "gamatronicups") { +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"); + $type = "gamatronicups"; + $precision = 1; + $index = $i; + $lowlimit = 0; + $warnlimit = NULL; + $limit = NULL; - 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"); - $type = "gamatronicups"; - $precision = 1; - $index = $i; - $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); - } - - - - - 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"); - $type = "gamatronicups"; - $precision = 1; - $index = 100+$i; - $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); - } + 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"); + $type = "gamatronicups"; + $precision = 1; + $index = 100+$i; + $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)); + } } ?> diff --git a/includes/discovery/current/ipoman.inc.php b/includes/discovery/current/ipoman.inc.php index 9ecc655c26..ae60b57928 100644 --- a/includes/discovery/current/ipoman.inc.php +++ b/includes/discovery/current/ipoman.inc.php @@ -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)); } } } diff --git a/includes/discovery/current/mgeups.inc.php b/includes/discovery/current/mgeups.inc.php index 0d7e6fd704..c79ec34cb3 100644 --- a/includes/discovery/current/mgeups.inc.php +++ b/includes/discovery/current/mgeups.inc.php @@ -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)); } } ?> diff --git a/includes/discovery/current/rfc1628.inc.php b/includes/discovery/current/rfc1628.inc.php index 4e0d58528c..48de0914e5 100644 --- a/includes/discovery/current/rfc1628.inc.php +++ b/includes/discovery/current/rfc1628.inc.php @@ -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)); } } diff --git a/includes/discovery/current/xups.inc.php b/includes/discovery/current/xups.inc.php index 7d44c22cd1..6bb35d422e 100644 --- a/includes/discovery/current/xups.inc.php +++ b/includes/discovery/current/xups.inc.php @@ -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)); } } diff --git a/includes/discovery/discovery-protocols.inc.php b/includes/discovery/discovery-protocols.inc.php index a32220245b..351f7eb6b3 100755 --- a/includes/discovery/discovery-protocols.inc.php +++ b/includes/discovery/discovery-protocols.inc.php @@ -1,6 +1,6 @@ diff --git a/includes/discovery/frequencies/rfc1628.inc.php b/includes/discovery/frequencies/rfc1628.inc.php index 22d2a6ee07..33b570cbb5 100644 --- a/includes/discovery/frequencies/rfc1628.inc.php +++ b/includes/discovery/frequencies/rfc1628.inc.php @@ -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)); } ?> diff --git a/includes/discovery/frequencies/xups.inc.php b/includes/discovery/frequencies/xups.inc.php index 9dff13c111..1cc3b323cb 100644 --- a/includes/discovery/frequencies/xups.inc.php +++ b/includes/discovery/frequencies/xups.inc.php @@ -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)); } } ?> diff --git a/includes/discovery/toner.inc.php b/includes/discovery/toner.inc.php index eb4d226657..78bcb75475 100644 --- a/includes/discovery/toner.inc.php +++ b/includes/discovery/toner.inc.php @@ -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)); } } } diff --git a/includes/discovery/voltages/apc.inc.php b/includes/discovery/voltages/apc.inc.php index 0418c5a80f..d846af41fc 100644 --- a/includes/discovery/voltages/apc.inc.php +++ b/includes/discovery/voltages/apc.inc.php @@ -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)); } } ?> diff --git a/includes/discovery/voltages/areca.inc.php b/includes/discovery/voltages/areca.inc.php index 1a571b701a..00985573c8 100644 --- a/includes/discovery/voltages/areca.inc.php +++ b/includes/discovery/voltages/areca.inc.php @@ -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)); } } } diff --git a/includes/discovery/voltages/gamatronicups.inc.php b/includes/discovery/voltages/gamatronicups.inc.php index f5ef8da278..4546f245f6 100644 --- a/includes/discovery/voltages/gamatronicups.inc.php +++ b/includes/discovery/voltages/gamatronicups.inc.php @@ -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)); } } diff --git a/includes/discovery/voltages/ipoman.inc.php b/includes/discovery/voltages/ipoman.inc.php index 88578185a2..90a2d29bf1 100644 --- a/includes/discovery/voltages/ipoman.inc.php +++ b/includes/discovery/voltages/ipoman.inc.php @@ -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? } } diff --git a/includes/discovery/voltages/linux.inc.php b/includes/discovery/voltages/linux.inc.php index dcc23ea5e2..eba6826fb6 100644 --- a/includes/discovery/voltages/linux.inc.php +++ b/includes/discovery/voltages/linux.inc.php @@ -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)); } } } diff --git a/includes/discovery/voltages/mgeups.inc.php b/includes/discovery/voltages/mgeups.inc.php index 97f042c028..6fd0533b5c 100644 --- a/includes/discovery/voltages/mgeups.inc.php +++ b/includes/discovery/voltages/mgeups.inc.php @@ -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)); } } ?> \ No newline at end of file diff --git a/includes/discovery/voltages/rfc1628.inc.php b/includes/discovery/voltages/rfc1628.inc.php index e8a1efc9cb..514a20377a 100644 --- a/includes/discovery/voltages/rfc1628.inc.php +++ b/includes/discovery/voltages/rfc1628.inc.php @@ -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)); } } ?> \ No newline at end of file diff --git a/includes/discovery/voltages/supermicro.inc.php b/includes/discovery/voltages/supermicro.inc.php index 02e8830c2a..2e84e51017 100644 --- a/includes/discovery/voltages/supermicro.inc.php +++ b/includes/discovery/voltages/supermicro.inc.php @@ -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)); } } } diff --git a/includes/discovery/voltages/xups.inc.php b/includes/discovery/voltages/xups.inc.php index 6296f21b9d..3a4284afbf 100644 --- a/includes/discovery/voltages/xups.inc.php +++ b/includes/discovery/voltages/xups.inc.php @@ -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)); } } ?> \ No newline at end of file diff --git a/includes/functions.php b/includes/functions.php index 66adadc7b8..bc5a5c6ed4 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -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"); diff --git a/includes/polling/applications/mysql.inc.php b/includes/polling/applications/mysql.inc.php index c7557dd54a..65bbdf230f 100644 --- a/includes/polling/applications/mysql.inc.php +++ b/includes/polling/applications/mysql.inc.php @@ -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 "); ?> diff --git a/includes/polling/applications/nginx.inc.php b/includes/polling/applications/nginx.inc.php index 0bba79c2cd..b0895932cf 100644 --- a/includes/polling/applications/nginx.inc.php +++ b/includes/polling/applications/nginx.inc.php @@ -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)) { diff --git a/includes/polling/bgp-peers.inc.php b/includes/polling/bgp-peers.inc.php index d0888effbe..06d51c8abc 100755 --- a/includes/polling/bgp-peers.inc.php +++ b/includes/polling/bgp-peers.inc.php @@ -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"; diff --git a/includes/polling/fanspeeds.inc.php b/includes/polling/fanspeeds.inc.php index bcd33b273f..334c37fca6 100755 --- a/includes/polling/fanspeeds.inc.php +++ b/includes/polling/fanspeeds.inc.php @@ -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 (> " . $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'] . "'"); diff --git a/includes/polling/frequencies.inc.php b/includes/polling/frequencies.inc.php index 9142a5414b..5ecce5df00 100644 --- a/includes/polling/frequencies.inc.php +++ b/includes/polling/frequencies.inc.php @@ -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); diff --git a/includes/polling/humidity.inc.php b/includes/polling/humidity.inc.php index 235801a7e3..83d784bb42 100644 --- a/includes/polling/humidity.inc.php +++ b/includes/polling/humidity.inc.php @@ -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); diff --git a/includes/polling/os/junos.inc.php b/includes/polling/os/junos.inc.php index f7b95efa71..defde86c0e 100644 --- a/includes/polling/os/junos.inc.php +++ b/includes/polling/os/junos.inc.php @@ -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"); } diff --git a/includes/polling/temperatures.inc.php b/includes/polling/temperatures.inc.php index 1ee935b408..3e997ec712 100755 --- a/includes/polling/temperatures.inc.php +++ b/includes/polling/temperatures.inc.php @@ -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 . " °C (> " . $temperature['sensor_limit'] . " °C)", $device['device_id'], 'temperature', $temperature['sensor_id']); + log_event('Temperature ' . $temperature['sensor_descr'] . " over threshold: " . $temp . " " . html_entity_decode('°') . "C (> " . $temperature['sensor_limit'] . " " . html_entity_decode('°') . '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'] . "'"); diff --git a/includes/polling/voltages.inc.php b/includes/polling/voltages.inc.php index 483fc9a0b1..ca558d52b2 100755 --- a/includes/polling/voltages.inc.php +++ b/includes/polling/voltages.inc.php @@ -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); diff --git a/includes/polling/wifi.inc.php b/includes/polling/wifi.inc.php index 4ed7f35943..2491816d63 100644 --- a/includes/polling/wifi.inc.php +++ b/includes/polling/wifi.inc.php @@ -1,6 +1,6 @@ diff --git a/includes/procurve-graphing.php b/includes/procurve-graphing.php deleted file mode 100755 index eb854c552e..0000000000 --- a/includes/procurve-graphing.php +++ /dev/null @@ -1,67 +0,0 @@ - diff --git a/includes/services.inc.php b/includes/services.inc.php index 97783cfcb5..5ba02fdd80 100644 --- a/includes/services.inc.php +++ b/includes/services.inc.php @@ -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')"; diff --git a/includes/snom-graphing.php b/includes/snom-graphing.php index 14a6d5117d..ee3b0a99b6 100644 --- a/includes/snom-graphing.php +++ b/includes/snom-graphing.php @@ -1,5 +1,7 @@ Nagios MySQL Error"; + echo("

    Nagios MySQL Error

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

    Observer MySQL Error

    "; - echo mysql_error(); + echo("

    Observer MySQL Error

    "); + echo(mysql_error()); die; } $observium_db = mysql_select_db($config['db_name'], $observium_link); diff --git a/poll-device.php b/poll-device.php index d34693d4c3..7dfbd3eedf 100755 --- a/poll-device.php +++ b/poll-device.php @@ -1,11 +1,11 @@ #!/usr/bin/env php diff --git a/poller.php b/poller.php index dc7a886858..2e8c161c8a 100755 --- a/poller.php +++ b/poller.php @@ -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);