LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 11-09-2009, 04:19 PM   #1
penguin09
LQ Newbie
 
Registered: Oct 2009
Posts: 15

Rep: Reputation: 0
Nagios Question


Hey guys,

I need help, this is probably quite easy but since i am a nagios newbie then it's not so much. I have setup nagios on Fedora 11 and have installed the nsclient++ on a number of workstations and monitoring the usual services that's working fine alerts and all. However, I want to be able to monitor the event logs and have nagios send a notification if there is a warning or critical error generated. Can anyone suggest how i go about getting that configured? Any assistance with this would surely be appreciated.


Thanks.
 
Old 11-10-2009, 01:34 AM   #2
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hello,

There are various ways to check the eventlogs using Nagios. Have a look at these plugins from NagiosExchange.

Kind regards,

Eric
 
Old 11-11-2009, 09:29 AM   #3
penguin09
LQ Newbie
 
Registered: Oct 2009
Posts: 15

Original Poster
Rep: Reputation: 0
Thanks Eric.

Some of these plugins require an additional agent. I was hoping to leverage the already installed NSClient++. I see the nsc.ini has the eventlog.dll enabled so i believe i should be able to use this agent. However, i have no clue how to configure Nagios to do so.
 
Old 11-11-2009, 11:39 AM   #4
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
You're welcome, I'm not at work right now so I cannot look into it at the moment. I do have some Windows servers with NSClient installed running some of those plugins if I'm not mistaking. I'll check tomorrow and let you know. I mostly use the NRPE daemon (which works also great with Windows, running as a service) and those plugins work perfect with that daemon for sure. I'll get back to you tomorrow on the NSClient thing though.

Kind regards,

Eric
 
Old 11-12-2009, 01:40 PM   #5
penguin09
LQ Newbie
 
Registered: Oct 2009
Posts: 15

Original Poster
Rep: Reputation: 0
Hmm, the nsc.ini also has the nrpe.dll listed and i have the nrpe plugin loaded on the nagios server......
 
Old 11-13-2009, 01:38 AM   #6
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hello,

It should work if you have the correct scripts in place and configured the NSClient correctly. I just checked my servers and although I still have NSClient installed on various servers I seem to already have migrated all checks to NRPE.

Kind regards,

Eric
 
Old 11-14-2009, 01:25 PM   #7
penguin09
LQ Newbie
 
Registered: Oct 2009
Posts: 15

Original Poster
Rep: Reputation: 0
ok, can you help me with setting up nrpe on the windows servers then? I already have it installed on nagios server.
 
Old 11-14-2009, 01:45 PM   #8
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hi,

That's easy enough. Download NRPE_NT from here. It's a zip file. In it there's a document named INSTALL.

Quote:
NRPE_NT Install Notes

***
You should at least have the following
nrpe_nt.exe - The nrpe service executable itself
nrpe.cfg - the main config file as with nrpe on ux. Please note that include works, but include_dir will NOT work (yet)...

If you want to use the SSL enabled service, you also need:
ssleay32.dll
libeay32.dll

***
- open nrpe.cfg
- edit the allowed_hosts parameter to match the ip of the box running check_nrpe, multiple addressed may be separated by comma as shown.
- add commands for whatever you would like to test.
- open a command prompt and cd to the dir containing nrpe_nt.exe
- run nrpe_nt -i
this will install nrpe_nt as a service (of course you will need admin rights for this!)

Now you should find "Nagios Remote Plugin Executor for NT/W2K" in your services list, running as local system and with manual startup.

You should now be able to start the service either from control panel/mmc or by running "net start nrpe_nt".

The Application eventlog will show:
one entry per defined command (if debug output is enabled in nrpe.cfg)
one entry "Starting server thread"
one entry "listening on port xxxx" with xxxx = 5666 if you didn't change the default.

If everything worked out so far, nrpe_nt should be up & running, so you can now run a check_nrpe (2.0) from your nagios host.
It's as easy as unpacking the zip file in a directory on your C: drive, opening a command prompt, CD into the directory and type
Code:
nrpe_nt -i
to install it as a service.

Remember though that after every change to the nrpe.cfg file, you'll have to restart the service, if I'm not mistaking.

Kind regards,

Eric
 
Old 11-17-2009, 11:50 AM   #9
rohitmehta
LQ Newbie
 
Registered: Nov 2009
Posts: 9

Rep: Reputation: 1
http://funlinuxfun.blogspot.com/
How to setup Nagios Server on Redhat http://funlinuxfun.blogspot.com/


1. Don't install nagios using RPM,instead download the source code tarballs of both Nagios and the Nagios plugins (visit http://www.nagios.org/download/ for links to the latest versions).
wget http://osdn.dl.sourceforge.net/sourc...s-3.0.3.tar.gz
wget http://osdn.dl.sourceforge.net/sourc...-1.4.11.tar.gz

2. Create Account Information
Become the root user.
su -l

3. Create a new nagios user account and give it a password.
/usr/sbin/useradd -m nagios
passwd nagios

4. Create a new nagcmd group for allowing external commands to be submitted through the web interface. Add both the nagios user and the Apache user to the group.
/usr/sbin/groupadd nagcmd
/usr/sbin/usermod -G nagcmd nagios
/usr/sbin/usermod -G nagcmd apache

5. Extract the Nagios source code tarball.
cd ~/downloads
tar xzf nagios-3.0.3.tar.gz
cd nagios-3.0.3
Run the Nagios configure script, passing the name of the group you created earlier like so:
./configure --with-command-group=nagcmd

6. Compile the Nagios source code.
# make all
Install binaries, init script, sample config files and set permissions on the external command directory.
# make install
# make install-init
# make install-config
# make install-commandmode

7. Customize Configuration
Sample configuration files have now been installed in the /usr/local/nagios/etc directory. These sample files should work fine for getting started with Nagios. You'll need to make just one change before you proceed...
Edit the /usr/local/nagios/etc/objects/contacts.cfg config file with your favorite editor and change the email address associated with the nagiosadmin contact definition to the address you'd like to use for receiving alerts.
vi /usr/local/nagios/etc/objects/contacts.cfg

8. Configure the Web Interface
Install the Nagios web config file in the Apache conf.d directory.
make install-webconf
root@lvs2 nagios-3.0.3]# make install-webconf
/usr/bin/install -c -m 644 sample-config/httpd.conf /etc/httpd/conf.d/nagios.conf

8. Create a nagiosadmin account for logging into the Nagios web interface.
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
Restart Apache to make the new settings take effect.
service httpd restart

9. Compile and Install the Nagios Plugins
Extract the Nagios plugins source code tarball.
cd ~/downloads
tar xzf nagios-plugins-1.4.11.tar.gz
cd nagios-plugins-1.4.11

10. Compile and install the plugins.
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install
Start Nagios

11. Add Nagios to the list of system services and have it automatically start when the system boots.
chkconfig --add nagios
chkconfig nagios on
Verify the sample Nagios configuration files.
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
If there are no errors, start Nagios.
service nagios start

12. Object configuration files
As mentioned, when the configuration files are split up, Nagios reads the data from these files in order for it to process host and service checks across the network. Before I begin, detailed documentation of all of the options for the template based objects are located at the website.

# cd /usr/local/nagios/etc/objects/
# touch hostgroup.cfg hosts.cfg services.cfg

# vi localhost.cfg
Copy the Services Definitions
# vi services.cfg
Paste the Services Definitions

#vi localhost.cfg
Copy the Host Definitions
#vi hosts.cfg
Paste the Host Definitions

#vi localhost.cfg
Copy the Host Definitions
# vi hostgroup.cfg
Paste the hostgroup Definitions

Setting up nagios.cfg

[me@rhel ~] cd /etc/nagios
[me@rhel nagios] mv localhost.cfg localhost.cfg_org
Turn on the allow commands to be executed from the CGI web interface.
[me@rhel nagios] vi nagios.cfg

# OBJECT CONFIGURATION FILE(S)
cfg_file=/etc/nagios/contacts.cfg
cfg_file=/etc/nagios/hostgroups.cfg
cfg_file=/etc/nagios/hosts.cfg
cfg_file=/etc/nagios/services.cfg
cfg_file=/etc/nagios/timeperiods.cfg

# EXTERNAL COMMAND OPTION
check_external_commands=1

# EXTERNAL COMMAND CHECK INTERVAL
command_check_interval=1

I have my sample config to download:http://www.turboupload.com/files/get...mpleconfig.odt
 
Old 11-18-2009, 12:01 PM   #10
penguin09
LQ Newbie
 
Registered: Oct 2009
Posts: 15

Original Poster
Rep: Reputation: 0
Thanks guys i will try to see if i can get nrpe up and running. Don't be too suprised to see more dumb questions... Eric what about this download winrpe?

http://itefix.no/i2/winrpe
 
Old 11-18-2009, 12:10 PM   #11
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Why would you install that? Any particular reason? The first reason I wouldn't install it on one of my servers is the 'extras' that it comes with:
Quote:
It is a packaging of Nagios NRPE addon, Cygwin and a collection of windows specific NRPE plugins for monitoring cpu, disk, memory, eventlog, services and performance counters.
There's no need for Cygwin in order to execute the plugins. So only extra ballast. There are various ways of monitoring a Windows server and the standard plugins that come with the package cover most of them.

But, I've never tried it (winrpe that is; nor will I do so) so I cannot tell you about it.

Kind regards,

Eric
 
Old 11-18-2009, 05:12 PM   #12
penguin09
LQ Newbie
 
Registered: Oct 2009
Posts: 15

Original Poster
Rep: Reputation: 0
I agree, ok i have the NRPE installed as per your instructions on a test box. I now have to go about defining commands i guess. I can run command line and get back a response so that looks good.
 
Old 11-19-2009, 12:08 AM   #13
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
That's indeed a good thing, means you got that one working.

Kind regards,

Eric
 
Old 11-19-2009, 10:35 PM   #14
penguin09
LQ Newbie
 
Registered: Oct 2009
Posts: 15

Original Poster
Rep: Reputation: 0
Eric,

Can i impose upon you to show me an example of a command definition and a service definition that works for you? Can't seem to get the definitons right.....arrghh why is it so hard to do this.....nsclient is way easier!!!
 
Old 11-20-2009, 01:18 AM   #15
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hello,

Of course you can impose for that

On my Windows servers I have the WMI plugins installed (download here). Those use the Microsoft .NET framework and are pretty easy and straightforward. The setup and usage however is very similar so you should be able to find your way.

Using NRPE you can go two ways, use arguments or don't allow the use of arguments. If you don't allow it, then you'll have to hardcode all parameters to the command in the nrpe.cfg file (like I do since it's more secure not to allow arguments).

A command description in nrpe.cfg would look like this:
Code:
command[get_cpu]=cscript.exe //nologo //T:60 c:\nrpe_nt\plugins\v2\check_cpu_load_percentage.vbs -h localhost -inst "*" -w 80 -c 90
This one runs the check_cpu_load_percentage.vbs on the localhost and reports back the status of all cpus (-inst "*"), issues a warning state when the load is 80 or higher and a state of critical when over 90. Don't forget to restart the nrpe_nt service when you changed the configuration.

On the Nagios side I use the GroundWork installation, so everything is handled through a very nice web interface.

The command created on Nagios shows like this in the check_commands.cfg file:
Code:
define command {
        command_name                    check_nrpe_cpu          
        command_line                    $USER1$/check_nrpe -t 60 -H $HOSTADDRESS$ -c get_cpu  
}
So when I link the command to a service and a host, and run it from Nagios (or from the command line for that matter) I get:
Code:
check_nrpe -t 60 -H 172.25.2.18 -c get_cpu

OK - CPU0 'Load Percentage' = 4; OK - _Total 'Load Percentage' = 4; |'CPU0'=4;80;90;; '_Total'=4;80;90;; 

Command returned exit status 0
Hope this helps you on your way. And believe me this isn't that hard, but if you learn how to set this up you'll have the advantage that in a Linux environment it works similar and you'll already know.

Kind regards,

Eric
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Nagios NSclient question Mishra100 Linux - Software 4 11-08-2009 06:44 AM
Nagios question jdimalanta Linux - Software 2 04-04-2009 09:54 AM
Nagios Oracle question investmentbnker75 Linux - General 1 07-30-2008 09:51 AM
Nagios Question? helptonewbie Linux - Software 0 04-22-2008 11:05 AM
LXer: Nagios 2.5 and Oreon 1.3 (Nagios web front end) installation with screenshots LXer Syndicated Linux News 0 08-11-2006 05:33 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 08:19 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration