Suppervision

De Wiki-noulot
Sauter à la navigation Sauter à la recherche

Spervision[modifier]

Exit code[modifier]

Numeric Value Service Status Status Description
0 OK The plugin was able to check the service and it appeared to be functioning properly
1 Warning The plugin was able to check the service, but it appeared to be above some "warning" threshold or did not appear to be working properly
2 Critical The plugin detected that either the service was not running or it was above some "critical" threshold
3 Unknown Invalid command line arguments were supplied to the plugin or low-level failures internal to the plugin (such as unable to fork, or open a tcp socket) that prevent it from performing the specified operation. Higher-level errors (such as name resolution errors, socket timeouts, etc) are outside of the control of plugins and should generally NOT be reported as UNKNOWN states.

Sonde Nagios[modifier]

Check_Http[modifier]

What is check_http?

check_http plugin is used to verify the status of HTTP server (or HTTPS) that is running on a remote host. If you’ve installed Nagios from source, check_httpd command will be located in the /usr/local/nagios/libexec directory.


check_http Command Examples[modifier]

1. Check HTTP

Check whether Apache HTTP is running on a remote server using check_http.

$ check_http -H 192.168.1.50
HTTP OK HTTP/1.1 200 OK - 332 bytes in 0.004 seconds |time=0.004144s;;;0.000000 size=332B;;;0


2. Check HTTPS

Check whether Apache HTTPS is running on a remote server using check_http.

$ check_http -H 192.168.1.50 -S
HTTP OK HTTP/1.1 200 OK - 332 bytes in 0.004 seconds |time=0.004144s;;;0.000000 size=332B;;;0
If the remote server runs only HTTP and not HTTPS, you’ll get “HTTP CRITICAL – Unable to open TCP socket” message as shown below.
$ check_http -H 192.168.1.50 -S
Connection refused
HTTP CRITICAL - Unable to open TCP socket

3. Check HTTP (or HTTPS) on different port

You can check tomcat server, or apache server, or glassfish, or any server that is running on a different port by speficying the port number as shown below.

$ check_http -H 192.168.1.50 -p 8080
HTTP OK HTTP/1.1 200 OK - 332 bytes in 0.004 seconds |time=0.004144s;;;0.000000 size=332B;;;0
For HTTPS running on a different port, do the following.
$ check_http -H 192.168.1.50 -S -p 8443
HTTP OK HTTP/1.1 200 OK - 332 bytes in 0.004 seconds |time=0.004144s;;;0.000000 size=332B;;;0

4. Check Specific URL

To check whether a specific webpage is available, use the -u option as shown below.

$ check_http -H 101hacks.com -u http://linux.101hacks.com/toc

5. Check SSL Certificate Expiry

You can check whether a SSL certificate of the website expires within the next X number of days as shown below. In the following example, we are checking whether the website certificate expires in the next 365 days. The output indicates that it expires in 300 days.

$ check_http -H 101hacks.com -C 365 
WARNING - Certificate expires in 300 day(s) (01/01/2011 10:10).

Syntax and Options[modifier]

check_http -H hostname (or) -I ip-address {optional options}

Short Option Long Option Option Description

-H –hostname host name of the server where HTTP (or HTTPS) daemon is running

-I –IP-address ip address of the HTTP (or HTTPS) server

-p –port Port number where HTTP server runs. Default is 80

-4 –use-ipv4 This will use IPv4 connection

-6 –use-ipv6 This will use IPv6 connection

-S –ssl This will use HTTPS using default 443 port

-C –certificate Minimum number of days a SSL certiface must be valid.

-e –expect Expected response string. Default is HTTP/1

-s –string Expected content string.

-u –url URL to check

-P –post URL encoded http POST data

-N –no-body Do not wait for whole document body to download. Stop once the headers are downloaded.

-M –max-age Check whether a document is older than x seconds. Use 5 for 5 seconds, 5m for 5 minutes, 5h for 5 hours, 5d for 5 days.

-T –content-type Indicate content type in header for POST request

-l –linespan Regular expression can span to new line (Use this with -r or -R option)

-r –regex, –ereg Use this regular expression to search for string in the HTTP page

-R –eregi Same as above, but with ignore case.

-a –authorization If the site user basic authentication send uid, pwd in the format uid:pwd

-A –useragent Pass the specified string as “User Agent” in HTTP header.

-k –header Add additional tags that should be sent in the HTTP header.

-L –link The output is wrapped as HTML link

-f –onredirect When a URL is redirected, use this to either follow the URL, or send ok, warning, or critical notification

-m –pagesize Specify the minimum and maximum page size expected in bytes. Format is minimum:maximum

-w –warning Response time in seconds for warning state

-m –pagesize Specify the minimum and maximum page size expected in bytes. Format is minimum:maximum

-w –warning Response time in seconds for warning state

-c –critical Response time in seconds for critical state

-t –timeout Number of seconds to wait before connection times out. Default is 10 seconds


Droit pour sonde Oracle[modifier]

GRANT CREATE SESSION TO "NAGIOS_QRY";
GRANT SELECT ANY SEQUENCE TO "NAGIOS_QRY";
GRANT SELECT ANY TABLE TO "NAGIOS_QRY";
GRANT SELECT ON "SYS"."DBA_DATA_FILES" TO "NAGIOS_QRY";
GRANT SELECT ON "SYS"."DBA_FREE_SPACE" TO "NAGIOS_QRY";
GRANT SELECT ON "SYS"."V_$INSTANCE" TO "NAGIOS_QRY";
GRANT SELECT ON "SYS"."V_$TEMP_SPACE_HEADER" TO "NAGIOS_QRY";

Config autorisation NRPE[modifier]

PB: CHECK_NRPE: Error - Could not complete SSL handshake.

Fichier a modifier pour NRPE
 vi /etc/hosts.allow
  nrpe : ALL

Proc install NRPE EXADATA[modifier]

Install RPM[modifier]

cd /etc/yum.repos.d/
scp FRCCEISSUP07:/etc/yum.repos.d/epel.repo .
yum install nrpe --nogpgcheck
scp eceisexa01vm01:/etc/nagios/nrpe.cfg /etc/nagios/
scp eceisexa01vm01:/usr/lib64/nagios/plugins/* /usr/lib64/nagios/plugins/
mkdir -p /opt/pierre-vacances/nagios/plugins/ 
scp FRCCEISSUP09:/opt/pierre-vacances/nagios/plugins/* /opt/pierre-vacances/nagios/plugins/
service nrpe restart

Fichier a modifier pour autoriser le NRPE

 vi /etc/hosts.allow
  nrpe : ALL

Centreon-clapi[modifier]

Wiki Clapi