Wednesday, December 16, 2009

Configuring net-snmp for startup on Solaris 8

I want to give credit to Lennart Ljungqvist whose article I found for installing net-snmp on Solaris helped me to create a startup script for net-snmp.

Installing software on Solaris is for a different time, but if you want to know how to configure net-snmp for startup, and in this case for it to coexist with other snmp daemons, then read on.

We already have the Sun snmp daemon running on UDP port 161. I have read of ways to integrate net-snmp with that daemon, but I was not attempting that today. I will run net-snmp on a different port (10161 in this case) but I need it to start on boot.

Here are the steps to follow. Thank you Lennart.

1. Create the init script.

vi /etc/init.d/netsnmp
put the following in the file:

##### START SCRIPT #####
#!/sbin/sh
#
case $1 in
'start')
/usr/local/sbin/snmpd udp:10161
;;
'stop')
kill `pgrep -U root snmpd`
;;
*)
echo "Usage: $0 { start | stop }"
exit 1
;;
esac
##### END SCRIPT #####

2. Set the execute permission on the init script and link to the proper director for startup and shutdown:

chmod u+x /etc/init.d/netsnmp
ln -s /etc/init.d/netsnmp /etc/rc3.d/S99netsnmp
ln -s /etc/init.d/netsnmp /etc/rc2.d/K03netsnmp


3. Start the netsnmp daemon and try a snmpwalk
/etc/init.d/netsnmp start

snmpwalk -v1 -c rocommunity host:10161

Good luck.

Matthew

No comments: