![](https://secure.gravatar.com/avatar/3bbbd945c333b8013d0dfa23058f65b9.jpg?s=120&d=mm&r=g)
On 16.10.2014 02:47, Darian Jimenez wrote:
Has anyone done a script where it can every 30 minutes or every hour read server names from a text file and add the device and discovery and poll it automatically ?
I want to be able to add servers into the domain and have observium discovery them automatically via snmp.
$ ./add_device.php
USAGE: add_device.php <hostname> [community] [v1|v2c] [port] [udp|udp6|tcp|tcp6] add_device.php <hostname> [any|nanp|anp|ap] [v3] [user] [password] [enckey] [md5|sha] [aes|des] [port] [udp|udp6|tcp|tcp6] *add_device.php <filename>*
you can specify filename as a parameter in add_device.php where each line is hostname with (or without) snmp parameters same as in command line like: #----- one.device.com second.device.commy_community v2c third.device.com anp v3 my_user my_pass my_enc_key sha des #-----
If snmp parametrs not specified in file than used autodetect with paramets specified in config:
// SNMPv1/2c $config['snmp']['community'][1] = "my_community"; // Communities to try during adding hosts and discovery
// SNMPv3 // The array can be expanded to give another set of parameters $config['snmp']['v3'][1]['authlevel'] = "noAuthNoPriv"; // noAuthNoPriv | authNoPriv | authPriv $config['snmp']['v3'][1]['authname'] = "observium"; // User Name (required even for noAuthNoPriv) $config['snmp']['v3'][1]['authpass'] = ""; // Auth Passphrase $config['snmp']['v3'][1]['authalgo'] = "MD5"; // MD5 | SHA $config['snmp']['v3'][1]['cryptopass'] = ""; // Privacy (Encryption) Passphrase $config['snmp']['v3'][1]['cryptoalgo'] = "AES"; // AES | DES
Note, for each snmp auth setyou should use a unique array key.