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 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

Release files for mozzo 0.12.5

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.5
File Size Uploaded
mozzo-0.12.5.tar.gz 64.1 kB Details

Built distribution (wheel)

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

Total release size: 104.3 kB

Release files / mozzo-0.12.5.tar.gz

Download URL mozzo-0.12.5.tar.gz
Size 64.1 kB
Tags Source
SHA-256 checksum
How to use checksums
1bd60bd1c619e32ec35e9d5b462251eec621086d6c449464f0dd16535b61c8d8
BLAKE2b-256 checksum
How to use checksums
8a58ad29caa4cf189929ea8412d1b86d9897e914a8e5ec54a7f61b27160b7071
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.5-py3-none-any.whl

Download URL mozzo-0.12.5-py3-none-any.whl
Size 40.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f02d9220edcd6107b1392ad92aff1d6d6e11124b277adc520ed09d9c0a55fd1c
BLAKE2b-256 checksum
How to use checksums
dd57bb9e752e8d65cc8290b00eba0202f19b257262bacabbb8b8e3706c9ef00c
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

This release

0.12.5 This release

2 release files

0.12.4

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