BSFDetector
Subscribe

From OpenNMS

Jump to: navigation, search

The BSF Detector lets you run arbitrary scripts using the Bean Scripting Framework to determine the availability of a service. This can be a script written in any of the languages supported by BSF, the only requirement is that the script returns the string "OK" if it passes.

For information on writing a BSF script for OpenNMS, see the BSF Monitor page.

Unlike the BSF Monitor, the BSF Detector only passes in the "map," "ip_addr," "svc_name," and "results" variables as beans to the script.

Default Parameters

All detectors accept the "port", "timeout", "retries", and "serviceName" parameters:

port  
The port to connect to on the remote host.
timeout (default: "2000") 
The amount of time to wait before giving up on a connection.
retries (default: "1") 
The number of times to attempt a connection again, before giving up.
serviceName (default: "BSF") 
The service name to use if the detector finds a valid service.

Additional Parameters

In addition, the BSF Detector accepts the following parameters:

fileName  
The path to the file (on the OpenNMS server) which contains the BSF-compatible script to run.
langClass  
The short name of the language the script is written in.
choices: javascript, beanshell, groovy, etc.
bsfEngine  
The BSF engine to use when running the script.
choices: bsh.util.BeanShellBSFEngine, org.codehaus.groovy.bsf.GroovyEngine
fileExtensions  
A comma-separated list of file extensions to consider a valid script for this BSF instance.
runType  
Which way to run the BSF script.
choices: eval (expects the script to print the OK/error status to), exec (expects the script to manipulate the provided results hashmap directly)