diff --git a/doc/Installation/Installation-(RHEL-CentOS).md b/doc/Installation/Installation-(RHEL-CentOS).md index c42749ed37..a1aafc2b86 100644 --- a/doc/Installation/Installation-(RHEL-CentOS).md +++ b/doc/Installation/Installation-(RHEL-CentOS).md @@ -54,7 +54,7 @@ Note if not using HTTPd (Apache): RHEL requires `httpd` to be installed regardle ### Adding the librenms-user ### useradd librenms -d /opt/librenms -M -r - usermod -a -G librenms www-data + usermod -a -G librenms apache ### Using HTTPd (Apache2) ### diff --git a/doc/Support/FAQ.md b/doc/Support/FAQ.md index 5a0acfcce8..ef6d6232e9 100644 --- a/doc/Support/FAQ.md +++ b/doc/Support/FAQ.md @@ -11,6 +11,7 @@ - [How do I debug pages not loading correctly?](#faq7) - [How do I debug the discovery process?](#faq11) - [How do I debug the poller process?](#faq12) + - [Why do I get a lot apache or rrdtool zombies in my process list?](#faq14) ### Developing - [How do I add support for a new OS?](#faq8) @@ -82,11 +83,16 @@ You will then have a two options in the footer of the website - Show SQL Debug a #### How do I debug the discovery process? -Please see the (Discovery Support)[http://docs.librenms.org/Support/Discovery Support] document for further details. +Please see the [Discovery Support](http://docs.librenms.org/Support/Discovery Support) document for further details. #### How do I debug the poller process? -Please see the (Poller Support)[http://docs.librenms.org/Support/Poller Support] document for further details. +Please see the [Poller Support](http://docs.librenms.org/Support/Poller Support) document for further details. + +#### Why do I get a lot apache or rrdtool zombies in my process list? + +If this is related to your web service for LibreNMS then this has been tracked down to an issue within php which the developers aren't fixing. We have implemented a work around which means you +shouldn't be seeing this. If you are, please report this in [issue 443](https://github.com/librenms/librenms/issues/443). #### How do I add support for a new OS? @@ -153,4 +159,4 @@ If you want to pull any new updates provided by f0o's branch then whilst you are ```bash git pull f0o issue-1337 -``` \ No newline at end of file +``` diff --git a/html/css/dark.css b/html/css/dark.css index 09ebc4856d..980bf42e86 100644 --- a/html/css/dark.css +++ b/html/css/dark.css @@ -14,6 +14,10 @@ color: #357ebd; } +.fa-col-danger { + color: #e30613; +} + .twitter-typeahead .tt-hint { border-color: #000 !important; } @@ -93,4 +97,4 @@ @keyframes pace-spinner { 0% { transform: rotate(0deg); transform: rotate(0deg); } 100% { transform: rotate(360deg); transform: rotate(360deg); } -} \ No newline at end of file +} diff --git a/html/css/light.css b/html/css/light.css index 93f69e3363..f224ff3cb5 100644 --- a/html/css/light.css +++ b/html/css/light.css @@ -14,6 +14,10 @@ color: #357ebd; } +.fa-col-danger { + color: #e30613; +} + .pace { -webkit-pointer-events: none; pointer-events: none; @@ -89,4 +93,4 @@ @keyframes pace-spinner { 0% { transform: rotate(0deg); transform: rotate(0deg); } 100% { transform: rotate(360deg); transform: rotate(360deg); } -} \ No newline at end of file +} diff --git a/html/css/mono.css b/html/css/mono.css index f96590e4b4..e76425cd34 100644 --- a/html/css/mono.css +++ b/html/css/mono.css @@ -14,6 +14,10 @@ color: #357ebd; } +.fa-col-danger { + color: #e30613; +} + .twitter-typeahead .tt-hint { border-color: #000 !important; } @@ -93,4 +97,4 @@ @keyframes pace-spinner { 0% { transform: rotate(0deg); transform: rotate(0deg); } 100% { transform: rotate(360deg); transform: rotate(360deg); } -} \ No newline at end of file +} diff --git a/html/includes/graphs/device/netstat_ip_forward.inc.php b/html/includes/graphs/device/netstat_ip_forward.inc.php new file mode 100644 index 0000000000..30402f5c9c --- /dev/null +++ b/html/includes/graphs/device/netstat_ip_forward.inc.php @@ -0,0 +1,23 @@ + array()); + +$i=0; +foreach ($stats as $stat => $array) +{ + $i++; + $rrd_list[$i]['filename'] = $rrd_filename; + $rrd_list[$i]['descr'] = str_replace("ip", "", $stat); + $rrd_list[$i]['ds'] = $stat; +} + +$colours='mixed'; + +$scale_min = "0"; +$nototal = 1; +$simple_rrd = TRUE; + +include("includes/graphs/generic_multi_line.inc.php"); + diff --git a/html/includes/print-menubar.php b/html/includes/print-menubar.php index 88725879cb..13d09f951a 100644 --- a/html/includes/print-menubar.php +++ b/html/includes/print-menubar.php @@ -185,7 +185,8 @@ if ($_SESSION['userlevel'] >= '10') echo('
  • Add Service
  • -
  • Delete Service
  • '); +
  • Edit Service
  • +
  • Delete Service
  • '); } ?> diff --git a/html/includes/print-service-add.inc.php b/html/includes/print-service-add.inc.php new file mode 100644 index 0000000000..9f5b6e6290 --- /dev/null +++ b/html/includes/print-service-add.inc.php @@ -0,0 +1,54 @@ +Add Service +
    +
    +
    + + +
    + +
    +
    +
    +
    +
    + +
    + +
    +
    +
    +
    +
    + +
    + +
    +
    +
    +
    +
    + +
    + +
    +
    +
    +
    +
    + +
    + +
    +
    +
    +
    + +
    +
    "); \ No newline at end of file diff --git a/html/includes/print-service-edit.inc.php b/html/includes/print-service-edit.inc.php new file mode 100644 index 0000000000..0954649d6d --- /dev/null +++ b/html/includes/print-service-edit.inc.php @@ -0,0 +1,35 @@ +Edit Service +
    + + +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    + +
    +
    "); + +} \ No newline at end of file diff --git a/html/includes/service-add.inc.php b/html/includes/service-add.inc.php new file mode 100644 index 0000000000..3bc9eca630 --- /dev/null +++ b/html/includes/service-add.inc.php @@ -0,0 +1,10 @@ +"; +} \ No newline at end of file diff --git a/html/includes/service-edit.inc.php b/html/includes/service-edit.inc.php new file mode 100644 index 0000000000..9d725dd4dd --- /dev/null +++ b/html/includes/service-edit.inc.php @@ -0,0 +1,5 @@ +Add Service -
    -
    -
    - - -
    - -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    - -
    -
    "); + echo "
    +
    "; + + require_once "includes/print-service-add.inc.php"; + + echo "
    +
    "; + } diff --git a/html/pages/delsrv.inc.php b/html/pages/delsrv.inc.php index 177bebb2a5..e9aafdd1e4 100644 --- a/html/pages/delsrv.inc.php +++ b/html/pages/delsrv.inc.php @@ -37,7 +37,7 @@ if ($_SESSION['userlevel'] < '5')
    - + "); diff --git a/html/pages/device/edit.inc.php b/html/pages/device/edit.inc.php index cf16b2f2de..8c0f076cb0 100644 --- a/html/pages/device/edit.inc.php +++ b/html/pages/device/edit.inc.php @@ -25,7 +25,7 @@ if ($_SESSION['userlevel'] < '7') $panes['alert-rules'] = 'Alert Rules'; $panes['modules'] = 'Modules'; - if ($config['enable_services']) + if ($config['show_services']) { $panes['services'] = 'Services'; } diff --git a/html/pages/device/edit/services.inc.php b/html/pages/device/edit/services.inc.php index 083b36b97e..e6969a9fe9 100644 --- a/html/pages/device/edit/services.inc.php +++ b/html/pages/device/edit/services.inc.php @@ -1,101 +1,85 @@ '); +if (is_admin() === TRUE || is_read() === TRUE) { -if ($_POST['addsrv']) { - if ($_SESSION['userlevel'] >= '10') { - include("includes/service-add.inc.php"); - } -} - -if ($_POST['delsrv']) { - if ($_SESSION['userlevel'] >= '10') { - include("includes/service-delete.inc.php"); - } -} - -if ($handle = opendir($config['install_dir'] . "/includes/services/")) -{ - while (false !== ($file = readdir($handle))) - { - if ($file != "." && $file != ".." && !strstr($file, ".")) - { - $servicesform .= ""; + if ($_POST['addsrv']) { + if ($_SESSION['userlevel'] >= '10') { + include("includes/service-add.inc.php"); + } } - } - closedir($handle); -} + if ($_POST['delsrv']) { + if ($_SESSION['userlevel'] >= '10') { + include("includes/service-delete.inc.php"); + } + } -foreach (dbFetchRows("SELECT * FROM `devices` ORDER BY `hostname`") as $dev); -{ - $devicesform .= ""; -} + if ($_POST['confirm-editsrv']) { + echo "yeah"; + if ($_SESSION['userlevel'] >= '10') { + include("includes/service-edit.inc.php"); + } + } -if ($updated) { print_message("Device Settings Saved"); } + if ($handle = opendir($config['install_dir'] . "/includes/services/")) { + while (false !== ($file = readdir($handle))) { + if ($file != "." && $file != ".." && !strstr($file, ".")) { + $servicesform .= ""; + } + } -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 .= ""; - } -} + closedir($handle); + } -if($existform) -{ - echo('
    '); - echo(" + $dev = device_by_id_cache($device['device_id']); + $devicesform = ""; -

    Remove Service

    + if ($updated) { + print_message("Device Settings Saved"); + } -
    - - - - - - -
    - Type - - -
    - - -
    "); + 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('
    '); -} + echo '
    '; -echo('
    '); + if ($existform) { + echo '
    '; + if ($_POST['editsrv'] == "yes") { + include_once "includes/print-service-edit.inc.php"; + } else { + echo " +

    Edit / Delete Service

    +
    +
    +
    + +
    + +
    +
    +
    +
    + +
    +
    +
    +
    "; + } -echo(" -

    Add Service

    + echo '
    '; + } -
    - - - - - - -
    - Type - - -
    - - -
    -
    "); + echo '
    '; -?> + require_once "includes/print-service-add.inc.php"; + +} else { + include("includes/error-no-perm.inc.php"); +} \ No newline at end of file diff --git a/html/pages/device/graphs/netstats_ip_forward.inc.php b/html/pages/device/graphs/netstats_ip_forward.inc.php new file mode 100644 index 0000000000..cc728ac77c --- /dev/null +++ b/html/pages/device/graphs/netstats_ip_forward.inc.php @@ -0,0 +1,11 @@ + "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) + { + $servicesform .= ""; + } + + if ($updated) { print_message("Service updated!"); } + + if ($_POST['editsrv'] == 'yes') { + + require_once "includes/print-service-edit.inc.php"; + + } else { + + echo(" +

    Delete Service

    +
    + +
    +
    + +
    + +
    +
    +
    +
    + +
    +
    "); + } + +} diff --git a/includes/alerts.inc.php b/includes/alerts.inc.php index ea6b94b733..8392daa191 100644 --- a/includes/alerts.inc.php +++ b/includes/alerts.inc.php @@ -299,8 +299,12 @@ function GetContacts($results) { } } if( is_numeric($result["device_id"]) ) { - $tmpa = dbFetchRow("SELECT sysContact FROM devices WHERE device_id = ?",array($result["device_id"])); - $contacts[$tmpa["sysContact"]] = "NOC"; + if( dbFetchCell("SELECT attrib_value FROM devices_attribs WHERE attrib_type = 'override_sysContact_bool' AND device_id = ?",array($result["device_id"])) === "1" ) { + $tmpa = dbFetchCell("SELECT attrib_value FROM devices_attribs WHERE attrib_type = 'override_sysContact_string' AND device_id = ?",array($result["device_id"])); + } else { + $tmpa = dbFetchCell("SELECT sysContact FROM devices WHERE device_id = ?",array($result["device_id"])); + } + $contacts[$tmpa] = "NOC"; $tmpa = dbFetchRows("SELECT user_id FROM devices_perms WHERE access_level >= 0 AND device_id = ?", array($result["device_id"])); foreach( $tmpa as $tmp ) { $uids[$tmp['user_id']] = $tmp['user_id']; diff --git a/includes/common.php b/includes/common.php index 71da214be2..d14395e7f5 100644 --- a/includes/common.php +++ b/includes/common.php @@ -561,12 +561,35 @@ function is_valid_hostname($hostname) return ctype_alnum(str_replace('_','',str_replace('-','',str_replace('.','',$hostname)))); } -function add_service($device, $service, $descr) -{ - $insert = array('device_id' => $device['device_id'], 'service_ip' => $device['hostname'], 'service_type' => $service, - 'service_changed' => array('UNIX_TIMESTAMP(NOW())'), 'service_desc' => $descr, 'service_param' => "", 'service_ignore' => "0"); +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)); - echo dbInsert($insert, 'services'); } ?> diff --git a/includes/definitions.inc.php b/includes/definitions.inc.php index a50f276f08..aa7f89ee51 100644 --- a/includes/definitions.inc.php +++ b/includes/definitions.inc.php @@ -1560,6 +1560,10 @@ $config['graph_types']['device']['netstat_snmp_pkt']['section'] = 'netstats'; $config['graph_types']['device']['netstat_snmp_pkt']['order'] = '0'; $config['graph_types']['device']['netstat_snmp_pkt']['descr'] = 'SNMP Packet Type Statistics'; +$config['graph_types']['device']['netstat_ip_forward']['section'] = 'netstats'; +$config['graph_types']['device']['netstat_ip_forward']['order'] = '0'; +$config['graph_types']['device']['netstat_ip_forward']['descr'] = 'IP Forwarding Statistics'; + $config['graph_types']['device']['netstat_tcp']['section'] = 'netstats'; $config['graph_types']['device']['netstat_tcp']['order'] = '0'; $config['graph_types']['device']['netstat_tcp']['descr'] = 'TCP Statistics'; diff --git a/includes/discovery/fanspeeds/mikrotik.inc.php b/includes/discovery/fanspeeds/mikrotik.inc.php new file mode 100644 index 0000000000..d980e8158a --- /dev/null +++ b/includes/discovery/fanspeeds/mikrotik.inc.php @@ -0,0 +1,30 @@ + 0) + { + discover_sensor($valid['sensor'], 'fanspeed', $device, $oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $fanspeed); + } + } + } +} + +?> diff --git a/includes/discovery/temperatures/mikrotik.inc.php b/includes/discovery/temperatures/mikrotik.inc.php new file mode 100644 index 0000000000..2784dd36bb --- /dev/null +++ b/includes/discovery/temperatures/mikrotik.inc.php @@ -0,0 +1,28 @@ + diff --git a/includes/discovery/voltages/mikrotik.inc.php b/includes/discovery/voltages/mikrotik.inc.php new file mode 100644 index 0000000000..272a030cb8 --- /dev/null +++ b/includes/discovery/voltages/mikrotik.inc.php @@ -0,0 +1,28 @@ + diff --git a/includes/functions.php b/includes/functions.php index 1e40729b8d..9b2a848101 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -229,9 +229,13 @@ function renamehost($id, $new, $source = 'console') // FIXME does not check if destination exists! $host = dbFetchCell("SELECT `hostname` FROM `devices` WHERE `device_id` = ?", array($id)); - rename($config['rrd_dir']."/$host",$config['rrd_dir']."/$new"); - dbUpdate(array('hostname' => $new), 'devices', 'device_id=?', array($id)); - log_event("Hostname changed -> $new ($source)", $id, 'system'); + if (rename($config['rrd_dir']."/$host",$config['rrd_dir']."/$new") === TRUE) { + dbUpdate(array('hostname' => $new), 'devices', 'device_id=?', array($id)); + log_event("Hostname changed -> $new ($source)", $id, 'system'); + } else { + echo "Renaming of $host failed\n"; + log_event("Renaming of $host failed", $id, 'system'); + } } function delete_device($id) diff --git a/includes/polling/netstats-ip_forward.inc.php b/includes/polling/netstats-ip_forward.inc.php new file mode 100644 index 0000000000..eee982d463 --- /dev/null +++ b/includes/polling/netstats-ip_forward.inc.php @@ -0,0 +1,47 @@ +