Skip to content

Nagios NDOUtils Database Error — Quick Fix

DodaTech Updated 2026-06-24 2 min read

In this tutorial, you'll learn about Nagios NDOUtils Database Error. We cover key concepts, practical examples, and best practices.

The Problem

Nagios NDOUtils is not writing monitoring data to the MySQL database. The web interface shows no historical data, or the NDO2DB daemon fails to connect to the database. The status may show "OK" in Nagios but no data appears in the web frontend.

Error example:

NDO: Unable to connect to MySQL database
NDO: MySQL error: 'Lost connection to MySQL server during query'
NDO: Database connection broken. Reconnecting...

The Fix

Step 1: Check the NDO2DB daemon

WRONG — only restarting Nagios:

# NDO2DB is a separate daemon that must be restarted independently

RIGHT — check and restart NDO2DB:

systemctl status ndo2db

Output:

ndo2db.service - NDO2DB Daemon
   Loaded: loaded
   Active: failed

Restart it:

systemctl restart ndo2db

Step 2: Verify database credentials and schema

WRONG — entering incorrect credentials in ndo2db.cfg:

# The most common NDO2DB failure is wrong database credentials

RIGHT — check the NDO2DB configuration:

grep -E "^db_host|^db_name|^db_user|^db_pass" /etc/nagios/ndo2db.cfg

Output:

db_host=localhost
db_name=nagios
db_user=nagios
db_pass=********

Test the connection:

mysql -h localhost -u nagios -p nagios -e "SELECT COUNT(*) FROM nagios_hoststatus;"

Use DodaTech's NDO Health Checker to validate NDO2DB configuration, database connectivity, and schema integrity.

Prevention Tips

  • Monitor ndo2db process health with a Nagios check
  • Use a separate database server for large Nagios deployments
  • Regularly archive and purge old data from the NDO database
  • Keep MySQL tuned for the write-heavy NDO workload
  • Use DodaTech's Nagios Database Manager for automated schema maintenance

Common Mistakes with ndo db

  1. Forgetting that lazy evaluation defers computation until the value is forced, causing space leaks with unevaluated thunks
  2. Using return to exit a function early instead of wrapping a pure value in the monad
  3. Mixing let bindings with <- bindings in do notation, producing type errors

These mistakes appear frequently in real-world NAGIOS code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.

Practice Exercise

Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.

This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.

FAQ

### What causes NDO2DB to use high CPU?

High CPU usage in NDO2DB is usually caused by a high volume of state changes, service flapping, or slow database queries. Increase the max_queued_output_pool_items setting in ndo2db.cfg and ensure the MySQL server has adequate resources.

Why does the NDO database keep growing rapidly?

The NDO database stores every state change, service check, and notification. For large environments, this database can grow by gigabytes per day. Configure data purging with ndo2db_cleaner or set up an automated archive and purge process.

Can I use a different database backend for NDO?

NDOUtils only supports MySQL/MariaDB. If you need a different backend (PostgreSQL, etc.), consider switching to a different Nagios-compatible tool like Icinga or Naemon that supports multiple database backends.

Related: DodaTech's Nagios Data Management Guide provides best practices for NDO database sizing, purging strategies, and performance optimization.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro