Disclaimer :
The release of this new service templates is accompanied by new ServiceNav product terms and conditions available here : https://coservit.com/servicenav/fr/cgv/ See in particular sections 8 and 4.5 for SaaS platforms and section 6.7 of the support conditions for OnPremise platforms.
The use of this service model therefore implies the following conditions:
- The support provided by Coservit is limited to the product code provided to the customer, and Coservit does not provide support on the executed code provided by the customer.
- Coservit no longer provides support on a ServiceNav Box whose components may have been modified (in addition to the file submitted by the customer), particularly in the event of installation or updating of additional software (packages) or the ServiceNav Box operating system.
- In the event of a support request and/or abnormal activity on the platform and in case of reasonable doubt by the support technician, Coservit reserves the right to move/modify the product code by the customer and to stop its operation, informing the customer according to usual support procedures.
How the Global-Plugin-Execution service template works
Preparation and prerequisites of the client program
The idea behind the Global-Plugin-Execution service template is to allow the running of a program/script customised by the customer and transferred to the ServiceNav Box.
In order to function, this program must meet various obligations:
- Encoding type : LATIN
- The program must produce a return code according to the table below
Value | Interpreted status in ServiceNav |
---|---|
0 | OK (green) |
1 | Warning (orange) |
2 | Critical (red) |
3 | Unknown (grey) |
- Program output must be a single line
- The output may contain performance data, in which case the output must be of the form :
text displayed in the ServiceNav detail field| 'metric-name'=value [unit]; [warning threshold]; [critical threshold]; [min value]; [max value].
-
- list of metric name / value names separated by spaces
- the metric name can contain any character except the equal sign (=) or the quote sign (')
- single quotation marks for the metric name are optional, but MANDATORY if name contains spaces
- the name of the metric is flexible insofar that it:, must be less than 19 characters long, unique in the output 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, warning threshold, critical threshold, min and max must use numbers [0-9] and must all use the same units 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.
- A few examples:
- no units specified - Indicates a number (int or float) of entities (e.g., number of users or 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 run it on a ServiceNav Box.
If you have more than one ServiceNav Box, the script should be deployed across all your ServiceNav Boxes.
Copy your file into the ServiceNav Box directory:
/usr/local/nagios/libexec/custom_plugin
Assign execution and ownership permissions using the command lines:
chown nagios:nagios /usr/local/nagios/libexec/custom_plugin/
chmod 755 /usr/local/nagios/libexec/custom_plugin/.
Monitoring
Go to the ServiceNav interface and add a service:
Global-Plugin-ExecutionThe Plugin file to execute must contain the name of your file (previously placed in the directory as indicated above)
The Plugin arguments contains all the arguments of the plugin with the following caveats:
- 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 host the service is linked with as displayed in ServiceNav
- $HOSTADDRESS$ returns the IP address of the host the service is linked with as displayed in ServiceNav
- $_SERVICEDISPLAYNAME$ returns the service name as specified in ServiceNav
- $_SERVICEIDSERVICE$ returns the unique ServiceNav service ID
- $_HOSTCOMPANYNAME$ returns the name of the company the host is associated with
- $_HOSTHOST_CATEGORY_NAME$ returns the name of the ServiceNav host category the host associated with the service is assigned to
It is not possible to use inherited account variables specified at company and/or host level of ServiceNav. If the program requires any credential information, this should be specified in the field Plugin arguments.
This information is stored in encrypted form in the ServiceNav database but remains visible to anyone who has access to the service configuration page.