commands.cfg

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
dawsoad
Posts: 10
Joined: Thu Jul 07, 2011 9:11 am

commands.cfg

Post by dawsoad »

Hello,

I am trying to add commands to the commands.cfg, but without realizing it; probably because I did not read the comments at the top of the file, this file gets overwritten everytime the "Apply Configuration" button is clicked in the Nagios Web Interface. Which is not an issue as long as I use the Core Configuration Manager to add commands in the web interface provided. However, I would prefer to edit the configuration files by hand if at all possible.

Could someone please tell which file or files I need to update in order for commands to be properly add to the commands.cfg file? Also, on my RHEL virutal machine that Nagios XI is installed on the path to the commands.cfg file is '../usr/local/nagios/etc/commands.cfg'. Is this correct location I should be looking? Most of the online sources say the file should exist under '../usr/local/nagios/etc/objects/commands.cfg', but apparently I do not have an 'objects' directory. Any help with this would be appreciated. Thanks.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: commands.cfg

Post by lmiltchev »

If you would like to edit your configuration files by hand, you will have to place your config files (for manual editing) in your /usr/local/nagios/etc/static directory. This way, they won't get overwritten every time you click on Apply Configuration in the Nagios Web interface. But you will have to always edit these config files manually.
The path to your commands.cfg file (/usr/local/nagios/etc/commands.cfg) is a valid path, so you don't have to worry about it.
Be sure to check out our Knowledgebase for helpful articles and solutions!
dawsoad
Posts: 10
Joined: Thu Jul 07, 2011 9:11 am

Re: commands.cfg

Post by dawsoad »

Thanks. That does clarify some things. However, do you know by chance what the web interface is using to update the commands.cfg file? If I knew that, I may be able update/manipulate it to get my desired results. I noticed that I can add commands through the web interface and they show up in commands.cfg file permantly no matter how many times I hit "Apply Configuration". There must be some way to accomplish that does not involve the using the web interface.

I will look into adding files to the "static" directory as you mentioned and see if it will suit my needs. Any more info you can give will be appreciated.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: commands.cfg

Post by lmiltchev »

The commands are written through the Nagios Core Config Manager. You can manually create and edit your config files, and also verify your configuration, making sure you don't have any configuration errors. For more info you can take a look at this document:
http://assets.nagios.com/downloads/nagi ... _Files.pdf.
Be sure to check out our Knowledgebase for helpful articles and solutions!
dawsoad
Posts: 10
Joined: Thu Jul 07, 2011 9:11 am

Re: commands.cfg

Post by dawsoad »

Ok. Let me look into this further; I've been experimenting a lot lately with Nagios. I was just hoping there was a way through the console window to manipulate the Core Configuration Manager.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: commands.cfg

Post by lmiltchev »

I see what you mean but this "manipulation of the Core Config Manager" is by design.
Let us know if you have any more troubles.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked