Increase Timeout for systemd supporting legacy init.d nagios

An open discussion forum for obtaining help with Nagios Core. Nagios Core users of all experience levels are welcome here. Subforum have been created for the discussion of Nagios Core and Nagios Plugin development.

NOTE: The SourceForge.net mailing lists have been deprecated in favor of this forum in order to expedite support and provide additional features not available on the old mailing list.

Increase Timeout for systemd supporting legacy init.d nagios

Postby Pradeeps » Thu Jan 31, 2019 9:33 am

Hello Folks,

I am dealing with a weird issue (atleast to me).
I am running nagios-core 4.2.4 and its using init.d script through systemd.

Code: Select all
[root@nagios-core ~]# systemctl status nagios
● nagios.service - LSB: Starts and stops the Nagios monitoring server
   Loaded: loaded ([b]/etc/rc.d/init.d/nagios[/b]; bad; vendor preset: disabled)
   Active: active (running) since Thu 2019-01-31 06:55:27 UTC; 7h ago
     Docs: man:systemd-sysv-generator(8)
  Process: 49673 ExecStop=/etc/rc.d/init.d/nagios stop (code=exited, status=0/SUCCESS)
  Process: 50505 ExecStart=/etc/rc.d/init.d/nagios start (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/nagios.service
           ├─52109 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
           ├─52111 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh



As per my understanding "systemd-sysv-generator" creates a service unit for the scripts under "etc/rc.d/init.d/" which is supported by systemd. However I am trying to increase the timeout value of nagios service when started through systemd. The default is 5mins but considering number of devices/services it sometime takes more than that and fails.

Usually for the "nagios.service" under systemd I use "TimeoutSec=15min" to incerease the timeout. However I am not sure how to do this for this one. Can anyone shed some light on this please?
Pradeeps
 
Posts: 32
Joined: Thu Dec 22, 2016 11:05 am

Re: Increase Timeout for systemd supporting legacy init.d na

Postby scottwilkerson » Fri Feb 01, 2019 11:36 am

It looks like there is a solution here
https://unix.stackexchange.com/questions/186162/how-to-change-timeout-in-systemctl

you would create a file /etc/systemd/system/nagios.service.d/reduce-timeout.conf
with contents something like this
Code: Select all
[Service]
TimeoutStartSec=600
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 14072
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Re: Increase Timeout for systemd supporting legacy init.d na

Postby Pradeeps » Fri Feb 08, 2019 8:41 am

I have made changes in "/usr/lib/systemd/system/nagios.service" since I see nagios daemon uses that file to load. Is it not he proper location?

Code: Select all
[Unit]
Description=Nagios Core 4.4.2
Documentation=https://www.nagios.org/documentation
After=network.target local-fs.target

[Service]
Type=forking
ExecStartPre=/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
ExecStart=/usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
ExecStop=/usr/bin/kill -s TERM ${MAINPID}
ExecStopPost=/usr/bin/rm -f /usr/local/nagios/var/rw/nagios.cmd
ExecReload=/usr/bin/kill -s HUP ${MAINPID}
TimeoutSec=15min

[Install]
WantedBy=multi-user.target
Pradeeps
 
Posts: 32
Joined: Thu Dec 22, 2016 11:05 am

Re: Increase Timeout for systemd supporting legacy init.d na

Postby scottwilkerson » Fri Feb 08, 2019 8:46 am

Looks like you changed version to 4.4.2 now which contains the systemd file. This should work fine
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 14072
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises


Return to Nagios Core

Who is online

Users browsing this forum: Google [Bot] and 35 guests