How the Global-Plugin-Execution service model works
Preparation and prerequisites of the customer program
The purpose of the Global-Plugin-Execution service model is to enable the execution of a program customized by the customer and placed on the ServiceNav Box.
In order to function, this program must meet various requirements:
- File encoding : LATIN
- The program must have a return code according to the table below
|Value||Status interpreted in ServiceNav|
- Return of the program on a single line
- The return may contain performance data. In this case, the return must be of the form :
text displayed in the ServiceNav detail field| 'nommetrique'=value[unit];[threshold alert];[critical threshold];[min value];[max value]
- space-separated list of metric/value names
- the metric name can contain any character except the equal sign or the quote sign (')
- single quotes for the metric name are optional. Mandatory if nomenclature contains spaces
- the name of the metric is free. It must be less than 19 characters long and unique in the return line and not contain the quote sign (')
- [Warning threshold];[critical threshold];[min value];[max value] may be null (for example, if the threshold is not defined or if min and max do not apply). Unfilled semicolons can be deleted. Min and max are not required if the unit is %
- value, alert threshold, critical threshold, min and max are in the class [-0-9] and must all be of the same unit for a given metric.
- Unit is a string of one or more characters. The following characters are excluded numbers, semicolons, single or double quotation marks.
- Some examples:
- no unit specified - Indicates a number (int or float) of entities (e.g. users, processes, load averages)
- s - seconds (also min, ms, ...)
- % - percentage
- B - bytes (also KB, MB, TB)
- Some examples:
If your program meets the above requirements, you can implement it on the ServiceNav Boxes.
If you have more than one ServiceNav Box, you should deploy it to your entire ServiceNav Box fleet.
Put your file in the ServiceNav Box folder:
It is then necessary to assign the right execution and membership rights with the command lines below:
chown nagios:nagios /usr/local/nagios/libexec/custom_plugin/
chmod 755 /usr/local/nagios/libexec/custom_plugin/
Putting into supervision
Go to the ServiceNav interface and add a service:
Global-Plugin-ExecutionThe field Plugin file to run must contain the name of your file (placed in the directory as shown above)
The field Arguments of the plugin contains all the arguments of the plugin with the following constraints:
- Arguments are passed as -H 'value' or -host 'value' (e.g. -c 'public' or -url 'https://myurl.com' )
- To surround the values of the arguments, use the double quotes sign (" ) or the single quotes sign (')
- If the value of an argument surrounded by double quotes contains a double quote it is necessary to escape it with "(antislash double quote)
- If the value of an argument surrounded by single quotes contains a single quote it is necessary to escape it with ' "' "' (quote double quote double quote quote)
Example: -h $HOSTADDRESS$ -URI 'mylogin.php' -pwd 'eyi "kim58' -text 'Rue de l' "' "'alma'
Example: -h $HOSTADDRESS$ -URI 'mylogin.php' -pwd " eyi "kim58 " -text " Rue de l'alma "
The following variables can be used:
- $_SERVICEHOSTALIAS$ returns the name of the service's home device as specified in ServiceNav
- $HOSTADDRESS$ returns the IP address of the service's home device as specified in ServiceNav
- $_SERVICEDISPLAYNAME$ returns the service name as specified in ServiceNav
- $_SERVICEIDSERVICE$ returns the unique ServiceNav identifier of the service
- $_HOSTCOMPANYNAME$ returns the name of the parent company of the service's parent equipment
- $_HOSTHOST_CATEGORY_NAME$ returns the name of the ServiceNav equipment category to which the service belongs
It is not possible to use account variables specified at company and/or equipment level in ServiceNav. If the program requires identifying information, this should be entered in the Plugin's argument.
This information is stored encrypted in the ServiceNav database but remains visible to anyone who has access to the unit service configuration page.