Skip to content

Instantly share code, notes, and snippets.

@russellvt
Last active May 8, 2023 09:24
Show Gist options
  • Save russellvt/051fa43592778a41e53cb423b791bab6 to your computer and use it in GitHub Desktop.
Save russellvt/051fa43592778a41e53cb423b791bab6 to your computer and use it in GitHub Desktop.
Installing PNP4Nagios from Source

Installing PNP4Nagios from Source

Current Status: Draft

This hopes to help with installing PNP4Nagios from source (from my own repository).

By default, this install everything under the /usr/local/pnp4nagios directory.

The first line assumes you want a pnp4nagios directory IN your own home directory. You should modify as necessary.

It also assume Nagios/Icinga Daemon is running under a nagios user and a nagios group. YMMV. Modify accordingly.

  1. Install Dependencies (TODO)
  2. cd ; git clone https://github.com/russellvt/pnp4nagios.git
  3. cd pnp4nagios

Note: ./man/npcd.8 is generated by ./configure and removed with make clean

  1. make clean
  2. ./configure --with-nagios-user=nagios --with-nagios-group=nagios
  3. make all

While make install works, it may fail in certain situations (Read: Some things may not install right).

  1. sudo make install

A more-complete install:

  1. sudo make install-webconf
  2. sudo make install-config
  3. sudo make install-init

Enabling and Configuring NPCD

The NPCD (Nagios Perfdata C daemon) service needs to be configured to run on startup.

  • systemctl daemon-reload
  • systemctl enable npcd.service
  • systemctl start npcd.service

Observed/Known Bugs/Issues

  • NPCD may not start "the first time" after Source installation (system package not tested)
  • For make install the following errors are observed (Debian 8):
  • Makefiles should regenerate npcd.8 if it has not been created/compiled
% cd ./man && make install
make[1]: Entering directory '/dir/to/project/pnp4nagios/man'
/usr/bin/install -c -m 755 -o nagios -g nagios -d /usr/local/pnp4nagios/man/man8
/usr/bin/install -c -m 755 -o nagios -g nagios npcd.8 /usr/local/pnp4nagios/man/man8
/usr/bin/install: cannot stat ‘npcd.8’: No such file or directory
Makefile:21: recipe for target 'install' failed
make[1]: *** [install] Error 1
make[1]: Leaving directory '/dir/to/project/pnp4nagios/man'
Makefile:144: recipe for target 'install' failed
make: *** [install] Error 2
  • For make install-webconf the following errors are observed (Debian 8):
% sudo make install-webconf
cd ./sample-config && make install-webconf
make[1]: Entering directory '/path/to/project/pnp4nagios/sample-config'
/usr/bin/install -c -m 755 -d /etc/httpd/conf.d
/usr/bin/install -c -m 644 httpd.conf /etc/httpd/conf.d/pnp4nagios.conf
/usr/bin/install: cannot stat ‘httpd.conf’: No such file or directory
Makefile:82: recipe for target 'install-webconf' failed
make[1]: *** [install-webconf] Error 1
make[1]: Leaving directory '/path/to/project/pnp4nagios/sample-config'
Makefile:123: recipe for target 'install-webconf' failed
make: *** [install-webconf] Error 2
  • Seriously??? (TLDR: It's /etc/apache2 on Debian family boxes)
% sudo make install-config
cd ./sample-config && make install-config
make[1]: Entering directory '/path/to/project/pnp4nagios/sample-config'
/usr/bin/install -c -m 755 -o nagios -g nagios -d /usr/local/pnp4nagios/etc
/usr/bin/install -c -m 755 -o nagios -g nagios -d /usr/local/pnp4nagios/etc/check_commands
/usr/bin/install -c -m 755 -o nagios -g nagios -d /usr/local/pnp4nagios/etc/pages
/usr/bin/install -c -m 644 -o nagios -g nagios  pnp/config.php /usr/local/pnp4nagios/etc/config.php.0.6.26; \
/usr/bin/install -c -m 644 -o nagios -g nagios  pnp/config.php /usr/local/pnp4nagios/etc; \

/usr/bin/install: cannot stat ‘pnp/config.php’: No such file or directory
/usr/bin/install: cannot stat ‘pnp/config.php’: No such file or directory
Makefile:49: recipe for target 'install-config' failed
make[1]: *** [install-config] Error 1
make[1]: Leaving directory '/path/to/project/pnp4nagios/sample-config'
Makefile:111: recipe for target 'install-config' failed
make: *** [install-config] Error 2
  • This isn't SysV / systemd aware...
% sudo make install-init
cd ./scripts && make install-init
make[1]: Entering directory '/path/to/project/pnp4nagios/scripts'
/usr/bin/install -c -m 755 -o root -g root -d /etc/init.d
/usr/bin/install -c -m 755 -o root -g root rc.npcd /etc/init.d/npcd
/usr/bin/install -c -m 755 -o root -g root rc.pnp_gearman_worker /etc/init.d/pnp_gearman_worker
make[1]: Leaving directory '/path/to/project/pnp4nagios/scripts'

Features

  • Intentional difference between make clean and make distclean (Document)

References:

A list of some of the references I may have used in the creation of this guide, in no particular order.

Some may be used more than others, or some not-at-all. I will fix these later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment