'7') { $no_checks = ($_POST['no_checks'] == 'on'); $community = mres($_POST['community']); $snmpver = mres($_POST['snmpver']); $transport = $_POST['transport'] ? mres($_POST['transport']) : $transport = 'udp'; $port = $_POST['port'] ? mres($_POST['port']) : $config['snmp']['port']; $timeout = mres($_POST['timeout']); $retries = mres($_POST['retries']); $poller_group = isset($_POST['poller_group']) ? mres($_POST['poller_group']) : 0; $port_assoc_mode = mres($_POST['port_assoc_mode']); $max_repeaters = mres($_POST['max_repeaters']); $max_oid = mres($_POST['max_oid']); $v3 = array( 'authlevel' => mres($_POST['authlevel']), 'authname' => mres($_POST['authname']), 'authpass' => mres($_POST['authpass']), 'authalgo' => mres($_POST['authalgo']), 'cryptopass' => mres($_POST['cryptopass']), 'cryptoalgo' => mres($_POST['cryptoalgo']), ); // FIXME needs better feedback $update = array( 'community' => $community, 'snmpver' => $snmpver, 'port' => $port, 'transport' => $transport, 'poller_group' => $poller_group, 'port_association_mode' => $port_assoc_mode, ); if ($_POST['timeout']) { $update['timeout'] = $timeout; } else { $update['timeout'] = array('NULL'); } if ($_POST['retries']) { $update['retries'] = $retries; } else { $update['retries'] = array('NULL'); } $update = array_merge($update, $v3); $device_tmp = deviceArray($device['hostname'], $community, $snmpver, $port, $transport, $v3, $port_assoc_mode); if ($no_checks === true || isSNMPable($device_tmp)) { $rows_updated = dbUpdate($update, 'devices', '`device_id` = ?', array($device['device_id'])); $max_repeaters_set = false; $max_oid_set = false; if (is_numeric($max_repeaters) && $max_repeaters != 0) { set_dev_attrib($device, 'snmp_max_repeaters', $max_repeaters); $max_repeaters_set = true; } else { del_dev_attrib($device, 'snmp_max_repeaters'); $max_repeaters_set = true; } if (is_numeric($max_oid) && $max_oid != 0) { set_dev_attrib($device, 'snmp_max_oid', $max_oid); $max_oid_set = true; } else { del_dev_attrib($device, 'snmp_max_oid'); $max_oid_set = true; } if ($rows_updated > 0) { $update_message = $rows_updated.' Device record updated.'; $updated = 1; } elseif ($rows_updated = '-1') { if ($max_repeaters_set === true || $max_repeaters_set === true) { if ($max_repeaters_set === true) { $update_message = 'SNMP Max repeaters updated, no other changes made'; } if ($max_oid_set === true) { $update_message .= '
SNMP Max OID updated, no other changes made'; } } else { $update_message = 'Device record unchanged. No update necessary.'; } $updated = -1; } else { $update_message = 'Device record update error.'; $updated = 0; } } else { $update_message = 'Could not connect to device with new SNMP details'; $updated = 0; } }//end if }//end if $device = dbFetchRow('SELECT * FROM `devices` WHERE `device_id` = ?', array($device['device_id'])); $descr = $device['purpose']; if ($updated && $update_message) { print_message($update_message); } elseif ($update_message) { print_error($update_message); } $max_repeaters = get_dev_attrib($device, 'snmp_max_repeaters'); $max_oid = get_dev_attrib($device, 'snmp_max_oid'); echo "
"; ?>
'; }//end if echo '
'; ?>