How the Global-Plugin-Execution service model works
Preparation and prerequisites of the client program
The objective of the Global-Plugin-Execution service model is to allow the execution of a program customized by the customer and deposited on the ServiceNav Box.
In order to function, this program must meet various obligations:
- The program must have a return code according to the table below
|Value||Interpreted status in ServiceNav|
- Return of the program on a single line
- The return may contain performance data, in which case the return must be in the form :
text displayed in the ServiceNav detail field| 'nommetrique'=value [unit]; [alert threshold]; [critical threshold]; [min value]; [max value].
- list of metric name / value names separated by spaces
- the name of the metric can contain any character except the equal sign or the quote sign (')
- single quotation marks for the metric name are optional. Mandatory if name contains spaces
- the name of the metric is free, must be less than 19 characters long and unique in the return line and must not contain the quote sign (')
- alert threshold]; [critical threshold]; [min value]; [max value] can be zero (e.g., if the threshold is not defined or if min and max do not apply). Semi-colons that are not filled in can be deleted. Min and max are not required if the unit is %.
- value, alert threshold, critical threshold, min and max are in class [-0-9] and must all be in 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.
- A few examples:
- no units 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)
- A few examples:
If your program meets the above requirements, you can set it up on the ServiceNav Boxes.
If you have more than one ServiceNav Box, it should be deployed across your entire ServiceNav Box fleet.
Drop your file into the ServiceNav Box folder:
It is then necessary to assign the right rights of execution and membership with the command lines below:
chown nagios:nagios /usr/local/nagios/libexec/custom_plugin/
chmod 755 /usr/local/nagios/libexec/custom_plugin/
Go to the ServiceNav interface and add a :
The field Arguments of the plugin contains all the arguments of the plugin with the following constraints:
- Arguments are passed in the form -H 'value' or -host 'value' (example -c 'public' or -url 'https://myurl.com' )
- To surround the values of the arguments, use the double-quote sign (" ) or the single-quote sign (').
- If the value of an argument surrounded by double quotes contains a double quote it is necessary to escape it with " (backslash 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 quote double 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 attachment equipment as specified in ServiceNav
- $HOSTADDRESS$ returns the IP address of the Service Attachment Equipment 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 service attachment equipment company
- $_HOSTHOST_CATEGORY_NAME$ returns the name of the ServiceNav equipment class of the service attachment
It is not possible to use the account variables specified at company and/or equipment level in ServiceNav. If the program requires any identifying information, this should be specified in the field Argument of the plugin.
This information is stored in encrypted form in the ServiceNav database but remains visible to anyone who has access to the unit service configuration page.