I have around 1000 servers on which I need to restart the SNMP service on, is there an easy method to this via a script or a batch file?
Asked
Active
Viewed 119 times
2 Answers
0
Do you have any sort of collection of the IP's and the root users and passwords (or SSH keys)?
If so, you could use a for loop to cycle through them (implementation depends on the way they're stored), and select the username and password with regular expression filtering or selecting by field and use expect to provide it the password.
If you don't have a collection like that, it seems that you'll have to build a database of them, and it may just be easier to do it manually, but it may be worth creating the database anyways in case you ever need to do this again.
-
I have all the IP addresses and hostnames in a .CSV format. As for the root users and passwords I can always use my domain admin account to intiate the restart. I am just not good with scritpting and coding.... – Mohammed Ali Mar 05 '13 at 18:01
0
You should give a look to Ansible provisioning tool.
The steps should be somthing like this:
- Install Ansible:
sudo apt-get install ansible
(on ubuntu) Define your server groups at
/etc/ansible/hosts
[snmpservers] myhostnames[01:10000].example.com
Restart the service on all servers
ansible snmpservers -m service -a "name=snmp state=restarted"

yucer
- 4,431
- 3
- 34
- 42