systemctl versus init.d

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
onegative
Posts: 175
Joined: Tue Feb 17, 2015 12:06 pm

systemctl versus init.d

Post by onegative »

G 'Day Nagios Support,

Question. I understand how systemd is replacing the /etc/init.d scripts for service startups in RHEL7 and notice how the latest release of httpd.service when installing Nagios XI. So I have a question about that...I recently installed Nagios XI on a fresh clean system and have noticed that ndo2db utilized both systemd and /etc/init.d script. The reason I ask is that I stopped ndo2db using the init.d script and then restarted it but thereafter my localhost monitoring using "/usr/local/nagiosxi/scripts/manage_services.sh status ndo2db" began failing and it wasn't until I stopped ndo2db and then used systemctl to start it did it get its status correct. My guess is because systemctl expects the service to be started using itself and not a direct call from the /etc/init.d/ndo2db script. When I tried using the command manually

So in the latest nagiosxi release should ndo2db be started from within multi-user.target.wants and not the /etc/init.d/ndo2db script?

Trying to understand why its being defined in both?

Let me know and thanks,
Danny
Last edited by onegative on Mon Aug 14, 2017 2:06 pm, edited 1 time in total.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: systemctl versus init.d

Post by scottwilkerson »

If you are on a CentOS 7 system it will ecpect you are using

Code: Select all

systemctl start ndo2db
As you noted, XI uses a wrapper script that accomplishes the same task, and you could use it as well

Code: Select all

/usr/local/nagiosxi/scripts/manage_services.sh start ndo2db
This is what will always be used by the UI in XI
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
onegative
Posts: 175
Joined: Tue Feb 17, 2015 12:06 pm

Re: systemctl versus init.d

Post by onegative »

Hi Scott,

Yes I understand how to start it using systemctl but my question was "Why did the installation define both the /etc/init.d/ndo2db and systemd entry?"

As I stated previously if you find/use the init.d script to stop/start the ndo2db service the systemctl command no longer recognizes that the service is running when executing the manage_services.sh script and thus shows the service in an UNKNOWN state (warning) from the localhost monitoring within Nagios XI.

Just letting you all know that the installer places both entries and having the /etc/init.d/ndo2db script in place causes confusion like it did for me when I stop/started ndo2db from the init script and not the systemctl command.

This was just FYI...for others to consider...and perhaps let the developers/deployment team to consider this information in future releases.

Resolved.

Thanks...
Danny
Locked