Server Management - Systems Insight Manager
1828010 Members
2325 Online
109973 Solutions
New Discussion

Re: Change 200 System Contact locations via a script

 
Richard Blagg
New Member

Change 200 System Contact locations via a script

I am new to this is there any way to update the system contact fields, primarily the Location via a script.

Although I can do this by hand we really need a script in case the server holding the HP SIM Database crashes

Any ideas?
8 REPLIES 8
David Claypool
Honored Contributor

Re: Change 200 System Contact locations via a script

You can change a system manually to the correct information and then replicate it to other systems using 'Replicate Agent Settings' in HP SIM.
Derek_56
Valued Contributor

Re: Change 200 System Contact locations via a script

Richard,

If you want to have a backup for HP SIM, there are two routes you could go using a script. If you're using only Windows systems, you could write a script utilizing WMI to alter the registry keys for the SNMP service. This can be a bit of a pain.

The other method would work for anything with SNMP. Use the snmpset command (http://www.net-snmp.net/docs/man/snmpset.html) to update the location field. The syntax on my Windows CMS is:
snmpset -v1 -c"CommunityString" remoteservername system.sysLocation.0 s "Updated String"
Where "CommunityString" is your SNMP community string with at least WRITE privileges on each system and "Updated String" is your new location string.

If you were to create a text file that listed your remote systems and then used the for command to parse it you could call this command repeatedly for each remote system and set the location string for each:
for /F %i in (fileforservers.txt) do snmpset -v1 -c"CommunityString" %i system.sysLocation.0 s "Updated String"

Remember to use double '%%' when calling this from a cmd/batch file. Hope that this gets you moving in the right direction.
Good luck!
- Derek
Richard Blagg
New Member

Re: Change 200 System Contact locations via a script

Looks good although I am getting a time out with the SNMPSet utility. The SNMP community string has the write right however causes a time out

Any ideas?
Richard Blagg
New Member

Re: Change 200 System Contact locations via a script

Sorted it SNMP security was set on the box
Richard Blagg
New Member

Re: Change 200 System Contact locations via a script

Right the dos command is working fine however the details don't appear on the System detail screen please see attachment. Have I missed somthing here?
David Claypool
Honored Contributor

Re: Change 200 System Contact locations via a script

Guys, I want to point out 2 things--HP SIM expressly does not do any SNMP set operations and only performs secure HTTP for any kind of configuration. That means that best practice is for there to be a READ-ONLY string set for the agents that HP SIM will use during SNMP gets, and a READ-WRITE string established only for localhost access that never traverses the wire.
Derek_56
Valued Contributor

Re: Change 200 System Contact locations via a script

Richard,

Couple questions:
1) What details are you missing? You said you needed a way to set the SNMP settings in case SIM was unavailable, NOT to resolve SIM communication or data population.
2) Can you attach a screen shot of that same node after pressing the "++" button to expand your 'details'. If you have an SNMP configuration issue, you may want to move this question over to another forum.

Don't forget to re-run your Identification tasks in SIM. If your SNMP settings were incorrect initially and SIM couldn't poll the server, you'll need to re-run this so that it can use the new settings on the remote server.

Dave,
I was aware of those points, but was trying to answer Richard as to his original question. If SIM is unavailable, an alternate method would be required. WMI/WBEM would be more secure, but SNMP is there, available, and a common management point between platforms (which he didn't specify.)
I do agree, given that SIM is up, online and available, it is the most secure option.
Richard Blagg
New Member

Re: Change 200 System Contact locations via a script

Thanks for the help.

I had to bite the bullet and input all the details!!!!!