diff --git a/html/images/icons/alerts.png b/html/images/icons/alerts.png new file mode 100755 index 000000000..f64025639 Binary files /dev/null and b/html/images/icons/alerts.png differ diff --git a/html/images/icons/greyscale/alerts.png b/html/images/icons/greyscale/alerts.png new file mode 100644 index 000000000..38ca23453 Binary files /dev/null and b/html/images/icons/greyscale/alerts.png differ diff --git a/html/includes/print-interface-adsl.inc.php b/html/includes/print-interface-adsl.inc.php index 36e9c5984..d9ab07b70 100644 --- a/html/includes/print-interface-adsl.inc.php +++ b/html/includes/print-interface-adsl.inc.php @@ -53,7 +53,6 @@ $interface['graph_type'] = "port_bits"; echo(generate_port_link($interface, "", $interface['graph_type'])); - echo(""); echo("".formatRates($interface['adslAturChanCurrTxRate']) . "/". formatRates($interface['adslAtucChanCurrTxRate'])); echo("
"); @@ -142,4 +141,4 @@ if ($graph_type && is_file($graph_file)) } -?> +?> \ No newline at end of file diff --git a/html/includes/print-interface.inc.php b/html/includes/print-interface.inc.php index e2344d13f..54f85132d 100644 --- a/html/includes/print-interface.inc.php +++ b/html/includes/print-interface.inc.php @@ -1,9 +1,5 @@ "); -#print_r($interface); -#echo(""); - # This file prints a table row for each interface $interface['device_id'] = $device['device_id']; @@ -32,12 +28,12 @@ echo(""); echo(" " . generate_port_link($interface, $interface['ifIndex'] . ". ".$interface['label']) . " $error_img $mac -
".$interface['ifAlias'].""); if ($interface['ifAlias']) { echo("
"); } unset ($break); + if ($port_details) { $ipdata = mysql_query("SELECT * FROM `ipv4_addresses` WHERE `interface_id` = '" . $interface['interface_id'] . "'"); @@ -271,7 +267,6 @@ if ($graph_type && is_file($graph_file)) # onmouseout=\"return nd();\"> "); echo(""); - } -?> +?> \ No newline at end of file diff --git a/html/pages/addhost.inc.php b/html/pages/addhost.inc.php index 4a10f3c76..56f9839b1 100644 --- a/html/pages/addhost.inc.php +++ b/html/pages/addhost.inc.php @@ -29,7 +29,7 @@ if ($_POST['hostname'] && $_POST['community']) ?> -
+

Devices will be checked for Ping and SNMP reachability before being probed. Only devices with recognised OSes will be added.

diff --git a/html/pages/bills.inc.php b/html/pages/bills.inc.php index c8e1d3149..d4515cad5 100644 --- a/html/pages/bills.inc.php +++ b/html/pages/bills.inc.php @@ -1,4 +1,4 @@ - "7") + { + $override_sysContact_bool = mres($_POST['override_sysContact']); + if (isset($_POST['sysContact'])) { $override_sysContact_string = mres($_POST['sysContact']); } + $disable_notify = mres($_POST['disable_notify']); + + if ($override_sysContact_bool) { set_dev_attrib($device, 'override_sysContact_bool', '1'); } else { del_dev_attrib($device, 'override_sysContact_bool'); } + if (isset($override_sysContact_string)) { set_dev_attrib($device, 'override_sysContact_string', $override_sysContact_string); }; + if ($disable_notify) { set_dev_attrib($device, 'disable_notify', '1'); } else { del_dev_attrib($device, 'disable_notify'); } + + $update_message = "Device alert settings updated."; + $updated = 1; + } +} + +if ($updated && $update_message) +{ + print_message($update_message); +} elseif ($update_message) { + print_error($update_message); +} + +$override_sysContact_bool = get_dev_attrib($device,'override_sysContact_bool'); +$override_sysContact_string = get_dev_attrib($device,'override_sysContact_string'); +$disable_notify = get_dev_attrib($device,'disable_notify'); +?> + +

Alert settings

+ + + + + + + +
+ + + + + + + + + + + + + + + + +
/>
Override sysContact: value="" />
/>
Disable all alerting for this host
+
+ +
+
+ +
diff --git a/html/pages/device/edit/ipmi.inc.php b/html/pages/device/edit/ipmi.inc.php index 829e3aa89..4cf760d95 100644 --- a/html/pages/device/edit/ipmi.inc.php +++ b/html/pages/device/edit/ipmi.inc.php @@ -26,24 +26,26 @@ if ($updated && $update_message) ?> - +

IPMI settings

+ +
- + - + - + - + diff --git a/html/pages/device/edit/snmp.inc.php b/html/pages/device/edit/snmp.inc.php index 877b40508..e5c5c039e 100644 --- a/html/pages/device/edit/snmp.inc.php +++ b/html/pages/device/edit/snmp.inc.php @@ -50,7 +50,7 @@ echo("
IPMI/BMC Hostname
IPMI/BMC Username
IPMI/BMC Password
- @@ -63,7 +63,7 @@ echo("
SNMP Community
+
- @@ -83,13 +83,13 @@ echo(" - - "); diff --git a/includes/discovery/os.inc.php b/includes/discovery/os.inc.php index 788d6bae8..b669f6648 100644 --- a/includes/discovery/os.inc.php +++ b/includes/discovery/os.inc.php @@ -6,7 +6,7 @@ if ($os != $device['os']) { $sql = mysql_query("UPDATE `devices` SET `os` = '$os' WHERE `device_id` = '".$device['device_id']."'"); echo("Changed OS! : $os\n"); - eventlog("Device OS changed ".$device['os']." => $os", $device['device_id']); + log_event("Device OS changed ".$device['os']." => $os", $device, 'system'); $device['os'] = $os; } diff --git a/includes/discovery/ports.inc.php b/includes/discovery/ports.inc.php index e0e2b5e58..ab934432b 100755 --- a/includes/discovery/ports.inc.php +++ b/includes/discovery/ports.inc.php @@ -33,11 +33,11 @@ foreach (explode("\n", $ports) as $entry) { foreach ($config['bad_if_regexp'] as $bi) { - if (preg_match($bi ."i", $if)) - { - $nullintf = 1; + if (preg_match($bi ."i", $if)) + { + $nullintf = 1; if($debug) { echo("ignored : $bi : $if"); } - } + } } } @@ -48,23 +48,25 @@ foreach (explode("\n", $ports) as $entry) if ($debug) echo("\n $if "); if ($nullintf == 0) { - if (mysql_result(mysql_query("SELECT COUNT(*) FROM `ports` WHERE `device_id` = '".$device['device_id']."' AND `ifIndex` = '$ifIndex'"), 0) == '0') { - mysql_query("INSERT INTO `ports` (`device_id`,`ifIndex`,`ifDescr`) VALUES ('".$device['device_id']."','$ifIndex','".mres($ifDescr)."')"); + if (mysql_result(mysql_query("SELECT COUNT(*) FROM `ports` WHERE `device_id` = '".$device['device_id']."' AND `ifIndex` = '$ifIndex'"), 0) == '0') + { + mysql_query("INSERT INTO `ports` (`device_id`,`ifIndex`,`ifDescr`) VALUES ('".$device['device_id']."','$ifIndex','".mres($ifDescr)."')"); # Add Interface - echo("+"); + echo("+"); } else { - mysql_query("UPDATE `ports` SET `deleted` = '0' WHERE `device_id` = '".$device['device_id']."' AND `ifIndex` = '$ifIndex'"); - echo("."); + mysql_query("UPDATE `ports` SET `deleted` = '0' WHERE `device_id` = '".$device['device_id']."' AND `ifIndex` = '$ifIndex'"); + echo("."); } $int_exists[] = "$ifIndex"; } else { # Ignored Interface - if (mysql_result(mysql_query("SELECT COUNT(*) FROM `ports` WHERE `device_id` = '".$device['device_id']."' AND `ifIndex` = '$ifIndex'"), 0) != '0') { - mysql_query("UPDATE `ports` SET `deleted` = '1' WHERE `device_id` = '".$device['device_id']."' AND `ifIndex` = '$ifIndex'"); + if (mysql_result(mysql_query("SELECT COUNT(*) FROM `ports` WHERE `device_id` = '".$device['device_id']."' AND `ifIndex` = '$ifIndex'"), 0) != '0') + { + mysql_query("UPDATE `ports` SET `deleted` = '1' WHERE `device_id` = '".$device['device_id']."' AND `ifIndex` = '$ifIndex'"); # Delete Interface - echo("-"); ## Deleted Interface + echo("-"); ## Deleted Interface } else { - echo("X"); ## Ignored Interface + echo("X"); ## Ignored Interface } } } @@ -93,4 +95,4 @@ while ($test_if = mysql_fetch_array($query)) unset($temp_exists); echo("\n"); -?> +?> \ No newline at end of file diff --git a/includes/functions.php b/includes/functions.php index 8dd545df4..9b2b7dc92 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -222,7 +222,7 @@ function renamehost($id, $new, $source = 'console') rename($config['rrd_dir']."/$host",$config['rrd_dir']."/$new"); mysql_query("UPDATE devices SET hostname = '$new' WHERE device_id = '$id'"); - eventlog("Hostname changed -> $new ($source)", $id); + log_event("Hostname changed -> $new ($source)", $id, 'system'); } function delete_port($int_id) @@ -650,7 +650,7 @@ function get_astext($asn) } } -# DEPRECATED +# FIXME DEPRECATED -- only used in dead file includes/polling/interfaces.inc.php - if we no longer need that one, this can go too. function eventlog($eventtext,$device_id = "", $interface_id = "") { $event_query = "INSERT INTO eventlog (host, interface, datetime, message) VALUES (" . ($device_id ? $device_id : "NULL"); @@ -677,20 +677,27 @@ function notify($device,$title,$message) if ($config['alerts']['email']['enable']) { - if ($config['alerts']['email']['default_only']) + if (!get_dev_attrib($device,'disable_notify')) { - $email = $config['alerts']['email']['default']; - } else { - if ($device['sysContact']) + if ($config['alerts']['email']['default_only']) { - $email = $device['sysContact']; - } else { $email = $config['alerts']['email']['default']; + } else { + if (get_dev_attrib($device,'override_sysContact_bool')) + { + $email = get_dev_attrib($device,'override_sysContact_string'); + } + elseif ($device['sysContact']) + { + $email = $device['sysContact']; + } else { + $email = $config['alerts']['email']['default']; + } + } + if ($email) + { + mail($email, $title, $message, $config['email_headers']); } - } - if ($email) - { - mail($email, $title, $message, $config['email_headers']); } } } @@ -780,4 +787,4 @@ function include_dir($dir, $regex = "") } } -?> \ No newline at end of file +?> diff --git a/includes/polling/os/unix.inc.php b/includes/polling/os/unix.inc.php index f02d75dc7..07509b8c3 100755 --- a/includes/polling/os/unix.inc.php +++ b/includes/polling/os/unix.inc.php @@ -17,10 +17,10 @@ if ($device['os'] == "linux") $features = str_replace("\"", "", $features); if (!$features) // No "extend" support, try "exec" support - { - $features = snmp_get($device, ".1.3.6.1.4.1.2021.7890.1.101.1", "-Oqv", "UCD-SNMP-MIB"); - $features = str_replace("\"", "", $features); - } + { + $features = snmp_get($device, ".1.3.6.1.4.1.2021.7890.1.101.1", "-Oqv", "UCD-SNMP-MIB"); + $features = str_replace("\"", "", $features); + } // Detect Dell hardware via OpenManage SNMP $hw = snmp_get($device, ".1.3.6.1.4.1.674.10892.1.300.10.1.9.1", "-Oqv", "MIB-Dell-10892"); @@ -63,12 +63,9 @@ elseif ($device['os'] == "monowall" || $device['os'] == "Voswall") } elseif ($device['os'] == "qnap") { - $hardware = snmp_get($device, "ENTITY-MIB::entPhysicalName.1", "-Osqnv"); $version = snmp_get($device, "ENTITY-MIB::entPhysicalFirmwareRev.1", "-Osqnv"); $serial = snmp_get($device, "ENTITY-MIB::entPhysicalSerial.1", "-Osqnv"); - - } -?> +?> \ No newline at end of file diff --git a/includes/polling/ports.inc.php b/includes/polling/ports.inc.php index e6b6ad15d..a2fd5caad 100755 --- a/includes/polling/ports.inc.php +++ b/includes/polling/ports.inc.php @@ -46,8 +46,6 @@ if ($config['enable_ports_adsl']) $device['adsl_count'] = mysql_result(mysql_query("SELECT COUNT(*) FROM `ports` WHERE `device_id` = '".$device['device_id']."' AND `ifType` = 'adsl'"),0); } - - if ($device['adsl_count'] > "0") { echo("ADSL "); @@ -321,4 +319,4 @@ while ($port = mysql_fetch_array($port_query)) #### Clear Variables Here unset($port_stats); -?> +?> \ No newline at end of file diff --git a/includes/rewrites.php b/includes/rewrites.php index 3f0e24232..1a62edca0 100644 --- a/includes/rewrites.php +++ b/includes/rewrites.php @@ -950,8 +950,6 @@ function array_preg_replace($array, $string) return $string; } - - function rewrite_adslLineType($adslLineType) { $adslLineTypes = array ('noChannel' => 'No Channel', @@ -967,6 +965,7 @@ function rewrite_adslLineType($adslLineType) $adslLineType = $text; } } + return($adslLineType); } diff --git a/poll-reachability.php b/poll-reachability.php index dacf192f1..968db5118 100755 --- a/poll-reachability.php +++ b/poll-reachability.php @@ -54,7 +54,7 @@ while ($device = mysql_fetch_array($device_query)) notify($device, "Device Down: " . $device['hostname'], "Device Down: " . $device['hostname'] . " at " . date($config['timestamp_format'])); } } - eventlog("Device status changed to $stat", $device['device_id']); + log_event("Device status changed to $stat", $device, strtolower($stat))); echo("Status Changed!\n"); } }
SNMP Port
+
SNMP Timeout
  +   seconds
SNMP Retries
+