Filed under: General
I decided to set up some clients to my nagios server today, and found a very easy way of getting it done from source that left me pretty happy. (I’m going to post my commands, and hopefully someone might be able to use what I’ve done in the case that they get stuck or need some help). I did all of the below as the root user, if you are comfortable with using sudo before each command you can do that as well, or just a quick sudo su will put you in the game as root.
#0 The Pre-Requirements:
apt-get install build-essential libssl-dev xinetd
Instead of just leaving it at that, I’ll tell you why you need those three packages (at the least). The build-essential will allow you to compile the source code into viable applications on the linux platform. The libssl-dev package is required in order to compile ssl into your applications, and so that there is a layer of security included in your nagios implementation. The xinetd package is going to be used as the ACL, as well as the internet daemon for the remote plugin.
#1 Download the source code (most recent at posting time):
wget http://superb-west.dl.sourceforge.net/sourceforge/nagios/nrpe-2.12.tar.gz && wget http://internap.dl.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.13.tar.gz
These were the two latest and greatest tarballs available for the project at hand, one is the Nagios Remote Plugin Executor (NRPE), and the other is the nagios plugins source code.
#2 Unzip/Untar source:
tar zxvf nagios-plugins-1.4.13.tar.gz && tar zxvf nrpe-2.12.tar.gz
The .tar.gz at the end of each file represents that A> the file is actually a directory of many files and/or folders, and B> the file was compressed using gzip. Therefore the flags to “untar” it are z (to unzip), x (to extract), v (is verbose just because I like to see stuff on my screen happening and not wondering if the machine is slacking off or not), and f ( to let the command line know that it’s looking for a file).
#3 Change directories nagios-plugins directory:
cd nagios-plugins-1.4.13
This puts us into the correct directory in order to compile the source code that we’ve downloaded.
#5 Set an alias for compilation library links:
export LDLFLAGS=-ldl
This sets an alias which will link the compiler to your dl library for compilation information.
#6 Add nagios user to client to use the plugin/remote executor:
adduser nagios
For the Ubuntu Operating Systems at least 8.04 and newer you shouldn’t have to add the group, but if you are on a different distribution or an older release you may need to usermod -G nagios nagios in order to include the user nagios to the group nagios.
#7 Configure the source code before compiling with custom input:
./configure –with-user-nagios=nagios –with-group-nagios=nagios
At this point you are only adjusting the source code to compile with the user nagios, and group nagios, instead of the root account, or user account that you are currently executing commands with.
#8 Compile the Source Code:
make && make install
These two command will actually compile and install the application for you onto your system, it should only take a few moments, and most of the time if there are any errors they are generally pretty decent about letting you know what you need to correct/fix.
#9 Change ownership:
chown nagios:nagios /usr/local/nagios/ && chown -R nagios:nagios /usr/local/nagios/libexec/
Just making sure that the user nagios, and the group nagios are the rightful owners of the newly created files/directories for future use (reading, writing, executiing, etc…).
#10 Start working on the remote executor (NRPE):
cd ../nrpe-2.12
This simply changes your directory up on, and over to the nrpe-2.12 that should have been downloaded and untar’ed/extracted up in steps #1 and #2.
#11 Setup the source code for compilation:
./configure
This time we won’t be passing along any additional information, and the default configuration should be just fine.
#12 Compiling the source code into a usable application!:
make all && make install-plugin && make install-daemon && make install-daemon-config && make install-xinetd
All of the above will make the required files needed for the NPRE to run, as a daemon, and through xinetd on your local system so that it will be able to connect as a client to your server/host nagios installation.
#13 Edit the configuration file for xinetd to allow the host/server to connect to the client linux machine:
vim /etc/xinetd.d/nrpe
I use the text editor vim for ease of use, and it’s what I am most comfortable with, at the bottom of this file you will see the line that says something along the lines of: only_from = 1.2.3.4 127.0.0.1 where the 1.2.3.4 would actually be your IP address that you are using for your host/server of nagios.
#14 Editing the services file:
vim /etc/services
You should be able to see the pattern that is going on in this configuration sheet, but it basically translates ports to services for netstat, which will prove useful in the next step coming up. For my /etc/services sheet I used this as my entry, and I put it in port order like the rest of them are in (you can call it whatever you want though, and comment it however you’d like as well the 5666/tcp is really the only semi-important portion):
nrpe 5666/tcp # Nagios Remote Plugin Executor
#15 Restart the xinetd service/daemon/application:
/etc/init.d/xinetd restart
On non-debian systems this command is most likely going to look differently as the services are called/invoked in a different manner, however, being that this is an 8.10 guide, this should stop, and then start the xinetd service for you.
#16 Check to ensure that nrpe is running and listening on the correct port (5666):
netstat -at | grep nrpe
Netstat is simply your network status, and using the -a and -t options will show you all traffic (-a) that match the tcp (-t) protocol. Using the | will take that information and pass it on to the next command which is the grep (gnu regular expression parser) for nrpe, the result should be just the one line of netstat that shows that nrpe is infact alive and well and LISTENING for the host/server to reach out and take some information from it.
#17 And finally check to ensure that NRPE is functioning correctly on the localmachine:
/usr/local/nagios/libexec/check_nrpe -H localhost
If you are in the /usr/local/nagios/libexec directory I suppose you can do without the whole entire path, but just for completeness it’s there for you to see, the -H deliniates your “host” machine just to check, and localhost should loop back to the client that you are attempting to set up, and should be done accomplishing at this point.
The rest of the configuration will/would take place on your host/server machine, in so far as adding the host to your linuxhosts.cfg, as well as adding your services that you would like to have chcecked on the remote machine.
Filed under: General
It’s election night. What are people voting for? I highly suspect it’s for the wrong reasons. However, at least they are voting; right? Amendments, Judges, Senate, Congress – so many sects of government that people have no inclination to educate themselves about. It’s sad what can motivate a body of people to make a choice.
On that note – I don’t dislike MIA’s music, in fact I think it’s the best CD I’ve downloaded and burned – I’m going to make it a point to buy the CD now, and give away my burnt copy in hopes of getting someone else to buy it. = )
Great tunes……and an idiocracy incoming! = /
Filed under: General
So many people feel the need to create. Some people create for the enjoyment of others, or the enjoyment of themselves. There are other people who create because of a feeling that they get from it, or a feeling that they can relieve themselves from by creating.
Facades, illusions, appearances, keeping up with the Joneses. Creating falsities seems like the most intricate and delicate of all creations. For those who truly disbelieve in a creator or almighty, it’s odd that even after so many technological and scientific advances, this creation is still strong and durable.
Liars, cheaters, thieves, and killers. All taking something away in order to create something that most people will not enjoy or take happily, yet each and everyday there are countless acts of said creation. We are all creationists surely in our own way, creating.
Is there a joy found when someone creates exactly what they wanted, a happiness discovered when creating more then one aimed for, and a sure sorrow when the goal is unachieved and something altogether is accomplished?
I’m off to the Hilton in Los Angeles for a couple of weeks.
Posted on March 22nd, 2009 by MianoSM
No Comments »