From 0d6cfec589b394288f8359a8290daef0510f99e7 Mon Sep 17 00:00:00 2001 From: Aaron Daniels Date: Tue, 15 Mar 2016 22:16:08 +1000 Subject: [PATCH] Nagios Services - Moved check-services.php to a poller module - Added performance data collection to the poller - Centralised DB functions to includes/services.inc.php - Created add/edit/delete functions off the device, services page - Removed legacy edit/delete interfaces. - Moved and modified check.inc scripts - Documentation Updates - Modified services table --- check-services.php | 59 ---- doc/Extensions/Services.md | 46 ++-- html/includes/forms/create-service.inc.php | 47 ++++ html/includes/forms/delete-service.inc.php | 31 +++ html/includes/forms/parse-service.inc.php | 33 +++ html/includes/graphs/device/service.inc.php | 97 +++++++ html/includes/modal/delete_service.inc.php | 75 +++++ html/includes/modal/new_service.inc.php | 145 ++++++++++ html/includes/print-menubar.php | 18 +- html/includes/print-service-edit.inc.php | 36 --- html/includes/print-service.inc.php | 77 ------ html/includes/service-add.inc.php | 10 - html/includes/service-delete.inc.php | 10 - html/includes/service-edit.inc.php | 5 - html/pages/addsrv.inc.php | 4 +- html/pages/delsrv.inc.php | 48 ---- html/pages/device/edit/services.inc.php | 73 +---- html/pages/device/overview.inc.php | 8 +- html/pages/device/overview/services.inc.php | 79 +++--- html/pages/device/services.inc.php | 113 +++++--- html/pages/editsrv.inc.php | 52 ---- html/pages/services.inc.php | 152 ++++++----- includes/common.php | 32 --- includes/defaults.inc.php | 1 + includes/discovery/services.inc.php | 2 +- includes/polling/services.inc.php | 19 ++ includes/services.inc.php | 258 +++++++++++++++++- .../{dns/check.inc => check_dns.inc.php} | 12 +- includes/services/check_domain_expire.inc.php | 10 + includes/services/check_ftp.inc.php | 3 + includes/services/check_http.inc.php | 3 + includes/services/check_icmp.inc.php | 30 ++ includes/services/check_imap.inc.php | 3 + includes/services/check_ircd.inc.php | 3 + includes/services/check_mysql.inc.php | 5 + includes/services/check_ntp.inc.php | 2 + includes/services/check_pop.inc.php | 2 + includes/services/check_simap.inc.php | 2 + includes/services/check_smtp.inc.php | 2 + includes/services/check_spop.inc.php | 2 + includes/services/check_ssh.inc.php | 2 + includes/services/check_ssl_cert.inc.php | 8 + includes/services/check_telnet.inc.php | 3 + includes/services/domain_expire/check.inc | 21 -- includes/services/ftp/check.inc | 13 - includes/services/http/check.inc | 13 - includes/services/icmp/check.inc | 12 - includes/services/imap/check.inc | 13 - includes/services/ircd/check.inc | 13 - includes/services/mysql/check.inc | 16 -- includes/services/ntp/check.inc | 13 - includes/services/pop/check.inc | 13 - includes/services/simap/check.inc | 13 - includes/services/smtp/check.inc | 13 - includes/services/spop/check.inc | 13 - includes/services/ssh/check.inc | 13 - includes/services/ssl_cert/check.inc | 20 -- includes/services/telnet/check.inc | 15 - librenms.cron | 1 - librenms.nonroot.cron | 1 - sql-schema/107.sql | 2 + 61 files changed, 1039 insertions(+), 801 deletions(-) delete mode 100755 check-services.php create mode 100644 html/includes/forms/create-service.inc.php create mode 100644 html/includes/forms/delete-service.inc.php create mode 100644 html/includes/forms/parse-service.inc.php create mode 100644 html/includes/graphs/device/service.inc.php create mode 100644 html/includes/modal/delete_service.inc.php create mode 100644 html/includes/modal/new_service.inc.php delete mode 100644 html/includes/print-service-edit.inc.php delete mode 100644 html/includes/print-service.inc.php delete mode 100644 html/includes/service-add.inc.php delete mode 100644 html/includes/service-delete.inc.php delete mode 100644 html/includes/service-edit.inc.php delete mode 100644 html/pages/delsrv.inc.php delete mode 100644 html/pages/editsrv.inc.php create mode 100644 includes/polling/services.inc.php rename includes/services/{dns/check.inc => check_dns.inc.php} (55%) create mode 100644 includes/services/check_domain_expire.inc.php create mode 100644 includes/services/check_ftp.inc.php create mode 100644 includes/services/check_http.inc.php create mode 100644 includes/services/check_icmp.inc.php create mode 100644 includes/services/check_imap.inc.php create mode 100644 includes/services/check_ircd.inc.php create mode 100644 includes/services/check_mysql.inc.php create mode 100644 includes/services/check_ntp.inc.php create mode 100644 includes/services/check_pop.inc.php create mode 100644 includes/services/check_simap.inc.php create mode 100644 includes/services/check_smtp.inc.php create mode 100644 includes/services/check_spop.inc.php create mode 100644 includes/services/check_ssh.inc.php create mode 100644 includes/services/check_ssl_cert.inc.php create mode 100644 includes/services/check_telnet.inc.php delete mode 100644 includes/services/domain_expire/check.inc delete mode 100644 includes/services/ftp/check.inc delete mode 100644 includes/services/http/check.inc delete mode 100644 includes/services/icmp/check.inc delete mode 100644 includes/services/imap/check.inc delete mode 100644 includes/services/ircd/check.inc delete mode 100644 includes/services/mysql/check.inc delete mode 100644 includes/services/ntp/check.inc delete mode 100644 includes/services/pop/check.inc delete mode 100644 includes/services/simap/check.inc delete mode 100644 includes/services/smtp/check.inc delete mode 100644 includes/services/spop/check.inc delete mode 100644 includes/services/ssh/check.inc delete mode 100644 includes/services/ssl_cert/check.inc delete mode 100644 includes/services/telnet/check.inc create mode 100644 sql-schema/107.sql diff --git a/check-services.php b/check-services.php deleted file mode 100755 index a39171a3d..000000000 --- a/check-services.php +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/env php - - * @copyright (C) 2006 - 2012 Adam Armstrong - */ - -chdir(dirname($argv[0])); - -require 'includes/defaults.inc.php'; -require 'config.php'; -require 'includes/definitions.inc.php'; -require 'includes/functions.php'; - -foreach (dbFetchRows('SELECT * FROM `devices` AS D, `services` AS S WHERE S.device_id = D.device_id ORDER by D.device_id DESC') as $service) { - if ($service['status'] = '1') { - unset($check, $service_status, $time, $status); - $service_status = $service['service_status']; - $service_type = strtolower($service['service_type']); - $service_param = $service['service_param']; - $checker_script = $config['install_dir'].'/includes/services/'.$service_type.'/check.inc'; - - if (is_file($checker_script)) { - include $checker_script; - } - else { - $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) = explode("|", $check); - if(stristr($check, "ok -")) { - $status = 1; - } - else { - $status = 0; - } - } - - $update = array(); - - if ($service_status != $status) { - $update['service_changed'] = time(); - } - $update = array_merge(array('service_status' => $status, 'service_message' => $check, 'service_checked' => time()), $update); - dbUpdate($update, 'services', '`service_id` = ?', array($service['service_id'])); - unset($update); - } - else { - $status = '0'; - }//end if - -} //end foreach diff --git a/doc/Extensions/Services.md b/doc/Extensions/Services.md index fe2608552..fa7237cc9 100644 --- a/doc/Extensions/Services.md +++ b/doc/Extensions/Services.md @@ -22,31 +22,29 @@ $config['nagios_plugins'] = "/usr/lib/nagios/plugins"; This will point LibreNMS at the location of the nagios plugins - please ensure that any plugins you use are set to executable. -Finally, you now need to add check-services.php to the current cron file (/etc/cron.d/librenms typically) like: -```bash -*/5 * * * * librenms /opt/librenms/check-services.php >> /dev/null 2>&1 -``` +Now you can add services via the main Services link in the navbar, or via the 'Add Service' link within the device, services page. -Now you can add services via the main Services link in the navbar, or via the Services link within the device page. +## Performance data -> **Please note that at present the service checks will only return the status and the response from the check -no graphs will be generated. ** +By default, the poller module will collect all performance data that the check script returns and display each datasource on a separate graph. +However for some modules it would be better if some of this information was consolidated on a single graph. +An example is the ICMP check. This check returns: Round Trip Average (rta), Round Trip Min (rtmin) and Round Trip Max (rtmax). +These have been combined onto a single graph. -## Supported checks +If you find a check script that would benefit from having some datasources graphed together, please log an issue on GitHub with the debug information from the poller, and let us know which DS's should go together. Example below: -- ftp -- icmp -- spop -- ssh -- ssl_cert -- http -- domain_expire -- mysql -- imap -- dns -- telnet -- smtp -- pop -- simap -- ntp -- ircd + Nagios Service - 26 + Request: /usr/lib/nagios/plugins/check_icmp localhost + Perf Data - DS: rta, Value: 0.016, UOM: ms + Perf Data - DS: pl, Value: 0, UOM: % + Perf Data - DS: rtmax, Value: 0.044, UOM: ms + Perf Data - DS: rtmin, Value: 0.009, UOM: ms + Response: OK - localhost: rta 0.016ms, lost 0% + Service DS: { + "rta": "ms", + "pl": "%", + "rtmax": "ms", + "rtmin": "ms" + } + OK u:0.00 s:0.00 r:40.67 + RRD[update /opt/librenms/rrd/localhost/services-26.rrd N:0.016:0:0.044:0.009] diff --git a/html/includes/forms/create-service.inc.php b/html/includes/forms/create-service.inc.php new file mode 100644 index 000000000..e2e20a170 --- /dev/null +++ b/html/includes/forms/create-service.inc.php @@ -0,0 +1,47 @@ + + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or (at your + * option) any later version. Please see LICENSE.txt at the top level of + * the source code distribution for details. + */ + +if (is_admin() === false) { + die('ERROR: You need to be admin'); +} + +$service_id = $_POST['service_id']; +$type = mres($_POST['stype']); +$desc = mres($_POST['desc']); +$ip = mres($_POST['ip']); +$param = mres($_POST['param']); +$device_id = mres($_POST['device_id']); + +if (is_numeric($service_id) && $service_id > 0) { + // Need to edit. + $update = array('service_desc' => $desc, 'service_ip' => $ip, 'service_param' => $param); + if (service_edit($update, $service_id)) { + $status = array('status' =>0, 'message' => 'Modified Service: '.$service_id.': '.$type.''); + } + else { + $status = array('status' =>1, 'message' => 'ERROR: Failed to modify service: '.$service_id.''); + } +} +else { + // Need to add. + $service_id = service_add($device_id, $type, $desc, $ip, $param); + if ($service_id == false) { + $status = array('status' =>1, 'message' => 'ERROR: Failed to add Service: '.$type.''); + } + else { + $status = array('status' =>0, 'message' => 'Added Service: '.$service_id.': '.$type.''); + } +} +header('Content-Type: application/json'); +echo _json_encode($status); \ No newline at end of file diff --git a/html/includes/forms/delete-service.inc.php b/html/includes/forms/delete-service.inc.php new file mode 100644 index 000000000..fc1f1e8ee --- /dev/null +++ b/html/includes/forms/delete-service.inc.php @@ -0,0 +1,31 @@ + + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or (at your + * option) any later version. Please see LICENSE.txt at the top level of + * the source code distribution for details. + */ + +if (is_admin() === false) { + $status = array('status' =>1, 'message' => 'ERROR: You need to be admin to delete services'); +} +else { + if (!is_numeric($_POST['service_id'])) { + $status = array('status' =>1, 'message' => 'No Service has been selected'); + } + else { + if (service_delete($_POST['service_id'])) { + $status = array('status' =>0, 'message' => 'Service: '.$_POST['service_id'].', has been deleted.'); + } + else { + $status = array('status' =>1, 'message' => 'Service: '.$_POST['service_id'].', has NOT been deleted.'); + } + } +} +header('Content-Type: application/json'); +echo _json_encode($status); diff --git a/html/includes/forms/parse-service.inc.php b/html/includes/forms/parse-service.inc.php new file mode 100644 index 000000000..f5a1bbb5e --- /dev/null +++ b/html/includes/forms/parse-service.inc.php @@ -0,0 +1,33 @@ + + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or (at your + * option) any later version. Please see LICENSE.txt at the top level of + * the source code distribution for details. + */ + +if (is_admin() === false) { + die('ERROR: You need to be admin'); +} + +$service_id = $_POST['service_id']; + +if (is_numeric($service_id) && $service_id > 0) { + $service = service_get(null, $service_id); + + $output = array( + 'stype' => $service[0]['service_type'], + 'ip' => $service[0]['service_ip'], + 'desc' => $service[0]['service_desc'], + 'param' => $service[0]['service_param'] + ); + + header('Content-Type: application/json'); + echo _json_encode($output); +} diff --git a/html/includes/graphs/device/service.inc.php b/html/includes/graphs/device/service.inc.php new file mode 100644 index 000000000..1cbe99e1b --- /dev/null +++ b/html/includes/graphs/device/service.inc.php @@ -0,0 +1,97 @@ + + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or (at your + * option) any later version. Please see LICENSE.txt at the top level of + * the source code distribution for details. + */ + +// Get a list of all services for this device. +require_once '../includes/services.inc.php'; +$services = service_get($device['device_id']); + +// Determine which key is the service we want to show. +if (isset($vars['service'])) { + // Service is set, find its key. + foreach ($services as $key => $service) { + if ($service['service_id'] == $vars['service']) { + // We have found the service we want. + $vars['service'] = $key; + } + } +} +else { + // No service set, set the first one. + if (isset($services[0])) { + $vars['service'] = 0; + } +} + +// We know our service. build the filename. +$filename = "services-".$services[$vars['service']]['service_id'].".rrd"; +$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename ($filename); + +// if we have a script for this check, use it. +$check_script = $config['install_dir'].'/includes/services/check_'.strtolower($services[$vars['service']]['service_type']).'.inc.php'; +if (is_file($check_script)) { + include $check_script; + + // If we have a replacement DS use it. + if (isset($check_ds)) { + $services[$vars['service']]['service_ds'] = $check_ds; + } +} + +include "includes/graphs/common.inc.php"; +$rrd_options .= " -l 0 -E "; +$rrd_options .= " COMMENT:' Now Avg Max\\n'"; +$rrd_additions = ""; + +// Remove encoded characters +$services[$vars['service']]['service_ds'] = htmlspecialchars_decode($services[$vars['service']]['service_ds']); + +if ($services[$vars['service']]['service_ds'] != "") { + $graphinfo = json_decode($services[$vars['service']]['service_ds'],TRUE); + + // Do we have a DS set + if (!isset($graphinfo[$vars['ds']])) { + foreach ($graphinfo as $k => $v) { + // Select a DS to display. + $vars['ds'] = $k; + } + } + + // Need: DS name, Label + $ds = $vars['ds']; + $label = $graphinfo[$vars['ds']]; + + if (file_exists($rrd_filename)) { + + if (isset($check_graph)) { + // We have a graph definition, use it. + $rrd_additions .= $check_graph[$ds]; + } + else { + // Build the graph ourselves + $color = $config['graph_colours']['mixed'][2]; + + $rrd_additions .= " DEF:DS=" . $rrd_filename . ":".$ds.":AVERAGE "; + $rrd_additions .= " AREA:DS#" . $color . ":'" . str_pad(substr(ucfirst($ds)." (".$label.")",0,15),15) . "' "; + $rrd_additions .= " GPRINT:DS:LAST:%5.2lf%s "; + $rrd_additions .= " GPRINT:DS:AVERAGE:%5.2lf%s "; + $rrd_additions .= " GPRINT:DS:MAX:%5.2lf%s\\\l "; + } + } +} + +if ($rrd_additions == "") { + // We didn't add any data points. +} +else { + $rrd_options .= $rrd_additions; +} diff --git a/html/includes/modal/delete_service.inc.php b/html/includes/modal/delete_service.inc.php new file mode 100644 index 000000000..ca2188909 --- /dev/null +++ b/html/includes/modal/delete_service.inc.php @@ -0,0 +1,75 @@ + + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or (at your + * option) any later version. Please see LICENSE.txt at the top level of + * the source code distribution for details. + */ + +if(is_admin() === false) { + die('ERROR: You need to be admin'); +} + +?> + + + + diff --git a/html/includes/modal/new_service.inc.php b/html/includes/modal/new_service.inc.php new file mode 100644 index 000000000..e1b973c74 --- /dev/null +++ b/html/includes/modal/new_service.inc.php @@ -0,0 +1,145 @@ + + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or (at your + * option) any later version. Please see LICENSE.txt at the top level of + * the source code distribution for details. + */ + +if(is_admin() !== false) { + + // Build the types list. + if ($handle = opendir($config['nagios_plugins'])) { + while (false !== ($file = readdir($handle))) { + if ($file != '.' && $file != '..' && !strstr($file, '.') && strstr($file, 'check_')) { + list(,$check_name) = explode('_',$file,2); + $stype .= ""; + } + } + closedir($handle); + } + +?> + + + + += 5) { @@ -219,18 +219,20 @@ if ($config['show_services']) { -
  • Alerts ('.$service_alerts.')
  • '); +if (($service_status[0] > 0) || ($service_status[2] > 0)) { + echo ' '; + if ($service_status[2] > 0) { + echo '
  • Warning ('.$service_status[2].')
  • '; + } + if ($service_status[0] > 0) { + echo '
  • Critical ('.$service_status[0].')
  • '; + } } if ($_SESSION['userlevel'] >= '10') { echo(' -
  • Add Service
  • -
  • Edit Service
  • -
  • Delete Service
  • '); +
  • Add Service
  • '); } ?> diff --git a/html/includes/print-service-edit.inc.php b/html/includes/print-service-edit.inc.php deleted file mode 100644 index 7b5c1bafb..000000000 --- a/html/includes/print-service-edit.inc.php +++ /dev/null @@ -1,36 +0,0 @@ -Edit Service -
    - - -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    - This may be required based on the service check. -
    -
    - -
    -
    "; -}//end if diff --git a/html/includes/print-service.inc.php b/html/includes/print-service.inc.php deleted file mode 100644 index 0cac82cc0..000000000 --- a/html/includes/print-service.inc.php +++ /dev/null @@ -1,77 +0,0 @@ -$service_type"; -} -else if ($service[service_status] == '1') { - $status = "$service_type"; -} -else if ($service[service_status] == '2') { - $status = "$service_type"; -} - -$message = trim($service['service_message']); -$message = str_replace("\n", '
    ', $message); - -$desc = trim($service['service_desc']); -$desc = str_replace("\n", '
    ', $desc); - -$since = (time() - $service['service_changed']); -$since = formatUptime($since); - -if ($service['service_checked']) { - $checked = (time() - $service['service_checked']); - $checked = formatUptime($checked); -} -else { - $checked = 'Never'; -} - -$mini_url = 'graph.php?id='.$service['service_id'].'&type=service_availability&from='.$config['time']['day'].'&to='.$config['time']['now'].'&width=80&height=20&bg=efefef'; - -$popup = "onmouseover=\"return overlib('
    ".$device['hostname'].' - '.$service['service_type']; -$popup .= "
    "; -$popup .= "', RIGHT".$config['overlib_defaults'].');" onmouseout="return nd();"'; - -echo " - "; - -if ($device_id) { - if (!$samehost) { - echo "".generate_device_link($device).''; - } - else { - echo ''; - } -} - -echo " - - $status - - - $since - - - $message - - - $desc - - - $checked - - "; - -$i++; diff --git a/html/includes/service-add.inc.php b/html/includes/service-add.inc.php deleted file mode 100644 index cf1433b27..000000000 --- a/html/includes/service-add.inc.php +++ /dev/null @@ -1,10 +0,0 @@ -'; -} diff --git a/html/includes/service-delete.inc.php b/html/includes/service-delete.inc.php deleted file mode 100644 index 9ea114dc5..000000000 --- a/html/includes/service-delete.inc.php +++ /dev/null @@ -1,10 +0,0 @@ -'; -} diff --git a/html/includes/service-edit.inc.php b/html/includes/service-edit.inc.php deleted file mode 100644 index 9d725dd4d..000000000 --- a/html/includes/service-edit.inc.php +++ /dev/null @@ -1,5 +0,0 @@ -= '10') { $updated = '1'; - // FIXME should call add_service (needs more parameters) - $service_id = dbInsert(array('device_id' => $_POST['device'], 'service_ip' => $_POST['ip'], 'service_type' => $_POST['type'], 'service_desc' => $_POST['descr'], 'service_param' => $_POST['params'], 'service_ignore' => '0', 'service_status' => '0', 'service_checked' => '0', 'service_changed' => '0', 'service_message' => 'New check', 'service_disabled' => '0'), 'services'); - + $service_id = service_add($_POST['device'], $_POST['type'], $_POST['descr'], $_POST['ip'], $_POST['params'], 0); if ($service_id) { $message .= $message_break.'Service added ('.$service_id.')!'; $message_break .= '
    '; diff --git a/html/pages/delsrv.inc.php b/html/pages/delsrv.inc.php deleted file mode 100644 index 444b96037..000000000 --- a/html/pages/delsrv.inc.php +++ /dev/null @@ -1,48 +0,0 @@ - '5') { - include 'includes/service-delete.inc.php'; - } - } - - foreach (dbFetchRows('SELECT * FROM `services` AS S, `devices` AS D WHERE S.device_id = D.device_id ORDER BY hostname') as $device) { - $service_description = ''; - - if (!empty($device['service_desc'])) { - $service_description = ' - ' . substr($device['service_desc'], 0, 30); - } - - $servicesform .= "'; - - } - - if ($updated) { - print_message('Service Deleted!'); - } - - echo " -

    Delete Service

    -
    - -
    -
    - -
    - -
    -
    -
    -
    - -
    -
    "; -}//end if diff --git a/html/pages/device/edit/services.inc.php b/html/pages/device/edit/services.inc.php index 1f2bc1d30..7ca26baa0 100644 --- a/html/pages/device/edit/services.inc.php +++ b/html/pages/device/edit/services.inc.php @@ -3,30 +3,24 @@ if (is_admin() === true || is_read() === true) { if ($_POST['addsrv']) { if ($_SESSION['userlevel'] >= '10') { - include 'includes/service-add.inc.php'; - } - } + $updated = '1'; - if ($_POST['delsrv']) { - if ($_SESSION['userlevel'] >= '10') { - include 'includes/service-delete.inc.php'; - } - } - - if ($_POST['confirm-editsrv']) { - echo 'yeah'; - if ($_SESSION['userlevel'] >= '10') { - include 'includes/service-edit.inc.php'; - } - } - - if ($handle = opendir($config['install_dir'].'/includes/services/')) { - while (false !== ($file = readdir($handle))) { - if ($file != '.' && $file != '..' && !strstr($file, '.')) { - $servicesform .= ""; + $service_id = service_add($_POST['device'], $_POST['type'], $_POST['descr'], $_POST['ip'], $_POST['params'], 0); + if ($service_id) { + $message .= $message_break.'Service added ('.$service_id.')!'; + $message_break .= '
    '; } } + } + // Build the types list. + if ($handle = opendir($config['nagios_plugins'])) { + while (false !== ($file = readdir($handle))) { + if ($file != '.' && $file != '..' && !strstr($file, '.') && strstr($file, 'check_')) { + list(,$check_name) = explode('_',$file,2); + $servicesform .= ""; + } + } closedir($handle); } @@ -37,45 +31,6 @@ if (is_admin() === true || is_read() === true) { print_message('Device Settings Saved'); } - if (dbFetchCell('SELECT COUNT(*) from `services` WHERE `device_id` = ?', array($device['device_id'])) > '0') { - $i = '1'; - foreach (dbFetchRows('select * from services WHERE device_id = ? ORDER BY service_type', array($device['device_id'])) as $service) { - $existform .= "'; - } - } - - echo '
    '; - - if ($existform) { - echo '
    '; - if ($_POST['editsrv'] == 'yes') { - include_once 'includes/print-service-edit.inc.php'; - } - else { - echo " -

    Edit / Delete Service

    -
    -
    -
    - -
    - -
    -
    -
    -
    - -
    -
    -
    -
    "; - } - - echo '
    '; - } - echo '
    '; include_once 'includes/print-service-add.inc.php'; diff --git a/html/pages/device/overview.inc.php b/html/pages/device/overview.inc.php index 78356de17..c07f94837 100644 --- a/html/pages/device/overview.inc.php +++ b/html/pages/device/overview.inc.php @@ -7,12 +7,10 @@ $ports['up'] = dbFetchCell("SELECT COUNT(*) FROM `ports` WHERE device_id = $ports['down'] = dbFetchCell("SELECT COUNT(*) FROM `ports` WHERE device_id = ? AND `ifOperStatus` = 'down' AND `ifAdminStatus` = 'up'", array($device['device_id'])); $ports['disabled'] = dbFetchCell("SELECT COUNT(*) FROM `ports` WHERE device_id = ? AND `ifAdminStatus` = 'down'", array($device['device_id'])); -$services['total'] = dbFetchCell("SELECT COUNT(service_id) FROM `services` WHERE `device_id` = ?", array($device['device_id'])); -$services['up'] = dbFetchCell("SELECT COUNT(service_id) FROM `services` WHERE `device_id` = ? AND `service_status` = '1' AND `service_ignore` ='0'", array($device['device_id'])); -$services['down'] = dbFetchCell("SELECT COUNT(service_id) FROM `services` WHERE `device_id` = ? AND `service_status` = '0' AND `service_ignore` = '0'", array($device['device_id'])); -$services['disabled'] = dbFetchCell("SELECT COUNT(service_id) FROM `services` WHERE `device_id` = ? AND `service_ignore` = '1'", array($device['device_id'])); +$services = service_status($device['device_id']); +$services['total'] = array_sum($services); -if ($services['down']) { +if ($services[0]) { $services_colour = $warn_colour_a; } else { diff --git a/html/pages/device/overview/services.inc.php b/html/pages/device/overview/services.inc.php index 7be48403a..ed5b5023b 100644 --- a/html/pages/device/overview/services.inc.php +++ b/html/pages/device/overview/services.inc.php @@ -1,49 +1,44 @@ '; - echo '
    -
    -
    -
    '; - echo " Services"; - echo '
    - '; - - echo " - - - - - - - -
    $services[total] $services[up] $services[down] $services[disabled]
    "; - - foreach (dbFetchRows('SELECT * FROM services WHERE device_id = ? ORDER BY service_type', array($device['device_id'])) as $data) { - if ($data['service_status'] == '0' && $data['service_ignore'] == '1') { - $status = 'grey'; - } - - if ($data['service_status'] == '1' && $data['service_ignore'] == '1') { - $status = 'green'; - } - - if ($data['service_status'] == '0' && $data['service_ignore'] == '0') { + // Build the string. + foreach (service_get ($device['device_id']) as $data) { + if ($data['service_status'] == '1') { + // Ok + $status = 'green'; + } elseif ($data['service_status'] == '0') { + // Critical $status = 'red'; + } elseif ($data['service_status'] == '2') { + // Warning + $status = 'red'; + } else { + // Unknown + $status = 'grey'; } - - if ($data['service_status'] == '1' && $data['service_ignore'] == '0') { - $status = 'blue'; - } - - echo "$break".strtolower($data['service_type']).''; + $string .= $break . '' . strtolower ($data['service_type']) . ''; $break = ', '; } - - echo '
    '; - echo '
    '; - echo '
    '; - echo '
    '; - echo '
    '; -}//end if + ?> +
    +
    +
    +
    + Services +
    + + + + + + + + + + +
    +
    +
    +
    +Services » "; $menu_options = array( @@ -29,43 +38,85 @@ foreach ($menu_options as $option => $text) { $sep = ' | '; } - unset($sep); - +echo ''; print_optionbar_end(); - -if (dbFetchCell('SELECT COUNT(service_id) FROM `services` WHERE device_id = ?', array($device['device_id'])) > '0') { - echo "
    "; - $i = '1'; - foreach (dbFetchRows('SELECT * FROM `services` WHERE `device_id` = ? ORDER BY `service_type`', array($device['device_id'])) as $service) { - include 'includes/print-service.inc.php'; - +?> +
    + '0') { + // Loop over each service, pulling out the details. +?> +
    +Ok"; + } + elseif ($service['service_status'] == 2) { + $status = "Warning"; + } + elseif ($service['service_status'] == 0) { + $status = "Critical"; + } + else { + $status = "Unknown"; + } +?> + + '; + $graphs = json_decode($service['service_ds'],TRUE); + foreach ($graphs as $k => $v) { + $graph_array['device'] = $device['device_id']; + $graph_array['type'] = 'device_service'; + $graph_array['service'] = $service['service_id']; + $graph_array['ds'] = $k; +?> +
    + +
    +'; +?> + + +
    +
    +
    +
    +
    +
    + + +
    +
    +
    +
    +
    +
    +
    '; - - include 'includes/print-graphrow.inc.php'; - - echo '
    + +
    No Services
    + diff --git a/html/pages/editsrv.inc.php b/html/pages/editsrv.inc.php deleted file mode 100644 index 02cd59b5d..000000000 --- a/html/pages/editsrv.inc.php +++ /dev/null @@ -1,52 +0,0 @@ - '5') { - include 'includes/service-edit.inc.php'; - } - } - - foreach (dbFetchRows('SELECT * FROM `services` AS S, `devices` AS D WHERE S.device_id = D.device_id ORDER BY hostname') as $device) { - $service_description = ''; - - if (!empty($device['service_desc'])) { - $service_description = ' - ' . substr($device['service_desc'], 0, 30); - } - - $servicesform .= "'; - } - - if ($updated) { - print_message('Service updated!'); - } - - if ($_POST['editsrv'] == 'yes') { - include_once 'includes/print-service-edit.inc.php'; - } - else { - echo " -

    Delete Service

    -
    - -
    -
    - -
    - -
    -
    -
    -
    - -
    -
    "; - }//end if -}//end if diff --git a/html/pages/services.inc.php b/html/pages/services.inc.php index aab52c3d8..646491360 100644 --- a/html/pages/services.inc.php +++ b/html/pages/services.inc.php @@ -9,36 +9,21 @@ echo "Services » "; $menu_options = array( 'basic' => 'Basic', ); - -$sql_param = array(); -if (isset($vars['state'])) { - if ($vars['state'] == 'up') { - $state = '1'; - } - elseif ($vars['state'] == 'down') { - $state = '0'; - } -} - -if ($vars['state']) { - $where .= " AND service_status= ? AND service_disabled='0' AND `service_ignore`='0'"; - $sql_param[] = $state; -} - -if ($vars['disabled']) { - $where .= ' AND service_disabled= ?'; - $sql_param[] = $vars['disabled']; -} - -if ($vars['ignore']) { - $where .= ' AND `service_ignore`= ?'; - $sql_param[] = $vars['ignore']; -} - if (!$vars['view']) { $vars['view'] = 'basic'; } +$status_options = array( + 'all' => 'All', + 'ok' => 'Ok', + 'warning' => 'Warning', + 'critical' => 'Critical', +); +if (!$vars['state']) { + $vars['state'] = 'all'; +} + +// The menu option - on the left $sep = ''; foreach ($menu_options as $option => $text) { if (empty($vars['view'])) { @@ -57,21 +42,60 @@ foreach ($menu_options as $option => $text) { $sep = ' | '; } - unset($sep); +// The status option - on the right +echo '
    '; +$sep = ''; +foreach ($status_options as $option => $text) { + if (empty($vars['state'])) { + $vars['state'] = $option; + } + + echo $sep; + if ($vars['state'] == $option) { + echo ""; + } + + echo generate_link($text, $vars, array('state' => $option)); + if ($vars['state'] == $option) { + echo ''; + } + + $sep = ' | '; +} +unset($sep); +echo '
    '; print_optionbar_end(); -echo '
    - - - - - - - - - '; +$sql_param = array(); +if (isset($vars['state'])) { + if ($vars['state'] == 'ok') { + $state = '1'; + } + elseif ($vars['state'] == 'critical') { + $state = '0'; + } + elseif ($vars['state'] == 'warning') { + $state = '2'; + } +} +if (isset($state)) { + $where .= " AND service_status= ? AND service_disabled='0' AND `service_ignore`='0'"; + $sql_param[] = $state; +} + +?> +
    +
    DeviceServiceChangedMessageDescriptionLast Check
    + + + + + + + += '5') { $host_sql = 'SELECT * FROM devices AS D, services AS S WHERE D.device_id = S.device_id GROUP BY D.hostname ORDER BY D.hostname'; $host_par = array(); @@ -85,6 +109,7 @@ $shift = 1; foreach (dbFetchRows($host_sql, $host_par) as $device) { $device_id = $device['device_id']; $device_hostname = $device['hostname']; + $devlink = generate_device_link($device); if ($shift == 1) { array_unshift($sql_param, $device_id); $shift = 0; @@ -94,39 +119,28 @@ foreach (dbFetchRows($host_sql, $host_par) as $device) { } foreach (dbFetchRows("SELECT * FROM `services` WHERE `device_id` = ? $where", $sql_param) as $service) { - include 'includes/print-service.inc.php'; - - // $samehost = 1; - if ($vars['view'] == 'details') { - $graph_array['height'] = '100'; - $graph_array['width'] = '215'; - $graph_array['to'] = $config['time']['now']; - $graph_array['id'] = $service['service_id']; - $graph_array['type'] = 'service_availability'; - - $periods = array( - 'day', - 'week', - 'month', - 'year', - ); - - echo ''; - }//end if + if ($service['service_status'] == '0') { + $status = "".$service['service_type'].""; + } + else if ($service['service_status'] == '1') { + $status = "".$service['service_type'].""; + } + else { + $status = "".$service['service_type'].""; + } +?> + + + + + + + + -'; +?> +
    DeviceServiceChangedMessageDescription
    '; - - foreach ($periods as $period) { - $graph_array['from'] = $$period; - $graph_array_zoom = $graph_array; - $graph_array_zoom['height'] = '150'; - $graph_array_zoom['width'] = '400'; - echo overlib_link('', generate_lazy_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL); - } - - echo '
    +
    diff --git a/includes/common.php b/includes/common.php index e7ba9ca4b..36f2a5dc2 100644 --- a/includes/common.php +++ b/includes/common.php @@ -585,38 +585,6 @@ function is_valid_hostname($hostname) { return ctype_alnum(str_replace('_','',str_replace('-','',str_replace('.','',$hostname)))); } -function add_service($device, $service, $descr, $service_ip, $service_param = "", $service_ignore = 0) { - - if (!is_array($device)) { - $device = device_by_id_cache($device); - } - - if (empty($service_ip)) { - $service_ip = $device['hostname']; - } - - $insert = array('device_id' => $device['device_id'], 'service_ip' => $service_ip, 'service_type' => $service, - 'service_changed' => array('UNIX_TIMESTAMP(NOW())'), 'service_desc' => $descr, 'service_param' => $service_param, 'service_ignore' => $service_ignore); - - return dbInsert($insert, 'services'); -} - -function edit_service($service, $descr, $service_ip, $service_param = "", $service_ignore = 0) { - - if (!is_numeric($service)) { - return false; - } - - $update = array('service_ip' => $service_ip, - 'service_changed' => array('UNIX_TIMESTAMP(NOW())'), - 'service_desc' => $descr, - 'service_param' => $service_param, - 'service_ignore' => $service_ignore); - return dbUpdate($update, 'services', '`service_id`=?', array($service)); - -} - - /* * convenience function - please use this instead of 'if ($debug) { echo ...; }' */ diff --git a/includes/defaults.inc.php b/includes/defaults.inc.php index 2f01dc6bc..6123a3b5b 100644 --- a/includes/defaults.inc.php +++ b/includes/defaults.inc.php @@ -715,6 +715,7 @@ $config['poller_modules']['cisco-voice'] = 1; $config['poller_modules']['cisco-cbqos'] = 1; $config['poller_modules']['stp'] = 1; $config['poller_modules']['cisco-otv'] = 1; +$config['poller_modules']['services'] = 1; // List of discovery modules. Need to be in this array to be // considered for execution. diff --git a/includes/discovery/services.inc.php b/includes/discovery/services.inc.php index 3f3e3c988..ffabf806a 100644 --- a/includes/discovery/services.inc.php +++ b/includes/discovery/services.inc.php @@ -24,7 +24,7 @@ if ($config['discover_services']) { $split_oid = explode('.', $oid); $tcp_port = $split_oid[(count($split_oid) - 6)]; if ($known_services[$tcp_port]) { - discover_service($device, $known_services[$tcp_port]); + service_discover($device, $known_services[$tcp_port]); } } } diff --git a/includes/polling/services.inc.php b/includes/polling/services.inc.php new file mode 100644 index 000000000..cef82e181 --- /dev/null +++ b/includes/polling/services.inc.php @@ -0,0 +1,19 @@ + + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or (at your + * option) any later version. Please see LICENSE.txt at the top level of + * the source code distribution for details. + */ + +foreach (dbFetchRows('SELECT * FROM `devices` AS D, `services` AS S WHERE S.device_id = D.device_id AND D.device_id = ? ORDER by D.device_id DESC', array($device['device_id'])) as $service) { + // Run the polling function + service_poll($service); + +} //end foreach diff --git a/includes/services.inc.php b/includes/services.inc.php index 185055018..c1e8cdce1 100644 --- a/includes/services.inc.php +++ b/includes/services.inc.php @@ -1,13 +1,265 @@ 0, 1 => 0, 2 => 0); + // Rebuild the array in a more convenient method + foreach ($result as $v) { + $service_count[$v['service_status']] = $v['count']; + } + + d_echo("Service Count by Status: ".print_r($service_count,TRUE)."\n"); + return $service_count; +} + +function service_add($device, $type, $desc, $ip='localhost', $param = "", $ignore = 0) { + + if (!is_array($device)) { + $device = device_by_id_cache($device); + } + + if (empty($ip)) { + $ip = $device['hostname']; + } + + $insert = array('device_id' => $device['device_id'], 'service_ip' => $ip, 'service_type' => $type, 'service_changed' => array('UNIX_TIMESTAMP(NOW())'), 'service_desc' => $desc, 'service_param' => $param, 'service_ignore' => $ignore, 'service_status' => 3, 'service_message' => 'Service not yet checked'); + return dbInsert($insert, 'services'); +} + +function service_get($device = null, $service = null) { + $sql_query = "SELECT `service_id`,`device_id`,`service_ip`,`service_type`,`service_desc`,`service_param`,`service_ignore`,`service_status`,`service_changed`,`service_message`,`service_disabled`,`service_ds` FROM `services` WHERE"; + $sql_param = array(); + $add = 0; + + d_echo("SQL Query: ".$sql_query); + if (!is_null($service)) { + // Add a service filter to the SQL query. + $sql_query .= " `service_id` = ? AND"; + $sql_param[] = $service; + $add++; + } + if (!is_null($device)) { + // Add a device filter to the SQL query. + $sql_query .= " `device_id` = ? AND"; + $sql_param[] = $device; + $add++; + } + + if ($add == 0) { + // No filters, remove " WHERE" -6 + $sql_query = substr($sql_query, 0, strlen($sql_query)-6); + } + else { + // We have filters, remove " AND" -4 + $sql_query = substr($sql_query, 0, strlen($sql_query)-4); + } + d_echo("SQL Query: ".$sql_query); + + // $service is not null, get only what we want. + $services = dbFetchRows($sql_query, $sql_param); + d_echo("Service Array: ".print_r($services,TRUE)."\n"); + + return $services; +} + +function service_edit($update=array(), $service=null) { + if (!is_numeric($service)) { + return false; + } + + return dbUpdate($update, 'services', '`service_id`=?', array($service)); +} + +function service_delete($service=null) { + if (!is_numeric($service)) { + return false; + } + + return dbDelete('services', '`service_id` = ?', array($service)); +} + +function service_discover($device, $service) { if (! dbFetchCell('SELECT COUNT(service_id) FROM `services` WHERE `service_type`= ? AND `device_id` = ?', array($service, $device['device_id']))) { - add_service($device, $service, "(Auto discovered) $service"); + service_add($device, $service, "(Auto discovered) $service"); log_event('Autodiscovered service: type '.mres($service), $device, 'service'); echo '+'; } - echo "$service "; +} +function service_poll($service) { + global $config, $device; + $update = array(); + $old_status = $service['service_status']; + + // if we have a script for this check, use it. + $check_script = $config['install_dir'].'/includes/services/check_'.strtolower($service['service_type']).'.inc.php'; + if (is_file($check_script)) { + include $check_script; + } + + // If we do not have a cmd from the check script, build one. + if (!isset($check_cmd)) { + $check_cmd = $config['nagios_plugins'] . "/check_" . $service['service_type'] . " -H " . ($service['service_ip'] ? $service['service_ip'] : $service['hostname']); + $check_cmd .= " " . $service['service_param']; + } + + // Some debugging + d_echo("\nNagios Service - ".$service['service_id']."\n"); + d_echo("Request: ".$check_cmd."\n"); + list($status, $msg, $perf) = service_check($check_cmd); + d_echo("Response: ".$msg."\n"); + + // TODO: Use proper Nagios service status. 0=Ok,1=Warning,2=Critical,Else=Unknown + // Not now because we dont want to break existing alerting rules. + if ($status == 0) { + // Nagios 0 = Libre 1 - Ok + $new_status = 1; + } + elseif ($status == 1) { + // Nagios 1 = Libre 2 - Warning + $new_status = 2; + } + elseif ($status == 2) { + // Nagios 2 = Libre 0 - Critical + $new_status = 0; + } + else { + // Unknown + $new_status = 2; + } + + // If we have performance data we will store it. + if (count($perf) > 0) { + // Yes, We have perf data. + $filename = "services-".$service['service_id'].".rrd"; + $rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename ($filename); + + // Set the DS in the DB if it is blank. + $DS = array(); + foreach ($perf as $k => $v) { + $DS[$k] = $v['uom']; + } + d_echo("Service DS: "._json_encode($DS)."\n"); + if ($service['service_ds'] == "") { + $update['service_ds'] = json_encode($DS); + } + + // Create the RRD + if (!file_exists ($rrd_filename)) { + $rra = ""; + foreach ($perf as $k => $v) { + if ($v['uom'] == 'c') { + // This is a counter, create the DS as such + $rra .= " DS:".$k.":COUNTER:600:0:U"; + } + else { + // Not a counter, must be a gauge + $rra .= " DS:".$k.":GAUGE:600:0:U"; + } + } + rrdtool_create ($rrd_filename, $rra . $config['rrd_rra']); + } + + // Update RRD + $rrd = array(); + foreach ($perf as $k => $v) { + $rrd[$k] = $v['value']; + } + rrdtool_update ($rrd_filename, $rrd); + } + + if ($old_status != $new_status) { + // Status has changed, update. + $update['service_changed'] = time(); + $update['service_status'] = $new_status; + $update['service_message'] = $msg; + } + + if (count($update) > 0) { + service_edit($update,$service['service_id']); + } + + return true; +} + +function service_check($command) { + // This array is used to test for valid UOM's to be used for graphing. + // Valid values from: https://nagios-plugins.org/doc/guidelines.html#AEN200 + // Note: This array must be decend from 2 char to 1 char so that the search works correctly. + $valid_uom = array ('us', 'ms', 'KB', 'MB', 'GB', 'TB', 'c', 's', '%', 'B'); + + // Make our command safe. + $command = escapeshellcmd($command); + + // Run the command and return its response. + exec($command, $response_array, $status); + + // exec returns an array, lets implode it back to a string. + $response_string = implode("\n", $response_array); + + // Split out the response and the performance data. + list($response, $perf) = explode("|", $response_string); + + // Split each performance metric + $perf_arr = explode(' ', $perf); + + // Create an array for our metrics. + $metrics = array(); + + // Loop through the perf string extracting our metric data + foreach ($perf_arr as $string) { + // Separate the DS and value: DS=value + list ($ds,$values) = explode('=', trim($string)); + + // Keep the first value, discard the others. + list($value,,,) = explode(';', trim($values)); + $value = trim($value); + + // Set an empty uom + $uom = ''; + + // is the UOM valid - https://nagios-plugins.org/doc/guidelines.html#AEN200 + foreach ($valid_uom as $v) { + if ((strlen($value)-strlen($v)) === strpos($value,$v)) { + // Yes, store and strip it off the value + $uom = $v; + $value = substr($value, 0, -strlen($v)); + break; + } + } + + if ($ds != "") { + // We have a DS. Add an entry to the array. + d_echo("Perf Data - DS: ".$ds.", Value: ".$value.", UOM: ".$uom."\n"); + $metrics[$ds] = array ('value'=>$value, 'uom'=>$uom); + } + else { + // No DS. Don't add an entry to the array. + d_echo("Perf Data - None.\n"); + } + } + + return array ($status, $response, $metrics); } diff --git a/includes/services/dns/check.inc b/includes/services/check_dns.inc.php similarity index 55% rename from includes/services/dns/check.inc rename to includes/services/check_dns.inc.php index ed6fba724..bfdbf4b9e 100644 --- a/includes/services/dns/check.inc +++ b/includes/services/check_dns.inc.php @@ -4,14 +4,4 @@ if ($service['service_param']) { $nsquery = $service['service_param']; } else { $nsquery = "localhost"; } if ($service['service_ip']) { $resolver = $service['service_ip']; } else { $resolver = $service['hostname']; } -$check = shell_exec($config['nagios_plugins'] . "/check_dns -H ".$nsquery." -s ".$resolver); - -list($check, $time) = explode("|", $check); - -if(strstr($check, "DNS OK: ")) { - $status = '1'; -} else { - $status = '0'; -} - -?> +$check_cmd = $config['nagios_plugins'] . "/check_dns -H ".$nsquery." -s ".$resolver; diff --git a/includes/services/check_domain_expire.inc.php b/includes/services/check_domain_expire.inc.php new file mode 100644 index 000000000..8c722fe52 --- /dev/null +++ b/includes/services/check_domain_expire.inc.php @@ -0,0 +1,10 @@ + diff --git a/includes/services/ftp/check.inc b/includes/services/ftp/check.inc deleted file mode 100644 index 1ac1a4df9..000000000 --- a/includes/services/ftp/check.inc +++ /dev/null @@ -1,13 +0,0 @@ - diff --git a/includes/services/http/check.inc b/includes/services/http/check.inc deleted file mode 100644 index 5c9067e8c..000000000 --- a/includes/services/http/check.inc +++ /dev/null @@ -1,13 +0,0 @@ - diff --git a/includes/services/icmp/check.inc b/includes/services/icmp/check.inc deleted file mode 100644 index 9d96d502c..000000000 --- a/includes/services/icmp/check.inc +++ /dev/null @@ -1,12 +0,0 @@ - diff --git a/includes/services/imap/check.inc b/includes/services/imap/check.inc deleted file mode 100644 index 11916d542..000000000 --- a/includes/services/imap/check.inc +++ /dev/null @@ -1,13 +0,0 @@ - diff --git a/includes/services/ircd/check.inc b/includes/services/ircd/check.inc deleted file mode 100644 index db8e8613f..000000000 --- a/includes/services/ircd/check.inc +++ /dev/null @@ -1,13 +0,0 @@ - diff --git a/includes/services/mysql/check.inc b/includes/services/mysql/check.inc deleted file mode 100644 index 6aa94bc72..000000000 --- a/includes/services/mysql/check.inc +++ /dev/null @@ -1,16 +0,0 @@ - diff --git a/includes/services/ntp/check.inc b/includes/services/ntp/check.inc deleted file mode 100644 index 7b3b77649..000000000 --- a/includes/services/ntp/check.inc +++ /dev/null @@ -1,13 +0,0 @@ - diff --git a/includes/services/pop/check.inc b/includes/services/pop/check.inc deleted file mode 100644 index f31ca2506..000000000 --- a/includes/services/pop/check.inc +++ /dev/null @@ -1,13 +0,0 @@ - diff --git a/includes/services/simap/check.inc b/includes/services/simap/check.inc deleted file mode 100644 index 47d86208b..000000000 --- a/includes/services/simap/check.inc +++ /dev/null @@ -1,13 +0,0 @@ - diff --git a/includes/services/smtp/check.inc b/includes/services/smtp/check.inc deleted file mode 100644 index 7152410e1..000000000 --- a/includes/services/smtp/check.inc +++ /dev/null @@ -1,13 +0,0 @@ - diff --git a/includes/services/spop/check.inc b/includes/services/spop/check.inc deleted file mode 100644 index a3bc24955..000000000 --- a/includes/services/spop/check.inc +++ /dev/null @@ -1,13 +0,0 @@ - diff --git a/includes/services/ssh/check.inc b/includes/services/ssh/check.inc deleted file mode 100644 index 2ae81cdc9..000000000 --- a/includes/services/ssh/check.inc +++ /dev/null @@ -1,13 +0,0 @@ - diff --git a/includes/services/ssl_cert/check.inc b/includes/services/ssl_cert/check.inc deleted file mode 100644 index 3c21078dd..000000000 --- a/includes/services/ssl_cert/check.inc +++ /dev/null @@ -1,20 +0,0 @@ - diff --git a/includes/services/telnet/check.inc b/includes/services/telnet/check.inc deleted file mode 100644 index 8f81a1644..000000000 --- a/includes/services/telnet/check.inc +++ /dev/null @@ -1,15 +0,0 @@ - diff --git a/librenms.cron b/librenms.cron index f5ba93740..f03f5316d 100644 --- a/librenms.cron +++ b/librenms.cron @@ -5,4 +5,3 @@ */5 * * * * root /opt/librenms/cronic /opt/librenms/poller-wrapper.py 16 15 0 * * * root /opt/librenms/daily.sh >> /dev/null 2>&1 * * * * * root /opt/librenms/alerts.php >> /dev/null 2>&1 -*/5 * * * * root /opt/librenms/check-services.php >> /dev/null 2>&1 diff --git a/librenms.nonroot.cron b/librenms.nonroot.cron index 5f55ad775..3c83bf8b1 100644 --- a/librenms.nonroot.cron +++ b/librenms.nonroot.cron @@ -5,4 +5,3 @@ */5 * * * * librenms /opt/librenms/cronic /opt/librenms/poller-wrapper.py 16 15 0 * * * librenms /opt/librenms/daily.sh >> /dev/null 2>&1 * * * * * librenms /opt/librenms/alerts.php >> /dev/null 2>&1 -*/5 * * * * librenms /opt/librenms/check-services.php >> /dev/null 2>&1 diff --git a/sql-schema/107.sql b/sql-schema/107.sql new file mode 100644 index 000000000..3556225ab --- /dev/null +++ b/sql-schema/107.sql @@ -0,0 +1,2 @@ +ALTER TABLE `services` ADD `service_ds` VARCHAR(255) NOT NULL COMMENT 'Data Sources available for this service'; +ALTER TABLE `services` DROP `service_checked`;