Software Development
Services
We offer offshore software development, e business consulting and web design services. We specialize in PHP/Perl Development as well as LAMP technologies...
Read More...Creative Arts
Bring life to your imagination and dreams. Our innovative creative arts team transforms your ideas and visions to inspirational and unique Graphics design. We focus on HTML and full Flash/Flex based site design. We follow international standards in design and coding, to ensure multi browser compatibility.
Read More...Moneyback Guarentee
Moneyback Guarantee on all support plans incase you're not satisfied with our service.
Read More...Affiliate Programme
Start making money from advertising. Partner with us and earn upto 20% in every recurring payment made by your referral. Partner with us to make your every dream a reality...
Read More...Installing Nagios on CentOS 4.x/5.x
This document will breeze through installing and configuring everything necessary to get Nagios up and running. This will not touch in detail on the actual configuration directives Nagios uses. For that, documentation is readily available from the Nagios website, or available locally after Nagios is installed. This also assumes you already have a working e-mail server in your existing network as well. That’s how notifications will get sent, and that’s beyond the scope of this.
System:
CentOS 4.x/5x (Should work for any RHEL/Fedora flavor)
Nagios: version 3.0
References:
Nagios: http://www.nagios.org/
Official Docs: http://nagios.org/docs/
Community Docs: http://wiki.centos.org/Repositories
Nagios Exchange: http://www.nagiosexchange.org/
Web Interfaces: http://www.nagios.org/faqs/viewfaq.php?faq_id=183
Visualization additions: http://www.nagvis.org/
Packages/Dependencies:
Nagios Packages:
- nagios-2.9-1.el4.rf
- nagios-devel-2.9-1.el4.rf
- nagios-plugins-nrpe-2.5.2-1.el4.rf
- nagios-plugins-1.4.8-2.el4.rf
Other:
Apache 2.0
General Upgrades
A quick note about upgrading. Generally, upgrading is as simple as typing yum update *packages*. Just to be on the cautious side, backup your configuration files in /etc before upgrading. Secondly, always read the release notes to make sure configuration files and directives haven’t change.
1st set up apache
Make sure you have Apache installed, then you’ll need to quickly configure it if not. Chances are you probably already have some web service running on your machine, but if not, get it running quickly this way.
[me@mymachine ~] yum install httpd
[me@mymachine ~] vim /etc/httpd/conf/httpd.conf
At least edit the “ServerName” directive to your IP address within
/etc/httpd/conf/httpd.conf. Then turn on Apache, and make sure it’s set to start.
[me@mymachine ~] chkconfig httpd on
[me@mymachine ~] service httpd start
Now open up a browser and see if your web server is running: http://localhost(or your IP). You should see the Apache 2 test page. If so, move along.
Installation/Configuration
Nagios requires several different packages be installed so that it may perform the magic it does so well. The core is the Nagios package itself. Without the plugins package, though, Nagios won’t be able to actually process any checks on your systems. The development package obviously contains all the libraries, headers, and document files for developing Nagios. The other optional packages are the NRPE package and the NSCA (Nagios Service Check Acceptor) which I don’t use. You may have use for it, so check out the main site for details. Also, Nagios must run under both the user and group “nagios.” The RPM install takes care of this step for you, so there’s no need to create the user and group.
[me@mymachine ~] yum install nagios nagios-plugins nagios-plugins-nrpe nagios-devel
It’ll go ahead and pull down other packages for dependencies as well. That’s it for installation. Let’s move back over to Apache’s side for just a bit.
Configure the Nagios Apache file
Unless you want other options such as SSL configurations or allowing access to the CGI from only certain hosts, then the default nagios.conf file will suit your needs. You can find the file in /etc/httpd/conf.d/ Here’s what it looks like:
ScriptAlias /nagios/cgi-bin "/usr/lib/nagios/cgi"
<Directory "/usr/lib/nagios/cgi">
# SSLRequireSSL
Options ExecCGI
AllowOverride None
Order allow,deny
Allow from all
# Order deny,allow
# Deny from all
# Allow from 127.0.0.1
AuthName "Nagios Access"
AuthType Basic
AuthUserFile /etc/nagios/htpasswd.users
Require valid-user
</Directory>
Alias /nagios "/usr/share/nagios"
<Directory "/usr/share/nagios">
# SSLRequireSSL
Options None
AllowOverride None
Order allow,deny
Allow from all
# Order deny,allow
# Deny from all
# Allow from 127.0.0.1
AuthName "Nagios Access"
AuthType Basic
AuthUserFile /etc/nagios/htpasswd.users
Require valid-user
</Directory>
Unless you want other options configured, that’s it for now. Let’s set up authentication.
Set up the password file
If you don’t want to use the name “nagiosadmin” simply substitute your name. Remember later on you’ll need to use the same name in some CGI configuration settings.
[me@mymachine ~] htpasswd -c /etc/nagios/htpasswd.users nagiosadmin
New password: type_your_password
Re-type new password: re-type_your_password
Adding password for user nagiosadmin
It’s also up to you if you’d like to create a “guest” account. The guest account would allow guests to see various things you specify within Nagios, but it won’t give them total access to the CGI interface. For example, they could see host status information, but can’t schedule downtime for hosts…things like this. If you want a guest account, add the account.
[me@mymachine ~] htpasswd /etc/nagios/htpasswd.users guest
New password: type_your_password
Re-type new password: re-type_your_password
Adding password for user guest
NOTE: Notice I took away the “-c” option. This is the create option. Since you already created the file, make sure any other accounts you add are not with the create option. You’ll wipe the file out if you do.
Set up the CGI file
The next step is to set up the users you just created in the main CGI configuration file. I’m going to assume that you are not using a guest account, and that you have only created one admin “nagiosadmin” account. Also, ensure you have it set up to use authentication. 1 means on, 0 means off.
[me@mymachine ~] cd /etc/nagios
[me@mymachine nagios] vi cgi.cfg
# AUTHENTICATION USAGE
use_authentication=1
# SYSTEM/PROCESS INFORMATION ACCESS
authorized_for_system_information=nagiosadmin
# CONFIGURATION INFORMATION ACCESS
authorized_for_configuration_information=nagiosadmin
# SYSTEM/PROCESS COMMAND ACCESS
authorized_for_system_commands=nagiosadmin
# GLOBAL HOST/SERVICE VIEW ACCESS
authorized_for_all_services=nagiosadmin
authorized_for_all_hosts=nagiosadmin
# GLOBAL HOST/SERVICE COMMAND ACCESS
authorized_for_all_service_commands=nagiosadmin
authorized_for_all_host_commands=nagiosadmin
These lines woul already be there but just check in case its not there. Save this file when you are finished editing it. There are a lot of other optional parameters to change or play with, so have fun customizing the web interface to your liking. Let’s test out what you’ve done so far. Restart Apache and browse to http://localhost/nagios/. You should see your pretty little web interface to Nagios now, after you supply the credentials that you just created. You can browse through the links to the left, but the majority of them won’t work because nothing is configured yet.
Setting up nagios.cfg
Now we’re going to open up the main Nagios configuration file. This file is basically self-explanatory with the comments inside of it. The short version is as follows. Nagios allows you to specify every configuration from one single file, “localhost.cfg,” this resides in (/etc/nagios/objects). When you have only a few hosts and services to monitor this idea is rational, but when you have tons of items to monitor this is a bad idea. It’s going to take you a long time to get used to setting up Nagios to begin with, so do yourself a favor and split out all your files into the categories as mentioned below. Meaning, use a separate file for hosts and hostgroups, a separate file for services and servicegroups, and a separate file for everything else you decide to configure. You’ll thank me later. Let’s start with the basics needed. The external command options I turn on in order to allow commands to be executed from the CGI web interface.
. [me@mymachine ~] cd /etc/nagios
[me@mymachine nagios] vi nagios.cfg
# OBJECT CONFIGURATION FILE(S)
cfg_file=/etc/nagios/contactgroups.cfg
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
Go ahead and save the file. Now, for each file you you specified above you’ll need to create the file because it doesn’t exist within /etc/nagios.
[me@mymachine nagios] touch contactgroups.cfg contacts.cfg
hostgroups.cfg hosts.cfg
services.cfg timeperiods.cfg
[me@mymachine nagios] chown nagios.nagios contactgroups.cfg
contacts.cfg hostgroups.cfg
hosts.cfg services.cfg timeperiods.cfg
One last note about this section. If you are planning on using the external commands on the CGI interface (check_external_commands), you might run into a few permissions issues. Please check out the Nagios FAQ interface if you get any errors when you try to run a command on the web interface. The FAQ is located here:
http://nagios.sourceforge.net/docs/2_0/commandfile.html
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. This will help get you started though, so let’s begin with the timeperiods file. Obviously, you can substitute your options if you want different values.
Timeperiods
[me@mymachine nagios] vi timeperiods.cfg
# '24x7' timeperiod definition
define timeperiod{
timeperiod_name 24x7 ; --------> any name but this will be used in other configuration files also.
alias 24 Hours A Day, 7 Days A Week
sunday 00:00-24:00
monday 00:00-24:00
tuesday 00:00-24:00
wednesday 00:00-24:00
thursday 00:00-24:00
friday 00:00-24:00
saturday 00:00-24:00
}
# 'workhours' timeperiod definition
define timeperiod{
timeperiod_name workhours ; --------> any name but this will be used in other configuration files also.
alias "Normal" Working Hours
monday 08:00-17:00
tuesday 08:00-17:00
wednesday 08:00-17:00
thursday 08:00-17:00
friday 08:00-17:00
}
# 'nonworkhours' timeperiod definition
define timeperiod{
timeperiod_name nonworkhours ; --------> any name but this will be used in other configuration files also.
alias Non-Work Hours
sunday 00:00-24:00
monday 00:00-09:00,17:00-24:00
tuesday 00:00-09:00,17:00-24:00
wednesday 00:00-09:00,17:00-24:00
thursday 00:00-09:00,17:00-24:00
friday 00:00-09:00,17:00-24:00
saturday 00:00-24:00
}
You can specify as many of these as you want. For instance, say you have a need to contact folks only on the weekends. You can create a template “weekends” and use only Friday, Saturday, Sunday with the appropriate times as you see fit.
Contacts/Contact Groups
Contacts are split into two different files. One holds the actual contact options, and the other holds contacts together in groups. The groups are whom you specify Nagios to contact later on.
[me@mymachine nagios] vi contacts.cfg
# service_notification_options are w,u,c,r,f,n
# w=warning u=unknown c=critical r=recovery f=flapping n=none
# host_notification_options d,u,r,f,n
# d=down u=unreachable r=recovery f=flapping n=none
define contact{
contact_name me ; --------> any name
alias me
service_notification_period 24x7; --------> previously defines configuration in timeperiod
host_notification_period 24x7
service_notification_options c,r
host_notification_options d,r
service_notification_commands notify-by-email ; -------->will be defined in later step
host_notification_commands host-notify-by-email ; -------->will be defined in later step
email me@myemailaddress.whatever
}
define contact{
contact_name you -------->any name
alias you
service_notification_period workhours ; --------> previosly defined in timeperiod config
host_notification_period workhours
service_notification_options c,r
host_notification_options d,r
service_notification_commands notify-by-email ; -------->will be defined in later step
host_notification_commands host-notify-by-email ; -------->will be defined in later step
email you@youremailaddress.whatever
}
You can choose to do as you wish, but for my purposes I only set contacts up to be notified on critical and recovery alerts. I really have no interest in most things I’m monitoring alerting me when there may be a temporary glitch, or when something is in a warning state, especially at 4:00 a.m. The reason I don’t is because a) I frequently check the Nagios CGI interface throughout the day, and b) all of my alerts get forwarded to a ticketing system. With that said, I don’t want unnecessary tickets being generated simply because a plugin failed to execute this time around. If I was very inspired, I could set up a separate contact and group to receive only the warning and unknowns, and then pipe these through a different e-mail address. Again, completely adaptive to your needs. Also, I’m using e-mail only. My e-mail system takes care of processing where the alerts are going. However, you could set up nagios to pipe messages straight to pagers. Again, check the object configuration options for timeperiods.cfg on the docs. If you want to see the commands being executed for alerts, check out /etc/nagios/command-plugins.cfg. On to the contact groups.
[me@mymachine nagios] vi contactgroups.cfg
# ' test ' contact group definitions
define contactgroup{
contactgroup_name test ; --------> any name
alias test
members me,you ; --------> previously defined in contact config
}
This is a simple example of contacts and contact groups. You can nest as many possibilities as you really want to. You can create as many contacts you need as well. It’s rather straightforward.
Hosts and Host Groups
Host and host group information is stored in the two files hosts.cfg and hostgroups.cfg. Just as you can mix and match contacts in various contact groups, you can do the same thing with host names in host groups. I prefer to create template configurations that I can leech off of later on in my configuration file. It saves you an incredible amount of time typing down the road.
[me@mymachine nagios] vi hosts.cfg
# Generic host definitions ; --------> defines a generic host template to be used later in config files
define host{
name generic-host ; --------> any name
notifications_enabled 1 ; Host notifications are enabled
event_handler_enabled 1 ; Host event handler is enabled
flap_detection_enabled 1 ; Flap detection is enabled
process_perf_data 1 ; Process performance data
retain_status_information 1 ; Retain status information
retain_nonstatus_information 1 ; Retain non-status information
register 0 ; DONT REGISTER THIS DEFINITION
}
# This creates a generic template that any host can use.
# Notifies never, checks 15 times before showing critical on CGI interface,
define host ;defines command to check if host is up by using generic-host template
{
name basic-host ; --------> any name , will be used in later config
use generic-host
check_command check-host-alive
max_check_attempts 15
notification_interval 0
notification_period none
notification_options n
register 0
}
##### Begin Real Hosts #####
define host{
use basic-host ; --------> defined previously
host_name mymachine1 ; --------> name of host machine
alias mymachine1
address 192.168.1.80 ; ip of host machine
contact_groups test
# notification_options d,r #overrides the basic-host option
}
You can begin to see how much time predefined templates can save you down the road when adding hosts. I’m monitoring around 100 hosts and over 200 services, so doing things the template way can really be productive in the long haul. It can get a little confusing, but stick to the docs and you’ll learn pretty quickly. When it comes to all of the template object options each file can contain, look for this http://localhost(or your IP)/nagios/docs/configobject.html. This will help you tremendously, because there are so many options Nagios allows you to choose .
[me@mymachine nagios] vi hostgroups.cfg
define hostgroup{
hostgroup_name basic-clients ; --------> defined previously
alias basic clients
members mymachine1 ; name of the host machine as in host_name
}
That’s about as simple as this can get. You specify your clients from hosts.cfg into host groups in this file. You can split them into multiple groups. For instance, mymachine1 can live within both the basic-clients and your-routers group if you so desired. Pretty simple…
Services
To start, you’re going to need at least one service to monitor. This would be a simple check-host-alive, or ping. Again, you can split things into templates to make it easier down the road just as demonstrated above.
[me@mymachine nagios] vi services.cfg
# Generic service definition template ; --------> creates generic service template
define service{
name generic-service ; --------> any name
active_checks_enabled 1 ; Active service checks are enabled
passive_checks_enabled 1 ; Passive service checks are enabled/accepted
parallelize_check 1 ; Active service checks should be parallelized
obsess_over_service 1 ; We should obsess over this service
check_freshness 0 ; Default is to NOT check service 'freshness'
notifications_enabled 1 ; Service notifications are enabled
event_handler_enabled 1 ; Service event handler is enabled
flap_detection_enabled 1 ; Flap detection is enabled
process_perf_data 1 ; Process performance data
retain_status_information 1 ; Retain status information
retain_nonstatus_information 1 ; Retain non-status information
register 0 ; DONT REGISTER THIS DEFINITION
}
# Generic for all services ; --------> defining service
define service{
use generic-service ; --------> defines above
name basic-service ; defined previously
is_volatile 0
check_period 24x7 ; defined previously
max_check_attempts 15
normal_check_interval 10
retry_check_interval 2
notification_interval 0
notification_period none
register 0
}
define service ; --------> defining service that is to be checked in host
{
use basic-service
name ping-service
notification_options n
check_command check_ping!1000.0,20%!2000.0,60%
register 0
}
define service{
use ping-service
service_description PING
contact_groups test ; --------> defined previously
hostgroup_name basic-clients
# host_name mymachine1 ; --------> host name of client
}
This is the example of how to nest templates. You can use hostgroup_name or host_name individually. I’ve declared a general template to use called “basic-service” which leeches off of the “generic-service” definitions above that.
The services.cfg file can get pretty cumbersome because of all the different checks you can configure. For instance, you can set it up to check smtp service through check_smtp, http services through check_http, dhcp, dns, and all sorts of items through SNMP plugins. I’ll give you an example of an smtp service check.
# SMTP - ensure SMTP services are available.
define service{
use basic-service ; --------> defines previously
name smtp-service
service_description SMTP
notification_interval 15
contact_groups test ; defines previously
notification_options c,r
notification_period 24x7 ; defined previously
check_command check_smtp
register 0
}
define service{
use smtp-service
hostgroup_name smtp-servers
# host_name mymachine1
}
Again, obviously this leeches off the template above it, then defines the actual host groups to check. The host group smtp-servers would have to exist in hostgroups.cfg, and there would have to be hosts defined in hosts.cfg.
Before I continue, let me explain a bit as to what actually occurs with these files. Nagios reads the configuration options from all of these text files. When it’s time to process the smtp-service you have defined, it looks to see what check_command it’s supposed to execute. It then looks in the checkcommands.cfg (CentOS4.x) or command-plugins.cfg (CentOS 5.x) file to look up what check_smtp is supposed to actually do. This would be:
General syntax of commans definition,
define command{
command_namecommand_name
command_linecommand_line
}
Eg:
# 'check_smtp' command definition
define command
{
command_name check_smtp
command_line $USER1$/check_smtp -H $HOSTADDRESS$
}
Eg;
define command
{
command_name check_ping
command_line $USER1$/check_ping -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ -p 5
}
Eg:
# 'notify-host-by-email' command definition
define command
{
command_name notify-host-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
}
Eg:
# 'notify-service-by-email' command definition
define command
{
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}
Great it says, I’ve found it! Nagios now knows to go to /usr/lib/nagios/plugins/ (default path for the RPM install) and execute the check_smtp plugin it finds there. It substitutes the $HOSTADDRESS$ with the hosts located in the host groups definitions, goes out and checks the server to see if SMTP is running. It then returns back with a yay or nay, Nagios processes this information according to the options you have laid out in the configuration files, and displays the information on the CGI interface.
This in essence is how to start setting up Nagios. I’ve simplified this quite a bit, but you should now have a good understand of where to at least begin with configuring hosts and services. Look in /usr/lib/nagios/plugins to see everything you can check out of the box. The list is very large with various things. Also, check out http://www.nagiosexchange.org to view all sorts of third-party plugins written by many community members. I do a lot of checks across SNMP, so be sure to check that out. Also, you can easily write your own plugins to use. There are many extra things you can do within Nagios itself, such as define escalations and extended service/host information. I’ll explain that after you get Nagios fired up so you can see what it’s about.
Starting Nagios
At this point, you should have a working configuration with a host or two for monitoring. Since we haven’t done so yet, let’s start the Nagios daemon, configure it to start at boot, and check the configurations file for errors.
[me@mymachine nagios] chkconfig nagios on
[me@mymachine nagios] nagios -v nagios.cfg
Nagios 3.0
Copyright (c) 1999-2008 Ethan Galstad (http://www.nagios.org)
Last Modified: 05-31-2006
License: GPL
Reading configuration data...
Running pre-flight check on configuration data...
Total Warnings: 85
Total Errors: 0
Things look okay - No serious problems were detected during the pre-flight check
[me@mymachine nagios] service nagios start
Starting network monitor: nagios
You’ll notice my instance has 85 warnings displayed. This is because I have 85 services being checked that have no contact group(s) associated with the service. Warnings are usually ok to let go. As long as the check (nagios -v) says “Things look okay” then you’re usually fine. To avoid the warnings, simply do what the warning says and fix the issue it’s spewing.
Escalations
Escalations are pretty cool in that they allow you to specify where second, third, fourth, and so on, notifications can go. For instance, you have the SMTP service set up to notify a contact group every 30 minutes indefinitely until someone resolves the problem. With an escalation set up, you can tell notifications 2,3,4 to go to this e-mail address, or this pager, and then you can tell notifications 5,6,7 to go to yet another address or pager, and so on. I use this extensively because I have the first notification go to ticketing software, I then set all subsequent notifications to go to simply a pager. I don’t want multiple tickets being created by the same incident, but I want Nagios to page the hell out of me until I respond to the event. Let’s take a peek. This assumes you’ve added this in the nagios.cfg file as well as created the file in /etc/nagios.
[me@mymachine nagios] vi escalations.cfg
define serviceescalation{
host_name mymachine1
service_description SMTP
first_notification 1
last_notification 0
notification_interval 30
contact_groups mypager
}
I define host escalations and service escalations all in the same file as above. You can split these two out just like anything else. Just specify it in the nagios.cfg file to tell the program where the file resides. I don’t split these because I don’t have too many escalations to really be concerned with. Your mileage may vary.
Extended information
Extended information is a bonus feature and is used mainly for just aesthetic reasons on the web interface. It can be split up into host extended information and service extended information. The things you can do with this are put pretty little icons beside host names, specify URL’s to links outside of Nagios, and make things look “pretty” on the map systems. I use the service extended information to point to links outside of nagios hosting MRTG graphs. I’ll show you how you can do this. Remember to specify this file exists in nagios.cfg and create the file.
[me@mymachine nagios] vi serviceextinfo.cfg
# yum's definitions
define serviceextinfo{
host_name mymachine1
service_description PING
notes_url http://mynagiosbox/mrtg/myfile.html
icon_image graph.gif
icon_image_alt View graphs
}
This puts a pretty little icon beside the PING service on the web interface. When you click on this icon, it takes you directly to the MRTG graph I have running on the same machine. In my case, I have an internal yum server rsyncing every night to the mirrors. All of the ethernet traffic is graphed through MRTG, then Nagios points a link to this so it’s easy to navigate to. This proves to create a good history of bandwith usage, and other things. Use some creativity and you can log, graph, and link to just about anything you want. For example, processes and users logged into a system.
Dependencies
Another interesting file I use is the host and service dependencies options. What this does is set up a tier of checks before something alarms out. For example, I check a login service of a server that’s not a Linux box. I have about 15 other services being checked on this host, but they are dependent on being able to login to the machine before processing these checks. When a login is unsuccessful, I don’t want 15 services to start freaking out and paging me, so I set up a dependency tree. If login fails, only the login alarms out…I get one notification for this, not a zillion for all the other checks. You can use this feature for hosts as well. Again, specify it in the nagios.cfg file and create the files.
define servicedependency{
host_name your_host
service_description LOGIN
dependent_host_name your_host
dependent_service_description another_service
execution_failure_criteria w,u,c
notification_failure_criteria w,u,c
}
The execution failure criteria tells Nagios what it’s supposed to do if the “LOGIN” service is down. Meaning “another_service” won’t even bother to check the service if login is on a warning, unknown, or critical state. The notification failure criteria determines when notifications should not be sent out. If the login check is in a warning, unknown, or critical status, then no messages will be sent out on “another_service.”
Just make sure when you are done adding, editing, or creating new configuration files, that you run the “nagios -v nagios.cfg” option. This processes your configuration files and does a check on them prior to actually refreshing the service. Once you’re done configuring things, you have to reload the Nagios process to it makes the changes right away.
[me@mymachine nagios] service nagios reload
SELinux
A word about SELinux. I don’t use it currently, because in 4.x, it messed with some things, and I haven’t taken the time to learn it. I know in 5, it’s supposed to be much more mature, so try it out. I turned it off when I verified this worked on CentOS 5, so if you run into any strange things, keep SELinux in mind.
That’s all, folks!
Basically, this is Nagios summed up. I’m simplifying almost everything. I hope I’ve explained things in a simple fashion anyways. Documentation for the utility is wonderful, but there’s so much documentation that it’s hard to learn where to get started sometimes. If you have a network to maintain, I advocate getting Nagios (unless you like other utilities) running to big brother your hosts and devices. It’s saved my IT departments’ skin on more than one occasion. Like I mentioned before, it’ll take you a long time to get good at it, and it’s not easy to figure out at first, but once you get a grip on Nagios, you’ll wonder how you got along without it before. I’m checking everything from simple pings to check host alive status, to disk usage stats, memory stats, DHCP, DNS, HTTP, temperature in machines rooms, yum updates, cpu loads, SNMP information from hosts, to anything you can imagine. I’m leaving a lot of things out, but you get the idea. Virtually anything you can think of keeping an eye on, you can do so across Nagios. You can write your own plugins, or visit the Nagios Exchange site I mentioned earlier to find just about anything.
One more thing I would like to mention is the ability to configure and maintain Nagios solely through the web interface. Nagios doesn’t come with pre-packaged add-ons for doing so, but you can find information for three different packages here: http://www.nagios.org/faqs/viewfaq.php?faq_id=183. I personally have not used any of them, but I guess for the command line challenged it could prove useful.
If you have anything to add or if you notice something wrong, please let me know so I can correct it. Enjoy.