kill a whole bunch of trailing spaces

git-svn-id: http://www.observium.org/svn/observer/trunk@2516 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Tom Laermans
2011-09-20 09:55:11 +00:00
parent 9b270dd1e5
commit d864ce234f
103 changed files with 326 additions and 331 deletions
+1 -1
View File
@@ -50,7 +50,7 @@ function getDates($dayofmonth)
{
$lastmonth = 10;
$lastyear = $year - 1;
} elseif ($lastmonth == 0)
} elseif ($lastmonth == 0)
{
$lastmonth = 11;
$lastyear = $year - 1;
+2 -2
View File
@@ -3,7 +3,7 @@
## Common Functions
function isCli() {
if(php_sapi_name() == 'cli' && empty($_SERVER['REMOTE_ADDR'])) {
return true;
} else {
@@ -66,7 +66,7 @@ function get_sensor_rrd($device, $sensor)
global $config;
# For IPMI, sensors tend to change order, and there is no index, so we prefer to use the description as key here.
if ($config['os'][$device['os']]['sensor_descr'] || $sensor['poller_type'] == "ipmi")
if ($config['os'][$device['os']]['sensor_descr'] || $sensor['poller_type'] == "ipmi")
{
$rrd_file = $config['rrd_dir']."/".$device['hostname']."/".safename("sensor-".$sensor['sensor_class']."-".$sensor['sensor_type']."-".$sensor['sensor_descr'] . ".rrd");
} else {
+23 -23
View File
@@ -3,25 +3,25 @@
* Color.php
*
* PHP version 4
*
*
* Copyright (c) 2007 Stefan Walk
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*
* @category Console
@@ -68,11 +68,11 @@ $GLOBALS['_CONSOLE_COLOR_CODES'] = array (
)
);
/**
* A simple class to use ANSI Colorcodes.
*
* Of all the functions, you probably only want to use convert() and escape().
* Of all the functions, you probably only want to use convert() and escape().
* They are easier to use. However, if you want to access colorcodes more
* directly, look into the other functions.
*
@@ -87,14 +87,14 @@ class Console_Color
/**
* Returns an ANSI-Controlcode
*
*
* Takes 1 to 3 Arguments: either 1 to 3 strings containing the name of the
* FG Color, style and BG color, or one array with the indices color, style
* or background.
*
* @param mixed $color Optional.
* Either a string with the name of the foreground
* color, or an array with the indices 'color',
* color, or an array with the indices 'color',
* 'style', 'background' and corresponding names as
* values.
* @param string $style Optional name of the style
@@ -150,7 +150,7 @@ class Console_Color
$colors = &$GLOBALS['_CONSOLE_COLOR_CODES'];
return "\033[".$colors['color'][$name].'m';
}
/**
* Returns a style controlcode
*
@@ -164,7 +164,7 @@ class Console_Color
$colors = &$GLOBALS['_CONSOLE_COLOR_CODES'];
return "\033[".$colors['style'][$name].'m';
}
/**
* Returns a BG color controlcode
*
@@ -183,7 +183,7 @@ class Console_Color
* Converts colorcodes in the format %y (for yellow) into ansi-control
* codes. The conversion table is: ('bold' meaning 'light' on some
* terminals). It's almost the same conversion table irssi uses.
* <pre>
* <pre>
* text text background
* ------------------------------------------------
* %k %K %0 black dark grey black
@@ -273,13 +273,13 @@ class Console_Color
/**
* Escapes % so they don't get interpreted as color codes
*
*
* @param string $string String to escape
*
* @access public
* @return string
*/
function escape($string)
function escape($string)
{
return str_replace('%', '%%', $string);
}
@@ -292,7 +292,7 @@ class Console_Color
* @acess public
* @return string
*/
function strip($string)
function strip($string)
{
return preg_replace('/\033\[[\d;]+m/', '', $string);
}
+5 -5
View File
@@ -7,7 +7,7 @@ This code is covered by the MIT license http://en.wikipedia.org/wiki/MIT_License
By Alan Szlosek from http://www.greaterscope.net/projects/dbFacile
The non-OO version of dbFacile. It's a bit simplistic, but gives you the
The non-OO version of dbFacile. It's a bit simplistic, but gives you the
really useful bits in non-class form.
Usage
@@ -177,7 +177,7 @@ function dbFetchRows($sql, $parameters = array()) {
$db_stats['fetchrows']++;
// no records, thus return empty array
// which should evaluate to false, and will prevent foreach notices/warnings
// which should evaluate to false, and will prevent foreach notices/warnings
return array();
}
/*
@@ -318,7 +318,7 @@ function dbMakeQuery($sql, $parameters) {
if($test == '?') {
$query .= array_shift($questionParams);
} else {
$query .= $namedParams[ $test ];
$query .= $namedParams[ $test ];
}
}
}
@@ -339,7 +339,7 @@ function dbPrepareData($data) {
$value = array_shift($value);
}
// it's not right to worry about invalid fields in this method because we may be operating on fields
// that are aliases, or part of other tables through joins
// that are aliases, or part of other tables through joins
//if(!in_array($key, $columns)) // skip invalid fields
// continue;
if($escape) {
@@ -384,7 +384,7 @@ function dbRollbackTransaction() {
class dbIterator implements Iterator {
private $result;
private $i;
public function __construct($r) {
$this->result = $r;
$this->i = 0;
+17 -17
View File
@@ -116,7 +116,7 @@ $warn_colour_b = "#ffcccc";
#$config['graph_colours']['blues'] = array("b5d7ff","6eb7ff","0064ff","0082ff","0019d5","0016cb","00007d"); ## Cold Blues
$config['graph_colours']['mixed'] = array('CC0000','008C00','4096EE','73880A','D01F3C','36393D','FF0084');
$config['graph_colours']['oranges'] = array('E43C00','E74B00','EB5B00','EF6A00','F37900','F78800','FB9700','FFA700');
$config['graph_colours']['oranges'] = array('E43C00','E74B00','EB5B00','EF6A00','F37900','F78800','FB9700','FFA700');
$config['graph_colours']['greens'] = array('B6D14B','91B13C','6D912D','48721E','24520F','003300');
$config['graph_colours']['pinks'] = array('D0558F','B34773','943A57','792C38','5C1F1E','401F10');
$config['graph_colours']['blues'] = array('A0A0E5','8080BD','606096','40406F','202048','000033');
@@ -193,22 +193,22 @@ $config['bad_if'][] = "-shdsl";
$config['bad_if'][] = "-aal5";
$config['bad_if'][] = "-atm";
$config['bad_if'][] = "container";
$config['bad_if'][] = "async";
$config['bad_if'][] = "plip";
$config['bad_if'][] = "-physical";
$config['bad_if'][] = "-signalling";
$config['bad_if'][] = "container";
$config['bad_if'][] = "unrouted";
$config['bad_if'][] = "bri";
$config['bad_if'][] = "-bearer";
$config['bad_if'][] = "bluetooth";
$config['bad_if'][] = "isatap";
$config['bad_if'][] = "ras";
$config['bad_if'][] = "qos";
$config['bad_if'][] = "sonet/sdh";
$config['bad_if'][] = "span rp";
$config['bad_if'][] = "span sp";
$config['bad_if'][] = "sslvpn";
$config['bad_if'][] = "async";
$config['bad_if'][] = "plip";
$config['bad_if'][] = "-physical";
$config['bad_if'][] = "-signalling";
$config['bad_if'][] = "container";
$config['bad_if'][] = "unrouted";
$config['bad_if'][] = "bri";
$config['bad_if'][] = "-bearer";
$config['bad_if'][] = "bluetooth";
$config['bad_if'][] = "isatap";
$config['bad_if'][] = "ras";
$config['bad_if'][] = "qos";
$config['bad_if'][] = "sonet/sdh";
$config['bad_if'][] = "span rp";
$config['bad_if'][] = "span sp";
$config['bad_if'][] = "sslvpn";
$config['bad_if'][] = "pppoe-";
$config['bad_if_regexp'][] = "/serial[0-9]:/";
+3 -3
View File
@@ -8,7 +8,7 @@ if ($debug) { print_r($cefs); }
if (is_array($cefs))
{
if (!is_array($entity_array))
if (!is_array($entity_array))
{
echo("Caching OIDs: ");
$entity_array = array();
@@ -31,10 +31,10 @@ if (is_array($cefs))
echo(" | |-".$path.": ".$path_name['cefSwitchingPath']."\n");
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `cef` WHERE `device_id` = '".$device['device_id']."' AND `entPhysicalIndex` = '".$entity."'
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `cef` WHERE `device_id` = '".$device['device_id']."' AND `entPhysicalIndex` = '".$entity."'
AND `afi` = '".$afi."' AND `cef_index` = '".$path."'"),0) != "1")
{
$sql = "INSERT INTO `cef` (`device_id`, `entPhysicalIndex`, `afi`, `cef_index`, `cef_path`)
$sql = "INSERT INTO `cef` (`device_id`, `entPhysicalIndex`, `afi`, `cef_index`, `cef_path`)
VALUES ('".$device['device_id']."', '".$entity."', '".$afi."', '".$path."', '".$path_name['cefSwitchingPath']."')";
mysql_query($sql);
echo("+");
+3 -3
View File
@@ -124,7 +124,7 @@ function discover_sensor(&$valid, $class, $device, $oid, $index, $type, $descr,
if (!$low_limit) { $low_limit = sensor_low_limit($class, $current); }
$insert = array('poller_type' => $poller_type, 'sensor_class' => $class, 'device_id' => $device['device_id'], 'sensor_oid' => $oid, 'sensor_index' => $index, 'sensor_type' => $type, 'sensor_descr' => $descr,
'sensor_divisor' => $divisor, 'sensor_multiplier' => $multiplier, 'sensor_limit' => $high_limit, 'sensor_limit_warn' => $warn_limit, 'sensor_limit_low' => $low_limit,
'sensor_divisor' => $divisor, 'sensor_multiplier' => $multiplier, 'sensor_limit' => $high_limit, 'sensor_limit_warn' => $warn_limit, 'sensor_limit_low' => $low_limit,
'sensor_limit_low_warn' => $low_warn_limit, 'sensor_current' => $current, 'entPhysicalIndex' => $entPhysicalIndex, 'entPhysicalIndex_measured' => $entPhysicalIndex_measured );
$inserted = dbInsert($insert, 'sensors');
@@ -300,7 +300,7 @@ function discover_link($local_interface_id, $protocol, $remote_interface_id, $re
{
global $config, $debug, $link_exists;
if (dbFetchCell("SELECT COUNT(*) FROM `links` WHERE `remote_hostname` = ? AND `local_interface_id` = ? AND `protocol` = ? AND `remote_port` = ?",
if (dbFetchCell("SELECT COUNT(*) FROM `links` WHERE `remote_hostname` = ? AND `local_interface_id` = ? AND `protocol` = ? AND `remote_port` = ?",
array($remote_hostname, $local_interface_id, $protocol, $remote_port)) == "0")
{
@@ -335,7 +335,7 @@ function discover_storage(&$valid, $device, $index, $type, $mib, $descr, $size,
$storage = dbFetchRow("SELECT * FROM `storage` WHERE `storage_index` = ? AND `device_id` = ? AND `storage_mib` = ?", array($index, $device['device_id'], $mib));
if ($storage === FALSE || !count($storage))
{
$insert = dbInsert(array('device_id' => $device['device_id'], 'storage_descr' => $descr, 'storage_index' => $index, 'storage_mib' => $mib, 'storage_type' => $type,
$insert = dbInsert(array('device_id' => $device['device_id'], 'storage_descr' => $descr, 'storage_index' => $index, 'storage_mib' => $mib, 'storage_type' => $type,
'storage_units' => $units, 'storage_size' => $size, 'storage_used' => $used), 'storage');
if ($debug) { mysql_error(); }
echo("+");
+1 -1
View File
@@ -5,7 +5,7 @@ if ($device['os'] == 'netbotz')
$oids = snmp_walk($device, ".1.3.6.1.4.1.5528.100.4.1.2.1.4", "-Osqn", "");
if ($debug) { echo($oids."\n"); }
$oids = trim($oids);
if ($oids)
if ($oids)
{
echo("Netbotz ");
foreach (explode("\n", $oids) as $data)
+3 -3
View File
@@ -22,7 +22,7 @@ if ($config['enable_libvirt'] == '1' && $device['os'] == "linux" )
{
$uri = $method.'://' . $device['hostname'];
}
if (strstr($method,'ssh') && !$ssh_ok)
{
# Check if we are using SSH if we can log in without password - without blocking the discovery
@@ -31,7 +31,7 @@ if ($config['enable_libvirt'] == '1' && $device['os'] == "linux" )
if ($ret != 255) { $ssh_ok = 1; }
}
if ($ssh_ok || !strstr($method,'ssh'))
if ($ssh_ok || !strstr($method,'ssh'))
{
# Fetch virtual machine list
unset($domlist);
@@ -107,7 +107,7 @@ if ($config['enable_libvirt'] == '1' && $device['os'] == "linux" )
}
}
}
# If we found VMs, don't cycle the other protocols anymore.
if (count($libvirt_vmlist)) { break; }
}
@@ -22,7 +22,7 @@ if ($device['os'] == "netbotz")
{
discover_sensor($valid['sensor'], 'temperature', $device, $temperature_oid, $temperature_id, 'netbotz', $descr, '1', '1', NULL, NULL, NULL, NULL, $temperature);
}
}
}
}
}
+1 -1
View File
@@ -53,7 +53,7 @@ foreach($ipsec_array as $index => $tunnel)
$updated = dbUpdate($db_update, 'ipsec_tunnels', '`tunnel_id` = ?', array($tunnels[$tunnel['cikeTunRemoteValue']]['tunnel_id']));
}
if (is_numeric($tunnel['cipSecTunHcInOctets']) && is_numeric($tunnel['cipSecTunHcInDecompOctets']) &&
if (is_numeric($tunnel['cipSecTunHcInOctets']) && is_numeric($tunnel['cipSecTunHcInDecompOctets']) &&
is_numeric($tunnel['cipSecTunHcOutOctets']) && is_numeric($tunnel['cipSecTunHcOutUncompOctets']))
{
echo("HC ");
+1 -1
View File
@@ -10,7 +10,7 @@ if ($debug) { print_r($cefs); }
if (is_array($cefs))
{
if (!is_array($entity_array))
if (!is_array($entity_array))
{
echo("Caching OIDs: ");
$entity_array = array();
+5 -5
View File
@@ -9,7 +9,7 @@ function poll_sensor($device, $class, $unit)
echo("Checking $class " . $sensor['sensor_descr'] . "... ");
if($class == "temperature")
{
{
for ($i = 0;$i < 5;$i++) # Try 5 times to get a valid temp reading
{
if ($debug) echo("Attempt $i ");
@@ -32,13 +32,13 @@ function poll_sensor($device, $class, $unit)
#$rrd_file = $config['rrd_dir']."/".$device['hostname']."/".safename("sensor-".$sensor['sensor_class']."-".$sensor['sensor_type']."-".$sensor['sensor_index'] . ".rrd");
## FIXME - sensor name format change 2011/04/26 - remove this in $amount_of_time.
## FIXME - sensor name format change 2011/04/26 - remove this in $amount_of_time.
## We don't want to reduce performance forever because douchebags don't svn up!
$old_rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("$class-" . $sensor['sensor_descr'] . ".rrd");
$old_rrd_file_b = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("$class-" . $sensor['sensor_index'] . ".rrd");
if (is_file($old_rrd_file) && is_file($old_rrd_file_b))
{
rename($old_rrd_file, $rrd_file);
if (is_file($old_rrd_file) && is_file($old_rrd_file_b))
{
rename($old_rrd_file, $rrd_file);
unlink($old_rrd_file_b);
} elseif (is_file($old_rrd_file)) {
rename($old_rrd_file, $rrd_file);
+1 -1
View File
@@ -27,7 +27,7 @@ if ($ipmi['host'] = get_dev_attrib($device,'ipmi_hostname'))
$rrd_file = get_sensor_rrd($device, $ipmisensors);
## FIXME - sensor name format change 2011/04/26 - remove this in $amount_of_time.
## FIXME - sensor name format change 2011/04/26 - remove this in $amount_of_time.
## We don't want to reduce performance forever because douchebags don't svn up!
$old_rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename($ipmisensors['sensor_class'].'-'.$ipmisensors['sensor_type'].'-'.$ipmisensors['sensor_index'] . ".rrd");
+1 -1
View File
@@ -30,7 +30,7 @@ if (count($vp_rows))
$vp_update .= ":".$t_vp['juniAtmVpStatsInPackets'].":".$t_vp['juniAtmVpStatsOutPackets'];
$vp_update .= ":".$t_vp['juniAtmVpStatsInPacketOctets'].":".$t_vp['juniAtmVpStatsOutPacketOctets'];
$vp_update .= ":".$t_vp['juniAtmVpStatsInPacketErrors'].":".$t_vp['juniAtmVpStatsOutPacketErrors'];
$rrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("vp-" . $vp['ifIndex'] . "-".$vp['vp_id'].".rrd");
if ($debug) { echo("$rrd "); }
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
#Sentry3-MIB::towerModelNumber "CW-24V2-L30M"
#Sentry3-MIB::towerModelNumber "CW-24V2-L30M"
#Sentry3-MIB::systemVersion "Sentry Switched CDU Version 6.0g"
#Sentry3-MIB::towerProductSN "ABEF0001561"
+1 -1
View File
@@ -113,7 +113,7 @@ foreach ($port_stats as $ifIndex => $port)
$ports[$port['ifIndex']] = dbFetchRow("SELECT * FROM `ports` WHERE `interface_id` = ?", array($interface_id));
echo("Adding: ".$port['ifName']."(".$ifIndex.")(".$ports[$port['ifIndex']]['interface_id'].")");
#print_r($ports);
} elseif ($ports[$ifIndex]['deleted'] == "1") {
} elseif ($ports[$ifIndex]['deleted'] == "1") {
dbUpdate(array('deleted' => '0'), 'ports', '`interface_id` = ?', array($ports[$ifIndex]['interface_id']));
$ports[$ifIndex]['deleted'] = "0";
}
+1 -1
View File
@@ -36,7 +36,7 @@ if ($config['enable_printers'])
#FIXME should report for toner out... :)
# Log toner swap
# Log toner swap
if ($tonerperc > $toner['toner_current'])
{
log_event('Toner ' . $toner['toner_descr'] . ' was replaced (new level: ' . $tonerperc . '%)', $device, 'toner', $toner['toner_id']);
+1 -1
View File
@@ -45,7 +45,7 @@ if ($device['type'] == 'network' || $device['type'] == 'firewall')
unset($wirelesscards);
}
}
if ($device['os'] == 'symbol' AND (stristr($device['hardware'],"AP")))
{
echo("Checking Symbol Wireless clients... ");
+2 -2
View File
@@ -303,9 +303,9 @@ $rewrite_extreme_hardware = array (
'.1.3.6.1.4.1.1916.2.79' => 'Summit X450e-48p',
'.1.3.6.1.4.1.1916.2.62' => 'Black Diamond 8810',
'.1.3.6.1.4.1.1916.2.67' => 'SummitStack',
'.1.3.6.1.4.1.1916.2.100' => 'Summit x150-24t',
'.1.3.6.1.4.1.1916.2.100' => 'Summit x150-24t',
'.1.3.6.1.4.1.1916.2.114' => 'Summit x650-24x',
'.1.3.6.1.4.1.1916.2.129' => 'NWI-e450a',
'.1.3.6.1.4.1.1916.2.129' => 'NWI-e450a',
'.1.3.6.1.4.1.1916.2.133' => 'Summit x480-48t',
'.1.3.6.1.4.1.1916.2.141' => 'Summit x480-48x',
);
+1 -1
View File
@@ -41,7 +41,7 @@ function rrdtool($command, $file, $options)
global $config, $debug;
$command = $config['rrdtool'] . " $command $file $options";
if ($config['rrdcached'])
if ($config['rrdcached'])
{
$command .= " --daemon " . $config['rrdcached'];
}
+2 -2
View File
@@ -7,10 +7,10 @@ function add_service($device, $service)
{
echo("$service ");
$insert = array('device_id' => $device['device_id'], 'service_ip' => $device['hostname'], 'service_type' => $service,
$insert = array('device_id' => $device['device_id'], 'service_ip' => $device['hostname'], 'service_type' => $service,
'service_desc' => "auto discovered: $service", 'service_param' => "", 'service_ignore' => "0");
return dbInsert($insert, 'services');
return dbInsert($insert, 'services');
}
+4 -4
View File
@@ -7,10 +7,10 @@ $check = shell_exec($config['nagios_plugins'] . "/check_dns -H ".$nsquery." -s "
list($check, $time) = split("\|", $check);
if(strstr($check, "DNS OK: ")) {
$status = '1';
} else {
$status = '0';
if(strstr($check, "DNS OK: ")) {
$status = '1';
} else {
$status = '0';
}
?>
+4 -4
View File
@@ -4,10 +4,10 @@ $check = shell_exec($config['nagios_plugins'] . "/check_ftp -H ".$service['hostn
list($check, $time) = split("\|", $check);
if(strstr($check, "FTP OK - ")) {
$status = '1';
} else {
$status = '0';
if(strstr($check, "FTP OK - ")) {
$status = '1';
} else {
$status = '0';
}
?>
+4 -4
View File
@@ -4,10 +4,10 @@ $check = shell_exec($config['nagios_plugins'] . "/check_http -H ".$service['host
list($check, $time) = split("\|", $check);
if(strstr($check, "HTTP OK")) {
$status = '1';
} else {
$status = '0';
if(strstr($check, "HTTP OK")) {
$status = '1';
} else {
$status = '0';
}
?>
+4 -4
View File
@@ -4,10 +4,10 @@ $check = shell_exec($config['nagios_plugins'] . "/check_imap -H ".$service['host
list($check, $time) = split("\|", $check);
if(strstr($check, "IMAP OK - ")) {
$status = '1';
} else {
$status = '0';
if(strstr($check, "IMAP OK - ")) {
$status = '1';
} else {
$status = '0';
}
?>
+4 -4
View File
@@ -7,10 +7,10 @@ $check = shell_exec($config['nagios_plugins'] . "/check_mysql -H ".$service['hos
list($check, $time) = split("\|", $check);
if(strstr($check, "Uptime:")) {
$status = '1';
} else {
$status = '0';
if(strstr($check, "Uptime:")) {
$status = '1';
} else {
$status = '0';
}
?>
+4 -4
View File
@@ -4,10 +4,10 @@ $check = shell_exec($config['nagios_plugins'] . "/check_pop -H ".$service['hostn
list($check, $time) = split("\|", $check);
if(strstr($check, "POP OK - ")) {
$status = '1';
} else {
$status = '0';
if(strstr($check, "POP OK - ")) {
$status = '1';
} else {
$status = '0';
}
?>
+4 -4
View File
@@ -4,10 +4,10 @@ $check = shell_exec($config['nagios_plugins'] . "/check_simap -H ".$service['hos
list($check, $time) = split("\|", $check);
if(strstr($check, "SIMAP OK")) {
$status = '1';
} else {
$status = '0';
if(strstr($check, "SIMAP OK")) {
$status = '1';
} else {
$status = '0';
}
?>
+4 -4
View File
@@ -4,10 +4,10 @@ $check = shell_exec($config['nagios_plugins'] . "/check_smtp -H ".$service['host
list($check, $time) = split("\|", $check);
if(strstr($check, "SMTP OK")) {
$status = '1';
} else {
$status = '0';
if(strstr($check, "SMTP OK")) {
$status = '1';
} else {
$status = '0';
}
?>
+4 -4
View File
@@ -4,10 +4,10 @@ $check = shell_exec($config['nagios_plugins'] . "/check_spop -H ".$service['host
list($check, $time) = split("\|", $check);
if(strstr($check, "SPOP OK")) {
$status = '1';
} else {
$status = '0';
if(strstr($check, "SPOP OK")) {
$status = '1';
} else {
$status = '0';
}
?>
+4 -4
View File
@@ -4,10 +4,10 @@ $check = shell_exec($config['nagios_plugins'] . "/check_ssh -H ".$service['hostn
list($check, $time) = split("\|", $check);
if(strstr($check, "SSH OK")) {
$status = '1';
} else {
$status = '0';
if(strstr($check, "SSH OK")) {
$status = '1';
} else {
$status = '0';
}
?>
+4 -4
View File
@@ -6,10 +6,10 @@ $check = shell_exec($config['nagios_plugins'] . "/check_telnet -H ".$service['ho
list($check, $time) = split("\|", $check);
if(strstr($check, "TCP OK - ")) {
$status = '1';
} else {
$status = '0';
if(strstr($check, "TCP OK - ")) {
$status = '1';
} else {
$status = '0';
}
?>
+4 -4
View File
@@ -16,7 +16,7 @@ function get_cache($host, $value){
//If failed, try by IP
if(!is_numeric($dev_cache[$host]['device_id'])) {
$dev_cache[$host]['device_id'] = dbFetchCell('SELECT `device_id` FROM `ipv4_addresses` AS A, `ports` AS I WHERE A.ipv4_address = ? AND I.interface_id = A.interface_id', array($host));
}
}
break;
case 'os':
$dev_cache[$host]['os'] = dbFetchCell('SELECT `os` FROM devices WHERE `device_id` = ?', array(get_cache($host, 'device_id')));
@@ -42,7 +42,7 @@ function process_syslog ($entry, $update) {
echo('D-'.$bi);
return $entry;
}
$entry['device_id'] = get_cache($entry['host'], 'device_id');
if($entry['device_id']) {
$os = get_cache($entry['host'], 'os');
@@ -137,7 +137,7 @@ function process_syslog ($entry, $update) {
dbInsert(
array(
'device_id' => $entry['device_id'],
'program' => $entry['program'],
'program' => $entry['program'],
'facility' => $entry['facility'],
'priority' => $entry['priority'],
'level' => $entry['level'],
@@ -149,7 +149,7 @@ function process_syslog ($entry, $update) {
);
unset($os);
}
return $entry;
return $entry;
}
?>