The use of this service template therefore imposes the following conditions:
- Coservit's support is limited to the execution of the code provided by the customer, and Coservit does not provide support on the code produced by the customer
- Coservit will no longer provide support for a ServiceNav Box where elements may have been modified (in addition to the file submitted by the customer), in particular in the event of the installation or updating of additional software (packages) or the operating system of the ServiceNav Box
- In case of support request and/or abnormal activity on the platform and in case of reasonable doubt of the support technician, Coservit reserves the right to move/modify the code produced by the customer and to stop its operation, informing the customer according to the usual support procedures.
How the Global-Plugin-Execution service template works
Preparation and prerequisites of the customer script
The purpose of the Global-Plugin-Execution service template is to enable the execution of a script customized by the customer and located on the ServiceNav Box.
In order to function, this script must meet various requirements:
- File encoding : LATIN
- The script must have a return code (value) as indicated in the table below
|Value||Status interpreted in ServiceNav|
- Script output must occupy a single line
- The output may contain performance data. In this case, the output must be follow the form :
text displayed in the ServiceNav detail field| 'metric_name'=value[unit];[threshold warning];[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 metric_name contains spaces
- the name of the metric is free to decide. It must be less than 19 characters long, unique in the output line and not contain the quote symbol (')
- [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). Empty semicolons can be deleted. Min and max are not required if the unit is %
- value, warning threshold, critical threshold, min and max are in the range [-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 prohibited 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 script meets the above requirements, you can transfer it on the ServiceNav Boxes.
If you have more than one ServiceNav Box, you should deploy it to all your ServiceNav Boxes
Place your script file on the ServiceNav Box in the directory:
Then set the correct execute 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/
Insert into monitoring
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 indicated earlier)
The field Plugin arguments contains all the arguments of the plugin subject to the following constraints:
- Arguments are passed as -H 'value' or -host 'value' (e.g. -c 'public' or -url 'https://myurl.com' )
- When surrounding the values of any 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 "(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, 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 host
- $_HOSTHOST_CATEGORY_NAME$ returns the name of the ServiceNav host category to which the services host belongs
It is not possible to use account variables specified at company and/or host level in ServiceNav. If the program requires credential 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 configuration page of the service.