• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

Unable to start Nagios Service (CentOS/RHEL)

by admin

The Problem

Unable to start Nagios Network Monitoring service after reboot.

-- var/log/messages ----

May 6 09:14:28 [hostname] nagios: Checking global event handlers...
May 6 09:14:28 [hostname] nagios: Checking obsessive compulsive processor commands...
May 6 09:14:28 [hostname] nagios: Checking misc settings...
May 6 09:14:28 [hostname] nagios: Total Warnings: 0
May 6 09:14:28 [hostname] nagios: Total Errors: 0
May 6 09:14:28 [hostname] nagios: Things look okay - No serious problems were detected during the pre-flight check
May 6 09:14:28 [hostname] nagios: Failed to obtain lock on file /var/run/nagios/nagios.pid: No such file or directory
May 6 09:14:28 [hostname] nagios: Bailing out due to errors encountered while attempting to daemonize... (PID=9029)
May 6 09:14:28 [hostname] systemd: nagios.service: control process exited, code=exited status=254
May 6 09:14:28 [hostname] systemd: Failed to start Nagios Network Monitoring.
May 6 09:14:28 [hostname] systemd: Unit nagios.service entered failed state.
May 6 09:14:28 [hostname] systemd: nagios.service failed.
$ less installed-rpms | grep nagios
nagios-4.3.4-3.el7.x86_64 Mon Feb 18 14:30:00 2019
nagios-common-4.3.4-3.el7.x86_64 Mon Feb 18 14:29:59 2019

The Solution

In file “/etc/nagios/nagios.cfg“, the lock_file parameter was set to “/var/run/nagios/nagios.pid“. In CentOS/RHEL, it is not recommended to write into /var/run as /var/run is usually mounted as tmpfs, which is a partition mapped into your RAM. Obviously RAM gets cleared on reboot, so do all tmpfs file systems. Hence, the file “/var/run/nagios/nagios.pid” could not be found.

# cat /etc/nagios/nagios.cfg
lock_file=/var/run/nagios/nagios.pid

In /etc/nagios/nagios.cfg, “lock_file” parameter should point to a directory where data is persistent across reboot. This is the lockfile that Nagios will use to store its PID number in when it is running in daemon mode. Change the lock_file parameter from “/var/run/nagios/nagios.pid” to “/nagios/nagios.pid”.

Save the changes and restart the “nagios” service.

Filed Under: CentOS/RHEL 6, CentOS/RHEL 7, Linux

Some more articles you might also be interested in …

  1. a2query: command not found
  2. sox: command not found
  3. “git sizer” Command Examples
  4. sinfo: command not found
  5. krita Command Examples in Linux
  6. How to Control user access to Virtual Machine in RedHat Virtualization
  7. dracut: command not found
  8. viewnior Command Examples in Linux
  9. git pr: Check out GitHub pull requests locally
  10. “git verify-tag” Command Examples

You May Also Like

Primary Sidebar

Recent Posts

  • glab Command Examples
  • “glab repo” Command Examples
  • “glab release” Command Examples
  • “glab pipeline” Command Examples

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright