Operating System - HP-UX
1820249 Members
2592 Online
109622 Solutions
New Discussion юеВ

Start/Stop Snmp after modification

 
Glenn Mitchell_2
Frequent Advisor

Start/Stop Snmp after modification

What is the proper way to Stop and Start the snmp agent? I just modified the snmpd.conf files in /etc and in /etc/SnmpAgentd (to set the get-comunity-name to a value other than "public") and need to recycle the agent to allow the changes to take effect.

There appear to be 6 scripts in the /sbin/init.d folder:

SnmpMaster
SnmpHpunix
SnmpMib2
SnmpTrpDst
SnmpFddi
SnmpFddi4

The only snmp process I have running (ps -ef) is snmpdm.

I have an HP N4000 running HP-UX 11.11

I gather from the man pages that the last one to stop, and the first one to start is the SnmpMaster script. But what of the others???
2 REPLIES 2
A. Clay Stephenson
Acclaimed Contributor

Re: Start/Stop Snmp after modification

Ok, the answer is a little complicated but it will apply to anything started and stoped by rc so it's worth learning. The scripts found in /sbin/init.d are never used directly by rc; they are intended for manual use. The "real" work is done by the entries in /sbin/rcN.d where N is the run-level; these directories contain symbolic links to entries in /sbin/init.d. In almost all cases, if a service is started in run-level N is is stopped in run-level N - 1. SNMP is started in run-level 2 and stopped in run-level 1.

Do an ls -l /sbin/rc1.d and find all the links that begin with 'K' that link to your SNMP scripts in /sbin/init.d.

You execute each of these in the lexical order listed (e.g. K201xxx before K303xxx);
you can execute either the files in /sbin/rc1.d/ or those in /sbin/init.d -- just do them in the order listed in the rc1.d directory.

e.g. /sbin/rc1.d/K424SnmpFddi4 stop

Now do all of those to stop SMNP. Some may actually do nothing but that's automatically taken care of by entries under /etc/rc.config.d.

Now that has you stopped; you next do the same thing under /sbin/rc2.d and look for the S entries that match your SNMP scriots in init.d; you execute these in lexical order as well using "start" as a paramter.

Now wasn't that complicated? That's why the next time you do this, you are going to write a script.
If it ain't broke, I can fix that.
Glenn Mitchell_2
Frequent Advisor

Re: Start/Stop Snmp after modification

Very nice reply Clay. 'Problem solved. I researched the /sbin/rc1.d nd rc2.d listings and wrote a script to execute the snmp stops and starts (my typing speed would have been to slow to execute it efficiently in real-time). Everything worked wonderfully.

Thank you