How to Install and Configure pnp4nagios for Nagios Performance Graphs
This guide walks through installing pnp4nagios on CentOS 6.8, configuring required packages, compiling the software, testing the installation, understanding its bulk mode with npcd, and adjusting Nagios and pnp4nagios settings to enable dynamic performance graphs.
nagios can display collected performance data as graphs similar to Zabbix or Cacti; pnp4nagios is a plugin that provides this functionality.
System environment: OS CentOS 6.8 (2.6.32-642.el6.x86_64) with internet access for yum, etc.
1. Get pnp4nagios
Download the package from the official pnp4nagios website (the author also provides a Baidu Cloud link, password: ayhk).
2. Install pnp4nagios
Prerequisites: perl and rrdtool (installable via yum) and Apache with mod_rewrite enabled.
Install the required packages (list shown in the image).
Extract the tarball, run ./configure, then make and make install as illustrated.
Run make fullinstall, which performs three sub‑commands: make install-webconf – copies pnp4nagios.conf to /etc/httpd.conf.d/. make install-config – copies process_perfdata.pl and npcd configuration files to /etc/pnp/. make install-init – installs the npcd init script.
3. Test the installation
Restart the web service and verify the environment. Open a browser and visit http://localhost/pnp4nagios; a page with performance graphs should be displayed (see screenshots).
4. Understand pnp4nagios work modes
pnp4nagios supports sync mode, bulk mode, bulk mode with npcd, bulk mode with npcd and npcdmod, and gearman mode. This tutorial uses “bulk mode with npcd”, which decouples data collection from processing, improving Nagios efficiency.
Viewing from Nagios this is the best way of processing because Nagios will not be blocked. Nagios again uses a temporary file to store the data and executes a command after expiration of a certain time. Instead of immediate processing by process_perfdata.pl the file is moved to a spool directory. As moving a file inside the same filesystem nearly takes no time Nagios is able to execute crucial work immediately. The NPCD daemon (Nagios Performance C Daemon) will monitor the directory for new files and will pass the names to process_perfdata.pl . Processing of performance data is decoupled completely from Nagios. NPCD itself is able to start multiple threads for processing the data.
5. Configure pnp4nagios and Nagios
Edit /usr/local/nagios/etc/nagios.cfg:
Enable performance data processing.
Set the performance data file location, format template, write mode and processing interval (see images).
Define commands in commands.cfg for processing these files (see images).
Set action_url in host and service templates to link to pnp4nagios graphs.
Check /usr/local/pnp4nagios/etc/npcd.cfg for correct user (nagios) and script paths.
Enable the npcd service to start on boot and start it (see image).
Validate Nagios configuration with
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfgand reload Nagios with service nagios reload.
6. Observe graph output
After adding action_url, a small icon appears next to hosts and services in the Nagios web UI; clicking the icon displays dynamic performance graphs (screenshots).
7. Further resources
pnp4nagios documentation covers advanced features such as regular‑expression matching, custom pages, and data export. Refer to the official website for detailed information.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
