Home > Data Center Tips > > Installing Nagios on Solaris for network and server monitoring
Data Center Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 


Installing Nagios on Solaris for network and server monitoring


Bill Bradford, Contributor
01.13.2009
Rating: -3.50- (out of 5)


IT infrastructure news
Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


I have used Nagios, an enterprise-class network and server monitoring system, for almost 10 years now and have yet to find another free, open source monitoring system that can beat it.

This article will walk you through setting up a basic installation of Nagios on a Solaris 10 system. For this example, I use Solaris 10 update 6 (released in October 2008) running in 32-bit mode on a VMware virtual machine. The host name is "sol10vm," but it will be different in your configuration. Alternate versions of Solaris and Apache Web Server should work fine; I've run Nagios on everything from Red Hat 7.3 to Mac OS X.

Nagios installation prerequisites
This tutorial assumes that you've installed the GNU Compiler Collection and GNU make that come on the Solaris 10 installation disc, and that the compiler works properly. In most cases, this simply involves adding to your path environment variable. If you run "gcc" and "gmake" and get the following output, you're probably good to go.

For this demonstration, I use the Apache Web Server packages provided by Steve Christensen's SunFreeware project, specifically Apache 2.0.59 and its dependencies. These packages will install under , so make sure that is in your path and that and are in your system library search path (use "crle;" see "man crle" for details).

Once you've edited the file and started the Web Server with , use your Web browser to go to http://yourhostname. It should look something like this:

[IMAGE]
Click to enlarge.

Downloading, compiling and installing Nagios
The first step to installing Nagios is to create a Nagios user and group. The following commands show how to do th...


BROWSE BY TAG
Hardware and performance monitoring,   Data center operations management,   Information systems management,   Server hardware,   Unix operating systems and servers,   Sun Solaris Unix and Sparc server platforms,   VIEW ALL TAGS

Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google



RELATED CONTENT
Hardware and performance monitoring
APC adds monitoring, efficiency features to UPS line
Application performance monitoring firm targets cloud computing
Mission impossible: Data center asset management
Check server specs before upgrading your operating system
Reduce chances of hardware failure with preventive server maintenance
Sys admins: Are your config files and scripts hacks or products?
Systems management tools: Microsoft takes aim at the Big Four
HP downsizes data center cooling monitor: News in brief
Zenoss upgrades IT monitoring software to vie with Big Four
Indemnification, support woes plague open source systems management

Sun Solaris Unix and Sparc server platforms
Are containerized data centers catching on outside Microsoft, Google?
Will Oracle hold a Sun yard sale as the acquisition's value declines?
Sun Microsystems customers stew in limbo
Will Solaris on x86 survive the Oracle-Sun acquisition and Linux?
Unix updates are slower, and users like it that way
New eBay data center director dishes
How should Sun customers read Oracle's latest rumblings?
With Exadata, Oracle embraces Sun hardware
Solaris Project Crossbow offers virtualized network management
IBM announces Power7 upgrade path in uncertain Unix market

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
automated test equipment  (SearchSoftwareQuality.com)
DCML  (SearchDataCenter.com)
event forwarding  (SearchDataCenter.com)
HP OpenView  (SearchDataCenter.com)
lights-out management  (SearchDataCenter.com)
MIS  (SearchDataCenter.com)
smoke testing  (SearchWinDevelopment.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary


at on a freshly installed Solaris system. In your case, the user ID may not be 100, but I recommend making the Nagios group ID the same as the "nagios" user ID.

As of January 2008, the latest version of Nagios is 3.0.6 and the Nagios plug-ins are at version 1.4.13. You can get both from the Nagios download page. Download and extract both archives into a location of your choice. I prefer .

I prefer to keep my Nagios installation in its own directory, so we'll pass an argument to the configure script telling it to install everything in .

Once the configure process completes without errors, type "gmake all" to compile the core Nagios software and Web CGIs. Next, type "gmake install" to install everything. Once the installation is finished, run "gmake install-init" and then "gmake install-config" to install sample configuration files and enable Nagios to start when the system boots.

After Nagios itself is compiled and installed, the next step is to repeat the process with the Nagios plug-ins, which enable enhanced system and service checks. After uncompressing the source code archive, the configure step is the same:

After the configure script finishes, run "gmake" and "gmake install" to install the plug-ins in the directory that was created when you installed the core Nagios package. In addition, you must add to your system library search path using the "crle" command as you did with . If this step is omitted, it will cause errors with some of the plug-ins.

Configuring Apache for Nagios
For this example, we will not configure Nagios for HTTP user authentication. This makes the tutorial simpler, but it should not be used in a production environment. Once you've gone through this tutorial and understand how things are set up, read the official Nagios documentation and modify your configuration to implement user authentication.

To configure Apache for use with Nagios, add the following code to your Apache config file. In this case the file is located in

Once Apache is configured for Nagios, restart the Web Server with , or by running followed by .

Even though Nagios is not yet fully configured and started, you should be able to go to http://yourhostname/nagios in a Web browser and see a screen like this:

[IMAGE]
Click to enlarge.

Configuring Nagios
Nagios has a number of configuration files, located in both and .

The first file we need to edit is . In that file, change the value of "use_authentication" to 0. For production use you will want to re-enable this after reading the documentation about HTTP user authentication.

The second file to edit is . In this file, change both "check_external_commands" and "use_syslog" to 0. This prevents someone from running external commands against your Nagios installation when user authentication is not in effect and keeps Nagios from spamming your syslog.

The default "contact group" configuration for Nagios is fine in this basic example. Edit and change "nagios@localhost" to your email address under the "nagiosadmin" contact definition. In order for email alerts to work, you need a functioning mail server or mail relay on your Solaris system (that configuration is beyond the scope of this article).

You'll see in contacts.cfg that the contact definition says to use the generic-contact template. This template is defined in , and also references the time periods in . In most cases you will want to leave these definitions alone, but they're highly customizable and allow for multiple contacts over multiple shifts, or for contacting different people depending on what time of day a problem occurs.

If you ran the command earlier after compiling and installing Nagios, there's already a localhost.cfg file in place to check various services on the local machine on which Nagios is running. You can safely ignore the "linux-server" references in this file; the author assumes it will be running on a Linux system. We want to trim these down to checks for network connectivity, the Web Server and the SSH daemon. Comment out the entries in this file for the Root_Partition, Current Users, Total Processes, Current Load and Swap Usage services. This will leave only the service definitions for "check_http," "check_ssh," and "PING" uncommented. The commands used for service checks are defined in the commands.cfg file. You can add your own by editing the file and then use them in your service definitions.

The files printer.cfg, switch.cfg and windows.cfg contain more examples of how to monitor printers, switches and Windows systems using some of the advanced Nagios plug-ins. We will not use these files in this tutorial, but they are worth reading to get a feel for how the various pieces of the Nagios puzzle fit together.

After the configuration files have been edited to your satisfaction, it's time to run Nagios to verify your configuration files and make sure that nothing has been forgotten. To do this, run . If everything checks out, the output will look something like this:

[IMAGE]
Click to enlarge.

If the Nagios configuration verification fails, it will tell you what problems it has found. Go back and check your config files, and run the verification process again until it says, "Things look okay."

Running Nagios
Once your configuration is good, it's time to run Nagios. If you ran "gmake install-init" earlier, a script has already been created in that will properly start everything for you. Run to start the process. Once it's running, you should be able to go to http://yourhostname/nagios with a Web browser and click on Tactical Overview to see a global status. In this screenshot you can see that the one host being monitored is OK, as well as the three services on that host. Notifications for two of those services are disabled.

[IMAGE]
Click to enlarge.

Clicking on Service Detail will give you a detailed status report on all the individual services being monitored, as well as the result of their last check:

[IMAGE]
Click to enlarge.

Host Detail does just that -- it shows a detailed status display with one line for each host being monitored:

[IMAGE]
Click to enlarge.

The links to Hostgroup Overview and Hostgroup Summary will show similar status displays for each group of hosts (as defined in the configuration files). Since we only have one host (and one host group) in this quick tutorial, there's no need to show screenshots.

By default, Nagios will check each host and service every five minutes. If something goes down, the Web display for that host or service will change from green to red and an email notification will be sent to the contact groups (and by expansion, the contacts) defined in the host template via templates.cfg. Once the host or service resumes normal operation, email alerts will go out to the defined contacts.

Further reading on Nagios
This tutorial barely scratches the surface of the features in the Nagios enterprise monitoring system, and only demonstrates the most basic of its capabilities. The Nagios online documentation goes into further detail, and a number of good books have been published on the topic. I recommend these titles:

Hopefully this basic tutorial will get you started using Nagios for all of your network and server monitoring needs.

ABOUT THE AUTHOR: Bill Bradford is the creator and maintainer of SunHELP and lives in Houston, Texas, with his wife Amy.

Did you find this helpful? Write to Matt Stansberry about your data center concerns at mstansberry@techtarget.com.

Rate this Tip
To rate tips, you must be a member of SearchWinDevelopment.com.
Register now to start rating these tips. Log in if you are already a member.




DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



Database Programming Solutions - .NET XML, Visual Studio LINQ, ORM .NET
HomeNewsTopicsITKnowledge ExchangeTipsBlogsMultimediaWhite PapersEvents
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2005 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts