Running as a Windows Service

Top  Previous  Next

Release 1.29 introduced the ability to run the program and be managed as a standard Windows Service.  When the executable is invoked from the command-line prompt, it runs as a foreground application and sends all output to the screen.  When it is invoked from the Service Control Manager plug-in, as shown below, it can be launched as a service routine. All monitoring information will normally be sent to the windows event log.

 

Service Management Functions

These functions manage the service routine.  These functions should not be combined with other functions. All of these functions return to the command-line prompt after they are executed.

 

Command

Description

-servicehelp

 

Displays help text specific to these functions

-serviceinstall

This both installs the program as a standard system service and launches the application. If the application is already installed, the service will be started. It will not re-install another executable as a service. If you need to perform a re-install, you must first issue -servicestop to stop the service followed by a -serviceuninstall. Then you may install the service.

-serviceuninstall

This stops the service (if running), then uninstalls it.

-serviceparameters [argument list]

Use the argument list to define the commands that the service routine will use when it is launched as a service. This command should be run before you install the service, but it can be entered at any time.  The argument list will only be used when the service starts. If you change the parameters, you must restart the program. It is important to note that the program does not perform any syntax checking or validation of parameters when running the -serviceparameters function. You should enter -servicestatus a few minutes after launching the program to make sure that it is running.

-servicestop

This stops the service.  You must issue the -servicestart to restart (or use the SCM Plugin to restart the service).

 

-servicestart

This starts the service and instructs it to use the default parameters defined in the -serviceparameters function.

-servicestatus

Reports status of the service routine (running, stopped, etc ...).

 

 

Step-by-Step - Launching the Service

1.Decide on the runtime parameters.  This example sets parameters to poll all hardware every 5 minutes, suppress event log entries if no errors are found, and send out an email to support@abc.com using the mail server smtp.abc.com.
2.Configure authentication and mail server settings using the interactive command, -Mail.  Do this by entering smartmon-ux -Mail and configuring the settings.
3.Enter smartmon-ux -serviceparameters -F 300 -sq -M support@abc.com -N smtp.abc.com

 

At this point the service will be installed and running. If this is the first time you have used a certain set of parameters, then you should check the windows event log to make sure that the program accepted the parameters and is running as expected.

 

Parameters Supported when Running as a Service

Most of the polling commands are supported. These include -E, -F, -G, -i -link -L -LRemote -sq -M, -ping  -X, and -zm.

 

The Service Control Manager Plug-In.

servicesproperties

You may change the start-up type of the service routine to Manual if you do not want the program to automatically launch at boot time.

 

 

 

services

 

 

Note: Significant logic changes were made in order to insure the program works under Vista and Windows 2008.

 

Registry entries for the service are saved in:

My Computer\HKEY_LOCAL_MACHINE\SOFTWARE\SANtools\SMARTMonUX

 

Using ServiceParameters key of type REG_SZ for the actual parameters.

Registry