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"

Usage

View Nagios Process Status

mozzo --status

List Unhandled or Alerting services

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 Services

Acknowledge 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

  • This bash one-liner can ack all unhandled issues in one swoop.
mozzo --unhandled | grep -E -i "critical|warning" | while read -r level host arrow service; do mozzo --ack --host "$host" --service "$service"; done

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

Release files for mozzo 0.12.4

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.12.4
File Size Uploaded
mozzo-0.12.4.tar.gz 63.5 kB Details

Built distribution (wheel)

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

Total release size: 103.4 kB

Release files / mozzo-0.12.4.tar.gz

Download URL mozzo-0.12.4.tar.gz
Size 63.5 kB
Tags Source
SHA-256 checksum
How to use checksums
4dc4c20816e9a95a974118329bc034d72808ca84356fb7b3a6106371bf4050a1
BLAKE2b-256 checksum
How to use checksums
4b713b0308e55fdc42ddbec172da7593e427d6e2a2e3d821387e7258a7427752
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

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

Download URL mozzo-0.12.4-py3-none-any.whl
Size 40.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cccc79e3f0de5a05f4d7dd40e31b8fbdd25f0677efc0fcfc8c923f1d12fea06c
BLAKE2b-256 checksum
How to use checksums
ae3fe2a6bd61b8e3c5e99b6dbe9b4ebb157ced57091729306b30950b4907b229
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

0.12.5

2 release files

This release

0.12.4 This release

2 release files

0.12.3

2 release files

0.12.2

2 release files

0.12.1

2 release files

0.12.0

2 release files

0.11.0

2 release files

0.10.1

2 release files

0.10.0

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

0.0.0

2 release files

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