Alex Burger wrote:
Hi Andy.
Andy Smith wrote:
Are there any options that need to be fed to snmptrapd when the service is registered for logging? Are we going to leave the default event log logging enabled?
I think it would be a good idea to leave the event log enabled, but we need to document how to re-register the service with the other (new for 5.2) command line logging options. README.win32 is missing the snmptrapd register info.
I think we could re-write some of that section to make it clearer to people using the binary release.
I have re-written the 'How to Register the Net-SNMP Agent as a Windows service' section in README.win32. It has been simplified and I have included instructions for snmptrapd. Please let me know what you think and if there are any errors and I will submit it as a patch.
Thanks
Alex
*************************************************************************** * * How to Register the Net-SNMP Agent and trap daemon as Windows services * ***************************************************************************
The Agent (snmpd.exe) and trap daemon (snmptrapd.exe) can be run as a service
under Windows operating systems that have the Service Control Manager (SCM)
(Services Control Panel). This includes Windows NT, 2000, XP and 2003.
Windows 9x/Me do not have the SCM.
To allow snmpd.exe or snmptrapd.exe to run as a service, the programs need
to be registered with the SCM. This is done using the command line switch
-register. For example:
snmpd -register
snmptrapd -register
Note: The above commands assume the programs are in your path. If they are
not, CD into the directory containing the Net-SNMP binaries first.
After registration, the services 'Net-SNMP Agent' and 'Net-SNMP Trap Handler'
will be available in the SCM. The services can be started and stopped using
the SCM (Services Control Panel) or from the command prompt using:
net start "Net-SNMP Agent"
net start "Net-SNMP Trap Handler"
and
net stop "Net-SNMP Agent"
net stop "Net-SNMP Trap Handler"
The registry keys created for the services are:
HKLM\SYSTEM\CurrentControlSet\Services\Net-SNMP Agent
HKLM\SYSTEM\CurrentControlSet\Services\Net-SNMP Trap Handler
If any command line options are specified after the -register option, they
will be included when the service starts. For example, to register the
snmptrapd daemon and enable logging of traps to c:\snmptrapd.log, enter the
following command line:
snmptrapd -register -Lf c:/snmptrapd.log
Note: Use Unix style slashes (/) for all paths.
For a complete list of command line options, use the -h switch:
snmpd -h
snmptrapd -h
Note: -H will display all available snmpd.conf, snmptrapd.conf and snmp.conf
configuration file options, not the command line options.
Each command line option will be added to the Parameters registry subkey for
the service as a ParamX REG_SZ value where X starts at 1 and increments for
each additional command line option. For example, '-Lf c:/snmptrapd.log'
would be:
HKLM\SYSTEM\CurrentControlSet\Services\
Net-SNMP Trap Handler\Parameters\Param1 -Lf
HKLM\SYSTEM\CurrentControlSet\Services\
Net-SNMP Trap Handler\Parameters\Param2 c:/snmptrapd.log
To add additional command line switches or modify the existing ones, you can
either unregister and re-register the services with the new command line
options, or directly add / modify the ParamX values in the registry.
Note: The Parameters key is only created when there is at least one command
line option specified when registering the service so it may need to be
manually added if modifying using the registry editor.
To un-register the services, use the command line switch -unregister. For
example:
snmpd -unregister
snmptrapd -unregister
Note: A reboot may be required after unregistering the daemons to complete
the removal.
