From OpenNMS
Contents |
GpMonitor Parameters
Given that your GpMonitor wants to call a script that would look like this from the command line:
/home/david/myscript.sh --hostname 10.1.1.1 --timeout 3 myarg
The design comes from the contributor of the script. The design was that a host parameter, timeout parameter, and an optional set of arguments would always need to be passed to your defined script. The monitor's parameter map in the script call looks like this (assume 10.1.1.1 as the service's IP address passed in from the Poller for simplicity) :
<script> <hoption> 10.1.1.1 <toption> <timeout / 1000> <args>
hoption
The contributor of this script designed as if they needed to call the underlying "script" with an option called "--hostname" which happens to be the default if you don't specify one though it will be passed to your script without a value. This allows you to change it to something like "-h" or "--iphost" if you need that for your script. Whatever you set this value to, the script will be called with that value followed by the IP address of the service being polled.
toption
The contributor of this script designed as if they needed to call the underlying "script" with an option called "--timeout" which happens to be the default if you don't specify one though it will be passed to your script without a value. This allows you to change it to something like "-t" or "--to" if you need that for your script. Whatever you set this value to, the script will be called with that value followed by the timeout parameter (divided by 1000) defined for the service which is 3000, by default.
retry
This parameter is self explanatory. The GpMonitor will attempt to run your script once plus this many times. Default is 0 (no retries).
timeout
This parameter is self explanatory... specify milliseconds. The Monitor will return an unavailable status if script fails to return an value in this amount of time. Default is 1000. Note, this parameter can be passed to your script with the toption parameter and it will be converted from milliseconds to seconds.
args
This parameter is a literal set of arguments passed on the command line to your script with no substitutions such as: %nodelabel%. This should be an enhancement request.
script
The parameter is the literal name of the script to be called for monitoring your service.
banner
This is what you expect your script to return. If you script returns no banner and the system exit status is 0, your service will always be "Up". If you specify your banner argument value as "*":
parameter key="banner" value="*"
then any banner returned and and an exit status of 0, the service will be marked "Up".
You can specify a string matching value as the banner such that if your script returns a banner such as "my service is okay" and your banner parameter is specified as:
parameter key="banner" value="okay"
then the monitor will indicate your service as up because the string "okay" is found within the banner returned by your script.
These are the only parameters allowed for the GpMonitor. A little caveat, when review the code for this monitor, I've noticed that the Java convention for executing system commands with options and arguments is not being followed. Your args parameter may not work as expected. FYI.






