checkhttp2

command module
v2.0.5+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 28, 2018 License: MIT Imports: 10 Imported by: 0

README

checkhttp2

A simple plugin to check https urls, including http/2, and SSL expiration.

This plugin is meant to be used with Nagios.

Compile for Linux (e.g. Digital Ocean Ubuntu 16.04):

env GOOS=linux GOARCH=amd64 go build -o checkhttp2 main.go

Installation

For Nagios 4 on Ubuntu 16.04, assuming that you followed these instructions, just place in /usr/local/nagios/libexec, and make sure the file is executable.

Usage

Help:

user@host# /usr/local/nagios/libexec/checkhttp2 -h

Usage of /usr/local/nagios/libexec/checkhttp2:
  -cert
        If set, perform scan SSL cert only
  -host string
        A valid internet site e.g. www.example.com
  -port int
        Port number (default 443)
  -protocol string
        Protocol - https or http (default "https")

Run the command from cli as follows:

checkhttp2 -host <hostname.com> [-protocol http|https] [-port 80|443] [-cert]

Example: to check status of www.google.com:

checkhttp2 -host www.google.com

Example: to check SSL expiration date for www.google.com:

checkhttp2 -host www.google.com -cert

Example: to check SSL expiration of somesite.com on port 5666:

checkhttp2 -host www.somesite.com -port 5666 -cert

Integration with Nagios 4

Add this to /usr/local/nagios/objects/commands.cfg to test HTTP/2 status:

define command {
   command_name    check_http2
   command_line    /usr/local/nagios/libexec/checkhttp2 -host $ARG1$
}

Add this to /usr/local/nagios/objects/commands.cfg to test SSL expiration status:

define command {
   command_name    check_ssl_expiry
   command_line    /usr/local/nagios/libexec/checkhttp2 -host $ARG1$ -cert
}

In individual files in /usr/local/nagios/etc/servers:

define service{
        use                     generic-service
        host_name               www.somesite.com
        service_description     Check HTTP2
        check_command           check_http2!www.somesite.com
}

define service{
        use                     generic-service
        host_name               www.somesite.com
        service_description     Check SSL Expiry
        check_command           check_ssl_exiry!www.somesite.com
        check_interval          1440
}

Credits

The SSL check code is based on asyncrsc/ssl_scan. Nagios messaging is based on newrelic/go_nagios.

License

This software is licensed under the MIT License.

Documentation

Overview

A simple nagios plugin to test for HTTP/2 status and SSL expiration

Directories

Path Synopsis
Based on https://github.com/asyncsrc/ssl_scan
Based on https://github.com/asyncsrc/ssl_scan
Based on https://github.com/newrelic/go_nagios
Based on https://github.com/newrelic/go_nagios

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL