Skip to main content

mozzo

A lightweight CLI for acknowledging and managing Nagios Core alerts and reporting via its native CGI scripts.

Flake8 Lint Run Tests PyPI version

About

Mozzo interacts with Nagios Core (4.x) via cmd.cgi and statusjson.cgi using standard HTTPS requests. It allows you to acknowledge alerts, schedule downtime, generate service/host uptime reporting and view statuses without needing to install specialized Nagios libraries or scrape HTML.

Table of Contents

Installation

Option 1: Run from Source (Standalone)

You can clone the repository and run the script directly:

git clone https://github.com/sadsfae/mozzo.git
cd mozzo
chmod +x mozzo.py
./mozzo.py --help

Option 2: Install via pip

Install in a virtual environment to make the mozzo command available anywhere:

git clone https://github.com/sadsfae/mozzo.git
cd mozzo
python -m venv .venv
source .venv/bin/activate
pip install .
mozzo --help

Option 3: Install via Pypi

python -m venv mozzo
. !$/bin/activate
pip install mozzo

Configuration

Mozzo requires a configuration file named config.yml. It will search for this file in the following order:

  1. ~/.config/mozzo/config.yml
  2. ./config.yml (Current directory)
  3. /etc/mozzo/config.yml
mkdir -p ~/.config/mozzo
curl -s -o ~/.config/mozzo/config.yml https://raw.githubusercontent.com/sadsfae/mozzo/refs/heads/main/config.yml
vim ~/.config/mozzo/config.yml

Your config.yml needs the following structure:

nagios_server: https://nagios.example.com
nagios_cgi_path: /nagios/cgi-bin
nagios_username: nagiosadmin
nagios_password: mysecurepassword
default_downtime: 120 # in minutes
default_reporting_days: 365 # in days
verify_ssl: false
date_format: "%m-%d-%Y %H:%M:%S"

An optional proxy setting routes all requests through an HTTP(S) or SOCKS proxy, for example an SSH dynamic forward:

proxy: socks5h://127.0.0.1:1080

Supported schemes: http, https, socks4, socks4a, socks5, socks5h. SOCKS schemes need the PySocks package (python3-pysocks on Fedora; otherwise pip install PySocks; installed automatically when mozzo is installed with pip). Leave the setting out or empty to go direct.

Usage

View Nagios Process Status

mozzo --status

List Unhandled or Alerting Problems

Lists unhandled host problems (DOWN/UNREACHABLE) and unhandled WARNING, CRITICAL, and UNKNOWN services: issues that are not already acknowledged, in downtime, or silenced.

mozzo --unhandled

List Service Issues

mozzo --service-issues [ --host host.example.com ]

Acknowledge a Specific Service

mozzo --ack --host host01.example.com --service "HTTP"

Acknowledge a Host and all its Services

mozzo --ack --host host01.example.com --all-services

Acknowledge All Alerting Problems

Acknowledge all DOWN/UNREACHABLE hosts and all WARNING, CRITICAL, and UNKNOWN services across all hosts that are not already acknowledged, in downtime, or have notifications disabled.

mozzo --ack --all

List Acknowledgement History for a Service

mozzo --host host01.example.com --service "HTTP" --ack-history

List Acknowledgement History for a Host

mozzo --host host01.example.com --ack-history

List Acknowledgement History for a Custom Timeframe

mozzo --host host01.example.com --ack-history --days 30

Set Downtime for a Specific Host

mozzo --set-downtime --host host01.example.com
mozzo --set-downtime --host host01.example.com --days 0.5

Set Downtime for a Host and all its Services

mozzo --set-downtime --host host01.example.com --all-services

Set Downtime for a Specific Service

mozzo --set-downtime --host host01.example.com --service "HTTP"
mozzo --set-downtime --host host01.example.com --service "HTTP" --days 2

Disable Alerting for a Specific Service

mozzo --disable-alerts --host host01.example.com --service "HTTP"

Disable Alerting for all Services on a Host

mozzo --disable-alerts --host host01.example.com --all-services

Enable Alerting for all Services on a Host

mozzo --enable-alerts --host host01.example.com --all-services

Enable Alerting for a Specific Service

mozzo --enable-alerts --host host01.example.com --service "HTTP"

Toggle Global Alerts

mozzo --disable-alerts
mozzo --enable-alerts

Setting Ack or Downtime with a Custom Message

mozzo --ack --host host01.example.com --message "Acknowledged per ticket INC-12345"
mozzo --set-downtime --host host01.example.com --all-services -m "Patching window"

Acknowledging all Unhandled Issues

Listing all Services by Host

mozzo --status --host host01.example.com

Listing Service Details by Host

mozzo --status --host host01.example.com --service "DNS"

Listing Service Details on All Hosts

mozzo --status --service "DNS"

Listing Service Details with Output

To show DNS results for all hosts that have the service:

mozzo --status --service "DNS" --show-output

To show DNS results for a specific host that has the service:

mozzo --status --host host01.example.com --service "DNS" --show-output

Listing Service Details with Filter

  • You can filter results by passing a human-readable status to --output-filter.
  • Valid options are: PENDING, OK, WARNING, UNKNOWN, and CRITICAL. (Filters are case-insensitive).

To show DNS results for all hosts that have the service in a CRITICAL state:

mozzo --status --service "DNS" --output-filter CRITICAL

To show DNS results for a specific host that has the service in a CRITICAL state, while also showing the plugin output:

mozzo --status --host host01.example.com --service "DNS" --show-output --output-filter critical

Further, you can combine them all to show full plugin output for all DNS failures:

mozzo --status --service "DNS" --output-filter CRITICAL --show-output

Viewing Nagios Logs

View Nagios alert logs from the last 24 hours:

mozzo --log

View logs for a custom time range:

mozzo --log --days 7

View logs for the last 12 hours:

mozzo --log --days 0.5

View raw log including state dumps (for debugging):

mozzo --log --full

Service Reporting and Uptime

  • We also support reporting for uptime per host and per service based on Nagios archivejson.cgi

Uptime Reporting

Report Uptime by Service

mozzo --status --host host01.example.com --service "DNS" --uptime --days 180

Report Uptime by Host

mozzo --status --host host01.example.com --uptime

Exporting Report Data

  • You can export in both JSON and CSV
mozzo --status --host host01.example.com --service "DNS" --uptime --format json > /tmp/host01_dns.json
mozzo --status --host host01.example.com --service "HTTP" --uptime --format csv > /tmp/host01_http.csv

Contributing

Metadata

Release files for mozzo 0.13.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mozzo 0.13.0
File Size Uploaded Provenance Actions
mozzo-0.13.0.tar.gz 67.8 kB Without provenance Details for mozzo-0.13.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mozzo 0.13.0
File Interpreter ABI Platform Actions
mozzo-0.13.0-py3-none-any.whl Python 3 none any Details for mozzo-0.13.0-py3-none-any.whl

Total release size: 109.9 kB

Release files / mozzo-0.13.0.tar.gz

Download URL mozzo-0.13.0.tar.gz
Size 67.8 kB
Tags Source
SHA-256 checksum
How to use checksums
be4c51cb4f439cb7dc77b8b6a00ec811fdc3a4cb26174e6d70f885c08ace9928
BLAKE2b-256 checksum
How to use checksums
5dfd43b15839bbbb4b08b8707befe6519aa709ffade45793efa6ac77e9a256f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / mozzo-0.13.0-py3-none-any.whl

Download URL mozzo-0.13.0-py3-none-any.whl
Size 42.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
434f6ebbca1a976baadb425f433ae13a6dbb1e1cf7d15cc391f4b524dfc36af2
BLAKE2b-256 checksum
How to use checksums
d11ea16d17c7d19788ad4c5d93fcf25b0639525a3d7d7da8ddd77c2af6802e69
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for mozzo 0.13.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page