www.question-defense.com | Engage: Visit :: Login :: Register
Translate to English Übersetzen Sie zum Deutsch/German Переведите к русскому/Russian Μεταφράστε στα ελληνικά/Greek Vertaal aan het Nederlands/Dutch ترجمة الى العربية/Arabic 中文翻译/Chinese Traditional 中文翻译/Chinese Simplified 한국어에게 번역하십시오/Korean 日本語に翻訳しなさい /Japanese Traduza ao Português/Portuguese Traduca ad Italiano/Italian Traduisez au Français/French Traduzca al Español/Spanish
0

As you add services, contacts, contact groups, commands, and devices to Nagios the bulk editing begins to become very tedious. Monarch is a great tool to manage Nagios configuration(.cfg) files.  To install Monarch follow the instructions provided in the README.txt that comes with the product. Below I provide instructions to assist in that installation along with some tips and tricks that I learned along the way.

**UPDATE** I realized when reading back through this article that I had not included a download link for Monarch so click here to download Monarch to manage your Nagios configuration files.

How to Install Monarch

  1. Install Perl Modules: Install the following perl modules via the CPAN shell: CGI-Session, Class-Accessor, XML-LibXML-Common, XML-NamespaceSupport, XML-SAX, XML-LibXML-1.58, CGI, DBI, DBD-mysql, File::Copy, CGI-Ajax, Data-FormValidator, JavaScript-DataFormValidator, Carp, IO-Socket, Time-Local, and URI-Escape.First start CPAN.
    [root@server ~]# perl -MCPAN -e shell
    

    Now install the various perl modules.

    cpan> install CGI::Session
    cpan> install Class::Accessor
    cpan> install XML::LibXML::Common
    cpan> install XML::NamespaceSupport
    cpan> install XML::SAX
    cpan> install P/PH/PHISH/XML-LibXML-1.58.tar.gz
    cpan> install CGI
    cpan> install DBI
    cpan> install DBD::mysql
    cpan> install File::Copy
    cpan> install CGI::Ajax
    cpan> install Data::FormValidator
    cpan> install JavaScript::DataFormValidator
    cpan> install Carp
    cpan> install IO::Socket
    cpan> install Time::Local
    cpan> install URI::Escape
    
  2. Create Database: Now create the mysql database using the below syntax.
    mysql>create databasse monarch;
    
  3. Monarch Install Script: Now run the monarch_setup.pl script which will create all of the necessary database tables for Monarch. Note that this will drop any existing tables in the monarch database and recreate the necessary tables.
    [root@ali monarch-2.5.0]#perl monarch_setup.pl
    
  4. Verify Web Server Permissions: Now verify that the web server is a member of the nagios group. If you are using apache and it runs under the apache user then you would see a line similar to the below in your /etc/groups file.
    nagios:x:20002:apache
    
  5. Verify .cfg Permissions: Verify that the nagios configuration files have write access for the group level and that the parent folders are searchable. Locate your nagios .cfg files and issue the following command.
    chmod 664 *.cfg
    

    Now make sure the parent folders all have permissions like the following: drwxrwxr-x

  6. Open Monarch URL: Now open a browser and enter the following URL: http://userdomain.com/cgi-bin/monarch.cgi
  7. Login: Use the following credentials to login to monarch:
    User: super_user
    Password: password
    Make sure to change the password for the super_user immediately or add a new super user with a different login and password. Then delete the super_user account once you have verified the other account to be functional.
  8. Set nagios.cfg Folder: Now go to Control >> Setup to set the nagios.cfg folder to the proper directory.
  9. Set CGI Configurations: Either load an existing configuration or start a new setup by following the below instructions.A. Load Existing: Visit Control >> Nagios CGI Configuration and choose “Load from File”B. Start New: Visit Control >> Nagios CGI Configuration and choose “Set Defaults”
  10. Set Nagios Configurations: Either load an existing configuration or start a new setup by following the below instructions.A. Load Existing: Visit Control >> Nagios Main Configuration and choose “Load from File”B. Start New: Visit Control >> Nagios Main Configuration and choose “Set Defaults”
  11. Load Files or Use Samples: Now you need to import your existing nagios templates by visiting Control and clicking on Load or copy the sample configuration files provided with Monarch into your nagios cfg folder and then click on Control followed by clicking on Load.

That is the basic setup to get going. There are a couple of things I noticed along the way that caused issues for me. The main thing being if you are loading in an existing Nagios setup and have any spaces in hostnames, contacts, services, check_commands, etc. then you will have issues importing that data in. Make sure to remove all spaces before attempting to import the configuration files into Monarch and it will save you a huge headache ahead of time.

Example Services with spaces below.

# The following service will monitor the the number of currently logged in users on the remote host.

define service{
use generic-service
host_name server1, server2, server3
service_description CURRENT USERS
check_command check_nrpe!check_users
}

# The following service will monitor the total number of processes on the remote host.

define service{
use generic-service
host_name server1, server2, server3
service_description TOTAL PROCESSES
check_command check_nrpe!check_total_procs
}

Notice the TOTAL PROCESSES and CURRENT USERS lines. You should convert all of these before importing to total_processes and current_users as an example. Again this will save you a lot of trouble during the import.

DeliciousStumbleUponDiggTwitterMixxTechnoratiFacebookNews VineLinkedInYahoo! Bookmarks
Related posts:
  1. Easy Management of Nagios Configuration Files with Web Based GUI Monarch Nagios is a great solution for monitoring hosts, networks, and...
  2. Error(s) executing /usr/bin/nagios -v /usr/share/nagios/monarch/workspace/ nagios.cfg Permission Denied Earlier in the week when moving Nagios from one server...
  3. Possible Errors When Moving Nagios From One Linux Server To Another Linux Server I recently moved Nagios monitoring from one server to another...
  4. NRPE Nagios Plugin To Check The Number Of Files In A Directory We have various scripts on a server that process files...

Tags: , , , , , , , , ,
Leave a Reply