Page 1 of 1

The cmd "service nagios checkconfig" doesn't work

Posted: Mon Sep 11, 2017 8:25 pm
by t3dus
I'm having a problem after a fresh reinstal of nagios where the command below results in an error. I'm not sure how to fix it.

Code: Select all

# service nagios checkconfig
Running configuration check...
ERROR: Could not create or update '/usr/local/nagios/var/nagios.configtest'
but if I do

Code: Select all

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
it works fine.

Clearly I like the shorter method of using "service nagios checkconfig" better than trying to remember that 2nd line above. How do I resolve this?

Re: The cmd "service nagios checkconfig" doesn't work

Posted: Tue Sep 12, 2017 7:39 am
by scottwilkerson
There is a but in 4.3.4 that has been identified by a few other users with this same issue.

Our developers are working on a fix for the next release.

Re: The cmd "service nagios checkconfig" doesn't work

Posted: Tue Sep 12, 2017 7:44 am
by t3dus
Is there a way I can at least make

Code: Select all

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
into something more remember-able?

Re: The cmd "service nagios checkconfig" doesn't work

Posted: Tue Sep 12, 2017 7:48 am
by t3dus
NM i figured out a work around.. This is what I did..

On your home folder (you could also do this in the root folder):

Code: Select all

nano .bash_aliases
Enter the command for nagios checkconfig:

Code: Select all

alias nagioscheckconfig='/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg'
After saving the file reconfigure your bashrc

Code: Select all

. ~/.bashrc
And check your new alias is loaded

Code: Select all

alias
That's it, you can check config by typing

Code: Select all

nagioscheckconfig

Re: The cmd "service nagios checkconfig" doesn't work

Posted: Tue Sep 12, 2017 9:00 am
by scottwilkerson
t3dus wrote:NM i figured out a work around.. This is what I did..
Thanks for sharing the technique!

Re: The cmd "service nagios checkconfig" doesn't work

Posted: Tue Sep 12, 2017 12:29 pm
by t3dus
scottwilkerson wrote:Thanks for sharing the technique!
No problem. I just can't ever remember that long check method so I had to come up with a work around. :) I'm sure others might have the same issue.