Skip to content

Commit

Permalink
fix for automatic device add
Browse files Browse the repository at this point in the history
automation_networks= Added add_to_cacti so you can save it in the database

api_automation = fixed some names being wrong
  • Loading branch information
micke2k committed Apr 6, 2016
1 parent 6bc7e5c commit 22dbba9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions automation_networks.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ function api_networks_save($post) {

$save['enabled'] = (isset($post['enabled']) ? 'on':'');
$save['enable_netbios'] = (isset($post['enable_netbios']) ? 'on':'');
$save['add_to_cacti'] = (isset($post['add_to_cacti']) ? 'on':'');
$save['rerun_data_queries'] = (isset($post['rerun_data_queries']) ? 'on':'');

/* discovery connectivity settings */
Expand Down
4 changes: 2 additions & 2 deletions lib/api_automation.php
Original file line number Diff line number Diff line change
Expand Up @@ -2638,9 +2638,9 @@ function automation_add_device ($device, $web = false) {
global $plugins, $config;

$template_id = $device['host_template'];
$snmp_sysName = preg_split('/[\s.]+/', $device['sysName'], -1, PREG_SPLIT_NO_EMPTY);
$snmp_sysName = preg_split('/[\s.]+/', $device['snmp_sysName'], -1, PREG_SPLIT_NO_EMPTY);
$description = $snmp_sysName[0] != '' ? $snmp_sysName[0] : $device['hostname'];
$ip = $device['ip'];
$ip = $device['ip_address'];
$community = $device['community'];
$snmp_ver = $device['snmp_version'];
$snmp_username = $device['snmp_username'];
Expand Down
4 changes: 2 additions & 2 deletions poller_automation.php
Original file line number Diff line number Diff line change
Expand Up @@ -487,8 +487,8 @@ function discoverDevices($network_id, $thread) {
automation_debug(" Responded");

$fos = automation_find_os($device['snmp_sysDescr'], $device['snmp_sysObjectID'], $device['snmp_sysName']);

if ($fos != false && read_config_option('add_to_cacti') == 'on') {
if ($fos != false && $network['add_to_cacti'] == 'on') {
automation_debug(", Template: " . $fos['name']);
$device['os'] = $fos['name'];
$device['host_template'] = $fos['host_template'];
Expand Down

0 comments on commit 22dbba9

Please sign in to comment.