Skip to main content

A command-line assistant for acknowledging and managing Nagios Core alerts.

Project description

mozzo

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

Flake8 Lint 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, 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 globally or in a virtual environment to make the mozzo command available anywhere:

git clone https://github.com/sadsfae/mozzo.git
cd mozzo
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

[!TIP] Copy the example config.yml and edit it first.

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
verify_ssl: false
date_format: "%m-%d-%Y %H:%M:%S"

Usage

[!IMPORTANT] You can run mozzo (if installed) or ./mozzo.py or python mozzo.py (if running from source).

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

Set Downtime for a Specific Host

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

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"

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

Service Reporting and Uptime

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

Listing all Services by Host

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

Listing Service Details by Host

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

Uptime Reporting

[!NOTE] Default uptime reporting is 365 days if --days is not specified.

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_json

Contributing

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mozzo-0.4.0.tar.gz (47.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mozzo-0.4.0-py3-none-any.whl (33.9 kB view details)

Uploaded Python 3

File details

Details for the file mozzo-0.4.0.tar.gz.

File metadata

  • Download URL: mozzo-0.4.0.tar.gz
  • Upload date:
  • Size: 47.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mozzo-0.4.0.tar.gz
Algorithm Hash digest
SHA256 55cd3982d10fd254a5f977784d6df538ea530afdf05183ab293f045d3c81e451
MD5 31d7f700d167ce310245f3e234457c03
BLAKE2b-256 288a61d4c79e6f63885f8e38fc1a1c4a1fd4952c369eb227834fb3ab625486f0

See more details on using hashes here.

File details

Details for the file mozzo-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: mozzo-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 33.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mozzo-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 81cd3b185bd7b89775bc40271063c24ae5a10642ace7dfaae5cfe59aa1c74f53
MD5 7e0cd7762d7c3e9e561dc1c1a77e4495
BLAKE2b-256 bccfaa84a40e486c480a7a8fa78ca96a42da0e8a8f1e826e63727b22e61f4813

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page