Page 2 of 3

Re: Completely missing nagios.cmd file in Ubuntu 12.04

Posted: Mon Dec 31, 2012 10:16 pm
by psyllex
I did some messing around and there are a couple things in the new instructions that are completely missing that are necessary to get Nagios 3.4.1 running. The first link http://assets.nagios.com/downloads/nagi ... Source.pdf doesn't include configuring the commands.cfg or contacts.cfg files. In addition the location of a lot of files in not anywhere near where the instructions say they are. Some are under /etc/someFile and some are under /usr/local/nagios/etc/someFIle. It seems as if the installer just kinda throws it wherever. Which leads back to my question before...I made most of this in the /tmp/nagios directory. Which is precisely where the instructions told me to. Not sure if it makes any difference or not. Also, at the end of the installation it doesn't even necessarily say to turn Nagios on. I had to use

Code: Select all

 service nagios start
in order to get it running.

But when I do use the

Code: Select all

http://<myipaddress>/nagios/
now it works but it says my server is down which in one aspect is correct because I don't have it connected to any web server but it is live and connected to the net as I'm accessing it through my linux laptop. So I really am left just as clueless about Nagios as I was at the beginning. If anyone has a clear concise precise set of installations instructions I would be forever grateful.

Re: Completely missing nagios.cmd file in Ubuntu 12.04

Posted: Tue Jan 01, 2013 2:03 pm
by sreinhardt
One could argue that configuration of commands and contacts are out of the scope of the install guide, and likely our reason for keeping them out of the document. I can definitely find some documentation on configuring those for you. I would agree however, that starting the service should be included in that document, and will talk with the author tomorrow about modifying that. As for you server being down, is that saying that the nagios service is down, but you see the correct web interface, or are you still seeing the 404 message from apache? The core documentation, is a bit lengthy, but does cover just about every aspect that you could run into. Otherwise than the web interface, what still has you confused? Admittedly, Nagios can be quite a bit to grasp if you are just learning the system.

Re: Completely missing nagios.cmd file in Ubuntu 12.04

Posted: Tue Jan 01, 2013 3:10 pm
by psyllex
Well, I don't think Nagios will run correctly if the configuration is wrong. Even if the starting command is included. At this point I'm actually completely confused on where to install Nagios Core and Nagios NRPE. As per the instructions you provided...it seems as though I need to set up both nagios core and nrpe on the server I'm trying to monitor. But then I read the core documentation and it looks as though nagios core and nagios nrpe should be on the 'monitoring desktop' and nrpe should be on the server I wish to monitor. It isn't super clear. As you move around in the core documentation it skips around. In nagios core docs it says if you want to monitor a remote server use nrpe .... and then stops. But you get into nrpe and it says download said plugin but it doesn't discuss configuring nagios core (on either machine). So you get two stories that are both incomplete.

My company really needs to get this running sooner than later. They are perfectly willing to pay for support if it's not cryptic and incomplete. I assume that once our project grows we will need to add some paid for addons like XI or something. But before that can happen we need to make sure we can actually get the service running and that it will monitor what we need it to. Please let me know.

Re: Completely missing nagios.cmd file in Ubuntu 12.04

Posted: Tue Jan 01, 2013 6:41 pm
by jsmurphy
Ubuntu has always been the problem child of Nagios installations. Large portions of Nagios are still driven by volunteers (such as me) as the software has its roots as an open source product, it's only somewhat recently that it has become a commercial entity and the limited amount of staff they have make it difficult to keep up with a product like Ubuntu that makes significant changes often. Particularly when it isn't part of the EL distro family which tends to receive most of the focus.

Now moving away from being an apologist for the obvious deficiency in help available for new Ubuntu users, I think it's fair to say that we haven't seen the problems you are facing with your installation and the shotgun attempts using multiple documentation sources is making it harder for you to get working and for anyone reading this to help you. I couldn't work out if you ever actually got Nagios core working before you started installing NRPE.

Would it be possible to make a fresh start, follow the official documentation for installing from the source and make a note of stuff that doesn't work and things that aren't in the documentation or you believe may be mislabelled. This will have the following benefits:
1. We can give you precise feedback on specific problem to get your installation working correctly.
2. The documentation can be amended so that no one else ever has to suffer the same frustrations you did.
3. Bug-fixes can be submitted for correcting the install, if necessary, so that it's a more seamless experience for Ubuntu users.

Although this is extremely frustrating, if we approach this methodically I'm certain we will solve your problem and maybe make life better for Ubuntu users in general :D

Re: Completely missing nagios.cmd file in Ubuntu 12.04

Posted: Tue Jan 01, 2013 7:45 pm
by psyllex
No ... I agree that I should start over. This process needs to be repeatable for my project so I will go ahead and reinstall my server and then start from scratch at the beginning of your installation notes. And then I will submit any issues to you. Which documentation should I use? The one of the website or the one that you sent me?

Re: Completely missing nagios.cmd file in Ubuntu 12.04

Posted: Tue Jan 01, 2013 9:32 pm
by jsmurphy
Use this doco: http://assets.nagios.com/downloads/nagi ... Source.pdf

I haven't sent you any documentation, sreinhardt linked this: http://nagios.sourceforge.net/docs/3_0/toc.html which is a great resource for getting to understand Nagios once it is installed :)

Re: Completely missing nagios.cmd file in Ubuntu 12.04

Posted: Tue Jan 01, 2013 9:39 pm
by psyllex
Ok. Sorry I wasn't paying attention to who sent what. Any special instructions that can help you guys, help guys like myself out?

Re: Completely missing nagios.cmd file in Ubuntu 12.04

Posted: Tue Jan 01, 2013 10:22 pm
by jsmurphy
Nothing out of the obvious I don't think; any error messages you encounter, anything that was difficult to understand or doesn't work when you try it. We don't want to make this too tedious ;)

Re: Completely missing nagios.cmd file in Ubuntu 12.04

Posted: Wed Jan 02, 2013 3:13 pm
by psyllex
Here is a full step by step of my installation. The lines with ** are where things went wrong. I'm not going to try and 'hack' it together. I'll just wait for you to get back to me. I will try out a couple more things on my 2 other servers to see if it will work. In the Ubuntu forums a guy seems to have an crazy extensive installation explanation that he used but on VM's but the installation should apply to regular physical installation. I'll give that a try and see if that is any different. It is not the latest version of nagios though so I'm not sure if that will make a difference.

Here is my installation steps/issues:

////////////////////////////////////////////////////////////////////////////////////////////////////
sudo -i
sudo apt-get install wget (*had to split up this install command as it wasnt' working the way it was written in the docs)
sudo apt-get install build-essential
sudo apt-get install apache2 php5-gd
sudo apt-get install libgd2-xpm libgd2-xpm-dev libapache2-mod-php5
cd /tmp
wget http://prdownloads.sourceforge.net/sour ... 4.1.tar.gz
wget http://sourceforge.net/projects/nagiosp ... .15.tar.gz
useradd nagios
groupadd nagcmd
usermod -a -G nagcmd nagios
tar zxvf nagios-3.4.1.tar.gz
tar zxvf nagios-plugins-1.4.15.tar.gz
cd nagios
./configure --with-nagios-group=nagios --with-command-group=nagcmd -–with-mail=/usr/bin/sendmail

*this is where things go wrong. the comand "--with-mail=/usr/bin/sendmail" get this error message: "configure: error: unrecognized option: -–with-mail=/usr/bin/sendmail"

*So I used ./configure --with-nagios-group=nagios --with-command-group=nagcmd
eliminating the --with-mail=/usr/bin/sendmail but this allowed it to run ./configure

make
make
make
make
make
make
all
install
install-init
install-config
install-commandmode
install-webconf
cp -R contrib/eventhandlers/ /usr/local/nagios/libexec/
chown -R nagios:nagios /usr/local/nagios/libexec/eventhandlers
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
/etc/init.d/nagios start
htpasswd –c /usr/local/nagios/etc/htpasswd.users nagiosadmin

*for whatever reason this command wouldn't run so I did the following
*cd /usr/local/nagios/etc ... then htpasswd -c htpasswd.users nagiosadmin
* I have no idea why it didn't work with the original command.

cd /tmp/nagios-plugins-1.4.15
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install
ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios
**ln: failed to create symbolic link `/etc/rcS.d/S99nagios': File exists
** I'm not exactly sure why this didn't work as planned. I completely erased all traces of the former nagios installation so there shouldn't have been a S99nagios file created already.
** I looked withini /etc there is no "rcS.d" directory. There is a rc'5'.d directory. So I ran the cmd using that directory and it worked fine.


**So after doing that final command I went to http://<your.nagios.server.ip>/nagios which didn't work . I get the following: "The requested URL /nagios was not found on this server."

**I double check with: "http://<your.nagios.server.ip>/nagios/" which didn't work either gave me the same error message. I thought perhaps it was the "ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios" command that I changed to rc'5'.d (without the quotes of course); but the oringal error after running that command according to the documentation was that the file already exists. So if it already exists, and is the correct command (not the one with the 'five') then it should be working. Unfortunately it isn't.

**One thing I did notice about this set of installation instructions is that it contains no changes to the config files to include my email address or anything to send myself updates. I don't quite remember exacty which files I changed before but I do remember doing that step when I got it running before.

**So status is: It installed completely. It has actually been run. But it is not working within the web browser at this time.

**I reboot my system and tried to run /etc/init.d/httpd start and got the following message: "Starting nagios:CONFIG ERROR! Start aborted. Check your Nagios configuration." Which in fact as the installation instructions said that we set it up to have nagios start on boot....this shouldn't really have been a necessary step.
///////////////////////////////////////////////////////////////////////////////////////////////////////

Re: Completely missing nagios.cmd file in Ubuntu 12.04

Posted: Wed Jan 02, 2013 4:02 pm
by sreinhardt
Two major suggestions, instead of wiping out a current install of nagios, do a complete reinstall of Ubuntu. There are a lot of traces left over and things put in non-nagios standard places when doing a packaged install. The other major thing I would suggest is sudo su, truely run everything as root instead of some with and some without. By the end of the setup, everything should work just fine as nagios or root user when making modifications.

Code: Select all

./configure --with-nagios-group=nagios --with-command-group=nagcmd -–with-mail=/usr/bin/sendmail

*this is where things go wrong. the comand "--with-mail=/usr/bin/sendmail" get this error message: "configure: error: unrecognized option: -–with-mail=/usr/bin/sendmail"

*So I used ./configure --with-nagios-group=nagios --with-command-group=nagcmd
eliminating the --with-mail=/usr/bin/sendmail but this allowed it to run ./configure
Can you verify that sendmail is installed, I believe that it would be installed with the apt-get command that you had to break up

Code: Select all

htpasswd –c /usr/local/nagios/etc/htpasswd.users nagiosadmin

*for whatever reason this command wouldn't run so I did the following
*cd /usr/local/nagios/etc ... then htpasswd -c htpasswd.users nagiosadmin
* I have no idea why it didn't work with the original command.
Wondering about permissions again, normally we suggest everything be run as root.

Code: Select all

ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios
**ln: failed to create symbolic link `/etc/rcS.d/S99nagios': File exists
** I'm not exactly sure why this didn't work as planned. I completely erased all traces of the former nagios installation so there shouldn't have been a S99nagios file created already.
** I looked withini /etc there is no "rcS.d" directory. There is a rc'5'.d directory. So I ran the cmd using that directory and it worked fine. 
You certainly should have an /etc/rcS.d. From my understanding, that is used to load the last services once a system is fully started. Again though, I might point towards access permissions as you definitely need to be root to modify anything there.

Code: Select all

**I double check with: "http://<your.nagios.server.ip>/nagios/" which didn't work either gave me the same error message. I thought perhaps it was the "ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios" command that I changed to rc'5'.d (without the quotes of course); but the oringal error after running that command according to the documentation was that the file already exists. So if it already exists, and is the correct command (not the one with the 'five') then it should be working. Unfortunately it isn't. 
Did you run a "service apache2 restart"? If the nagios service command is not working you can also run "/usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg"

Code: Select all

**One thing I did notice about this set of installation instructions is that it contains no changes to the config files to include my email address or anything to send myself updates. I don't quite remember exacty which files I changed before but I do remember doing that step when I got it running before. 
Again, technically out of the scope of that document. The configs that come with nagios are correct and should start the daemon just fine. However, to get things the way that you want and sending the alerts as you would like, you are correct that you will need to modify them.

Code: Select all

**I reboot my system and tried to run /etc/init.d/httpd start and got the following message: "Starting nagios:CONFIG ERROR! Start aborted. Check your Nagios configuration." Which in fact as the installation instructions said that we set it up to have nagios start on boot....this shouldn't really have been a necessary step. 

This would inidcate, opposed to the above message, that you did need to restart apache to get it to find the nagios web directories. Considering the error regarding nagios configs, please run "/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg" to verify the configs present, and send us the output.