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

The Geek Diary

CONCEPTS | BASICS | HOWTO

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • Linux Services
    • VCS
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
    • Data Guard
  • DevOps
    • Docker
    • Shell Scripting
  • Interview Questions
  • 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. How to use the ssh-keygen Command in Linux
  2. How To Separate Each Of Syslog Client’s Messages Into Different File (CentOS/RHEL 6 and 7)
  3. How to Partition DM-Multipath Pseudo Devices in CentOS/RHEL
  4. lsof : Most commonly used examples
  5. CentOS/RHEL – How to Remove stale ISCSI Target Node Information from ISCSI Initiator Server
  6. CentOS / RHEL 6 : How to completely remove device mapper multipath (dm-multipath)
  7. “kernel: INFO: task {PROCESS}:{PID} blocked for more than 120 seconds.” – CentOS/RHEL Troubleshooting
  8. How to Switch Password Algorithm on CentOS/RHEL
  9. How to activate a “SUSPENDED” LVM physical volume
  10. How to interpret Linux martian source messages

You May Also Like

Primary Sidebar

Recent Posts

  • How to disable ICMP redirects on CentOS/RHEL
  • What are Oracle Key Vault Roles
  • What Is Oracle Key Vault
  • Auditing with Oracle Database Vault Reports
  • Archives
  • Contact Us
  • Copyright

© 2021 · The Geek Diary