diff --git a/html/images/icons/greyscale/snmp.png b/html/images/icons/greyscale/snmp.png new file mode 100644 index 000000000..dda417b12 Binary files /dev/null and b/html/images/icons/greyscale/snmp.png differ diff --git a/html/images/icons/snmp.png b/html/images/icons/snmp.png new file mode 100755 index 000000000..abcd93689 Binary files /dev/null and b/html/images/icons/snmp.png differ diff --git a/html/pages/device/edit.inc.php b/html/pages/device/edit.inc.php index 3f8702f9c..e17c84a50 100644 --- a/html/pages/device/edit.inc.php +++ b/html/pages/device/edit.inc.php @@ -5,11 +5,17 @@ if ($_SESSION['userlevel'] < '7') print_error("Insufficient Privileges"); } else { - $panes = array('device' => 'Device Settings', - 'ports' => 'Port Settings', - 'apps' => 'Applications', - 'services' => 'Services', - 'ipmi' => 'IPMI'); + $panes['device'] = 'Device Settings'; + $panes['snmp'] = 'SNMP'; + $panes['ports'] = 'Port Settings'; + $panes['apps'] = 'Applications'; + + if ($config['enable_services']) + { + $panes['services'] = 'Services'; + } + + $panes['ipmi'] = 'IPMI'; print_optionbar_start(); diff --git a/html/pages/device/edit/device.inc.php b/html/pages/device/edit/device.inc.php index 7a3089e56..9cf455ccd 100644 --- a/html/pages/device/edit/device.inc.php +++ b/html/pages/device/edit/device.inc.php @@ -8,17 +8,10 @@ if ($_POST['editing']) $ignore = mres($_POST['ignore']); $type = mres($_POST['type']); $disabled = mres($_POST['disabled']); - $community = mres($_POST['community']); - $snmpver = mres($_POST['snmpver']); - $port = mres($_POST['port']); - $timeout = mres($_POST['timeout']); - $retries = mres($_POST['retries']); #FIXME needs more sanity checking! and better feedback - $sql = "UPDATE `devices` SET `purpose` = '" . $descr . "', `community` = '" . $community . "', `type` = '$type'"; - $sql .= ", `snmpver` = '" . $snmpver . "', `ignore` = '$ignore', `disabled` = '$disabled', `port` = '$port', "; - if ($timeout) { $sql .= "`timeout` = '$timeout', "; } else { $sql .= "`timeout` = NULL, "; } - if ($retries) { $sql .= "`retries` = '$retries'"; } else { $sql .= "`retries` = NULL"; } + $sql = "UPDATE `devices` SET `purpose` = '" . $descr . "', `type` = '$type'"; + $sql .= ", `ignore` = '$ignore', `disabled` = '$disabled'"; $sql .= " WHERE `device_id` = '".$device['device_id']."'"; $query = mysql_query($sql); @@ -38,7 +31,7 @@ if ($_POST['editing']) } } -$device = mysql_fetch_array(mysql_query("SELECT * FROM `devices` WHERE `device_id` = '".$device['device_id']."'")); +$device = mysql_fetch_assoc(mysql_query("SELECT * FROM `devices` WHERE `device_id` = '".$device['device_id']."'")); $descr = $device['purpose']; if ($updated && $update_message) @@ -64,51 +57,6 @@ echo(" - - - - - - - - - - - - - - - - - - - - - - - - -
Description
SNMP Community
-
SNMP Version
-
SNMP Port
-
SNMP Transport
- -
SNMP Timeout
  - seconds -
SNMP Retries
-
Type diff --git a/html/pages/device/edit/snmp.inc.php b/html/pages/device/edit/snmp.inc.php new file mode 100644 index 000000000..877b40508 --- /dev/null +++ b/html/pages/device/edit/snmp.inc.php @@ -0,0 +1,106 @@ + "7") + { + $community = mres($_POST['community']); + $snmpver = mres($_POST['snmpver']); + $port = mres($_POST['port']); + $timeout = mres($_POST['timeout']); + $retries = mres($_POST['retries']); + + #FIXME needs more sanity checking! and better feedback + $sql = "UPDATE `devices` SET `community` = '" . $community . "', `snmpver` = '" . $snmpver . "', `port` = '$port', "; + if ($timeout) { $sql .= "`timeout` = '$timeout', "; } else { $sql .= "`timeout` = NULL, "; } + if ($retries) { $sql .= "`retries` = '$retries'"; } else { $sql .= "`retries` = NULL"; } + $sql .= " WHERE `device_id` = '".$device['device_id']."'"; + $query = mysql_query($sql); + + $rows_updated = mysql_affected_rows(); + + if ($rows_updated > 0) + { + $update_message = mysql_affected_rows() . " Device record updated."; + $updated = 1; + } elseif ($rows_updated = '-1') { + $update_message = "Device record unchanged. No update necessary."; + $updated = -1; + } else { + $update_message = "Device record update error."; + $updated = 0; + } + } +} + +$device = mysql_fetch_assoc(mysql_query("SELECT * FROM `devices` WHERE `device_id` = '".$device['device_id']."'")); +$descr = $device['purpose']; + +if ($updated && $update_message) +{ + print_message($update_message); +} elseif ($update_message) { + print_error($update_message); +} + +echo(" +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + "); + +echo(' +
SNMP Community
+
SNMP Version
+
SNMP Port
+
SNMP Transport
+ +
SNMP Timeout
  + seconds +
SNMP Retries
+
+ + +
+ +
'); + +?> \ No newline at end of file