Skip to content

SangeloDev/check_pyhttps

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

check_pyhttps

A Nagios Plugin to check for an endpoint's HTTP status codes. This can be any website, either http or https.

Features

  • Checks HTTP and HTTPS endpoints
  • Supports custom port specification
  • Configurable OK, WARNING, and CRITICAL status codes
  • IPv4 and IPv6 support
  • Adjustable connection timeout
  • Option to disable SSL certificate warnings

Requirements

  • Python 3.8+
  • Requests==2.32.3
  • urllib3==2.2.2

Installation

  1. Ensure Python 3.8 or higher is installed on your system.

  2. Install the required dependencies inside a virtual environment, or system-wide:

    # install inside a virtual environment
    python3 -m venv venv
    source venv/bin/activate
    pip install -r requirements.txt
    
    # or system-wide with your package manager, example:
    sudo dnf install python3-requests
    sudo dnf install python3-urllib3
  3. Download the check_pyhttps.py script to your Nagios plugins directory or any other location accessible by Nagios.

  4. Make the script executable:

    chmod +x check_pyhttps.py

Usage

./check_pyhttps.py [-h] [--http] [-o OK] [-w WARN] [-c CRITICAL] [-t TIMEOUT] [--disable-ssl-warnings] host [port]

Options

  • host: IP address or DNS name to check (required)
  • port: Port number (optional)
  • --http: Use HTTP instead of HTTPS
  • -o OK, --ok OK: Comma-separated list of OK status codes (default: 200,201,204)
  • -w WARN, --warn WARN: Comma-separated list of WARNING status codes (default: 301,302)
  • -c CRITICAL, --critical CRITICAL: Comma-separated list of CRITICAL status codes (default: 400,401,403,404,409,410,500,501,502,503,504)
  • -t TIMEOUT, --timeout TIMEOUT: Timeout in seconds (default: 10)
  • --disable-ssl-warnings: Disable SSL certificate warnings

Examples

  1. Check HTTPS on default port (443):

    ./check_pyhttps.py example.com
  2. Check HTTP on port 8080:

    ./check_pyhttps.py example.com 8080 --http
  3. Custom status codes and timeout:

    ./check_pyhttps.py example.com -o 200,201 -w 301,302,307 -c 404,500 -t 5
  4. Disable SSL warnings:

    ./check_pyhttps.py example.com --disable-ssl-warnings

License

Distributed under the MIT License. See LICENSE.md file for more information.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages