GNU/Linux >> Znalost Linux >  >> Cent OS

Nelze spustit službu Nagios (CentOS/RHEL)

Problém

Po restartu nelze spustit službu Nagios Network Monitoring.

-- 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

Řešení

V souboru „/etc/nagios/nagios.cfg “, parametr lock_file byl nastaven na „/var/run/nagios/nagios.pid “. V CentOS/RHEL se nedoporučuje zapisovat do /var/run, protože /var/run je obvykle připojen jako tmpfs, což je oddíl namapovaný do vaší RAM. Je zřejmé, že RAM se po restartu vymaže, stejně jako všechny systémy souborů tmpfs. Soubor „/var/run/nagios/nagios.pid“ tedy nebyl nalezen.

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

V /etc/nagios/nagios.cfg by měl parametr „lock_file“ ukazovat na adresář, kde jsou data trvalá i po restartu. Toto je soubor zámku, který Nagios použije k uložení čísla PID, když běží v režimu démona. Změňte parametr lock_file z „/var/run/nagios/nagios.pid“ na „/nagios/nagios.pid“.

Uložte změny a restartujte službu „nagios“.


Cent OS
  1. Automaticky spusťte službu OpenCA přes Systemd v CentOS 7

  2. CentOS / RHEL 7:nelze spustit službu vsftpd

  3. CentOS / RHEL 7:Nelze spustit službu Samba

  1. Jak restartovat síťovou službu na CentOS 8 nebo RHEL 8

  2. Nelze spustit služby RDMA na CentOS/RHEL 7

  3. Nelze spustit službu postgresql na CentOS 7

  1. Firewalld se na CentOS 8 s DBusException nespustí

  2. CentOS / RHEL 7 :Nelze spustit/povolit iptables

  3. CentOS / RHEL :Jak nainstalovat a spustit službu Apache httpd