Merge pull request #3093 from murrant/php_fixes

Fix a few php errors for syslog, and everywhere else.
This commit is contained in:
Neil Lathwood
2016-02-26 13:26:28 +00:00
25 changed files with 26 additions and 26 deletions
+1 -1
View File
@@ -34,7 +34,7 @@ foreach (dbFetchRows('SELECT * FROM `devices` AS D, `services` AS S WHERE S.devi
$cmd = $config['nagios_plugins'] . "/check_" . $service['service_type'] . " -H " . ($service['service_ip'] ? $service['service_ip'] : $service['hostname']);
$cmd .= " ".$service['service_param'];
$check = shell_exec($cmd);
list($check, $time) = split("\|", $check);
list($check, $time) = explode("|", $check);
if(stristr($check, "ok -")) {
$status = 1;
}
@@ -37,7 +37,7 @@ if ($handle = opendir($rrddir)) {
foreach ($files as $id => $file) {
$hostname = eregi_replace('app-shoutcast-'.$app['app_id'].'-', '', $file);
$hostname = eregi_replace('.rrd', '', $hostname);
list($host, $port) = split('_', $hostname, 2);
list($host, $port) = explode('_', $hostname, 2);
$rrd_filenames[] = $rrddir.'/'.$file;
$rrd_list[$i]['filename'] = $rrddir.'/'.$file;
$rrd_list[$i]['descr'] = $host.':'.$port;
@@ -25,7 +25,7 @@ if ($handle = opendir($rrddir)) {
foreach ($files as $id => $file) {
$hostname = eregi_replace('app-shoutcast-'.$app['app_id'].'-', '', $file);
$hostname = eregi_replace('.rrd', '', $hostname);
list($host, $port) = split('_', $hostname, 2);
list($host, $port) = explode('_', $hostname, 2);
$rrd_filenames[] = $rrddir.'/'.$file;
$rrd_list[$i]['filename'] = $rrddir.'/'.$file;
$rrd_list[$i]['descr'] = $host.':'.$port;
+1 -1
View File
@@ -42,7 +42,7 @@ if (isset($total) && $total === true) {
foreach ($files as $id => $file) {
$hostname = eregi_replace('app-shoutcast-'.$app['app_id'].'-', '', $file);
$hostname = eregi_replace('.rrd', '', $hostname);
list($host, $port) = split('_', $hostname, 2);
list($host, $port) = explode('_', $hostname, 2);
$graphs = array(
'shoutcast_bits' => 'Traffic Statistics - '.$host.' (Port: '.$port.')',
'shoutcast_stats' => 'Shoutcast Statistics - '.$host.' (Port: '.$port.')',
+1 -1
View File
@@ -307,7 +307,7 @@ echo '
</div>';
$api_urls = get_config_like_name('alert.transports.api.%.');
foreach ($api_urls as $api_url) {
$api_split = split('\.', $api_url['config_name']);
$api_split = explode('.', $api_url['config_name']);
$api_method = $api_split[3];
echo '<div class="form-group has-feedback" id="'.$api_url['config_id'].'">
<label for="api_url" class="col-sm-4 control-label">API URL ('.$api_method.') </label>
@@ -15,7 +15,7 @@ foreach ($servers as $item => $server) {
if (!empty($server)) {
$data = explode(';', $server);
list($host, $port) = split(':', $data['0'], 2);
list($host, $port) = explode(':', $data['0'], 2);
$bitrate = $data['1'];
$traf_in = $data['2'];
$traf_out = $data['3'];
+1 -1
View File
@@ -2,5 +2,5 @@
$serial = snmp_get($device, 'productSerialNum.0', '-Ovq', 'NETAPP-MIB');
$hardware = snmp_get($device, 'productModel.0', '-Ovq', 'NETAPP-MIB');
list($version,) = split(':', snmp_get($device, 'productVersion.0', '-Ovq', 'NETAPP-MIB'));
list($version,) = explode(':', snmp_get($device, 'productVersion.0', '-Ovq', 'NETAPP-MIB'));
$version = str_replace('NetApp Release ', '', $version);
+1 -1
View File
@@ -2,5 +2,5 @@
$sensor_value = trim(str_replace('"', '', snmp_get($device, $sensor['sensor_oid'], '-OUqnv', '')));
preg_match_all('/([0-9]+C)+/', $sensor_value, $temps);
list(,$index) = split('\.', $sensor['sensor_index']);
list(,$index) = explode('.', $sensor['sensor_index']);
$sensor_value = $temps[0][$index];
+1 -1
View File
@@ -6,7 +6,7 @@ if ($service['service_ip']) { $resolver = $service['service_ip']; } else {
$check = shell_exec($config['nagios_plugins'] . "/check_dns -H ".$nsquery." -s ".$resolver);
list($check, $time) = split("\|", $check);
list($check, $time) = explode("|", $check);
if(strstr($check, "DNS OK: ")) {
$status = '1';
+1 -1
View File
@@ -10,7 +10,7 @@ if( $service['service_ip'] ) {
$cmd .= " ".$service['service_param'];
$check = shell_exec($cmd);
list($check, $time) = split("\|", $check);
list($check, $time) = explode("|", $check);
if(strstr($check, "OK - Domain")) {
$status = '1';
+1 -1
View File
@@ -2,7 +2,7 @@
$check = shell_exec($config['nagios_plugins'] . "/check_ftp -H ".$service['hostname']);
list($check, $time) = split("\|", $check);
list($check, $time) = explode("|", $check);
if(strstr($check, "FTP OK - ")) {
$status = '1';
+1 -1
View File
@@ -2,7 +2,7 @@
$check = shell_exec($config['nagios_plugins'] . "/check_http -H ".$service['hostname']." ".$service['service_param']);
list($check, $time) = split("\|", $check);
list($check, $time) = explode("|", $check);
if(strstr($check, "HTTP OK")) {
$status = '1';
+1 -1
View File
@@ -1,7 +1,7 @@
<?php
$check = shell_exec($config['nagios_plugins'] . "/check_icmp ".($service['service_ip'] ? $service['service_ip'] : $service['hostname']));
list($check, $time) = split("\|", $check);
list($check, $time) = explode("|", $check);
if(strstr($check, "OK - ")) {
$status = '1';
+1 -1
View File
@@ -2,7 +2,7 @@
$check = shell_exec($config['nagios_plugins'] . "/check_imap -H ".$service['hostname']);
list($check, $time) = split("\|", $check);
list($check, $time) = explode("|", $check);
if(strstr($check, "IMAP OK - ")) {
$status = '1';
+1 -1
View File
@@ -2,7 +2,7 @@
$check = shell_exec($config['nagios_plugins'] . "/check_ircd -H ".$service['hostname']." ".$service['service_param']);
list($check, $time) = split("\|", $check);
list($check, $time) = explode("|", $check);
if (strstr($check, "IRCD ok")) {
$status = '1';
+1 -1
View File
@@ -5,7 +5,7 @@ if ($service['service_param']) { $dbname = $service['service_param']; } else { $
$check = shell_exec($config['nagios_plugins'] . "/check_mysql -H ".$service['hostname']." ".$dbname);
list($check, $time) = split("\|", $check);
list($check, $time) = explode("|", $check);
if(strstr($check, "Uptime:") || strstr($check, "MySQL OK")) {
$status = '1';
+1 -1
View File
@@ -2,7 +2,7 @@
$check = shell_exec($config['nagios_plugins'] . "/check_ntp -H ".$service['hostname']." ".$service['service_param']);
list($check, $time) = split("\|", $check);
list($check, $time) = explode("|", $check);
if(strstr($check, "NTP OK")) {
$status = '1';
+1 -1
View File
@@ -2,7 +2,7 @@
$check = shell_exec($config['nagios_plugins'] . "/check_pop -H ".$service['hostname']);
list($check, $time) = split("\|", $check);
list($check, $time) = explode("|", $check);
if(strstr($check, "POP OK - ")) {
$status = '1';
+1 -1
View File
@@ -2,7 +2,7 @@
$check = shell_exec($config['nagios_plugins'] . "/check_simap -H ".$service['hostname']);
list($check, $time) = split("\|", $check);
list($check, $time) = explode("|", $check);
if(strstr($check, "SIMAP OK")) {
$status = '1';
+1 -1
View File
@@ -2,7 +2,7 @@
$check = shell_exec($config['nagios_plugins'] . "/check_smtp -H ".$service['hostname']);
list($check, $time) = split("\|", $check);
list($check, $time) = explode("|", $check);
if(strstr($check, "SMTP OK")) {
$status = '1';
+1 -1
View File
@@ -2,7 +2,7 @@
$check = shell_exec($config['nagios_plugins'] . "/check_spop -H ".$service['hostname']);
list($check, $time) = split("\|", $check);
list($check, $time) = explode("|", $check);
if(strstr($check, "SPOP OK")) {
$status = '1';
+1 -1
View File
@@ -2,7 +2,7 @@
$check = shell_exec($config['nagios_plugins'] . "/check_ssh -H ".$service['hostname']." ".$service['service_param']);
list($check, $time) = split("\|", $check);
list($check, $time) = explode("|", $check);
if(strstr($check, "SSH OK")) {
$status = '1';
+1 -1
View File
@@ -4,7 +4,7 @@ if($service['service_port']) { $port = $service['service_port']; } else { $port
$check = shell_exec($config['nagios_plugins'] . "/check_telnet -H ".$service['hostname']." -p ".$port);
list($check, $time) = split("\|", $check);
list($check, $time) = explode("|", $check);
if(strstr($check, "TCP OK - ")) {
$status = '1';
+2 -2
View File
@@ -58,9 +58,9 @@ function process_syslog($entry, $update) {
// $entry['program'] = $matches['program'];
// }
// unset($matches);
if (strstr($entry[msg], '%')) {
if (strstr($entry['msg'], '%')) {
$entry['msg'] = preg_replace('/^%(.+?):\ /', '\\1||', $entry['msg']);
list(,$entry[msg]) = split(': %', $entry['msg']);
list(,$entry['msg']) = explode(': %', $entry['msg']);
$entry['msg'] = '%'.$entry['msg'];
$entry['msg'] = preg_replace('/^%(.+?):\ /', '\\1||', $entry['msg']);
}
+1 -1
View File
@@ -63,7 +63,7 @@
$servers = file($config);
$data = array();
foreach ($servers as $item=>$server) {
list($host, $port) = split(":", $server, 2);
list($host, $port) = explode(":", $server, 2);
array_push($data, get_data(trim($host), trim($port)));
}
return $data;