Nagios – Quick Guide

Nagios – Quick Guide ”; Previous Next Nagios – Overview DevOps lifecycle is a continuous loop of several stages, continuous monitoring is the last stage of this loop. Continuous monitoring is one of the stages in this lifecycle. In this chapter, let us learn in detail about what continuous monitoring is and how Nagios is helpful for this purpose. What is Continuous Monitoring Continuous monitoring starts when the deployment is done on the production servers. From then on, this stage is responsible to monitor everything happening. This stage is very crucial for the business productivity. There are several benefits of using Continuous monitoring − It detects all the server and network problems. It finds the root cause of the failure. It helps in reducing the maintenance cost. It helps in troubleshooting the performance issues. It helps in updating infrastructure before it gets outdated. It can fix problems automatically when detected. It makes sure the servers, services, applications, network is always up and running. It monitors complete infrastructure every second. What is Nagios Nagios is an open source continuous monitoring tool which monitors network, applications and servers. It can find and repair problems detected in the infrastructure, and stop future issues before they affect the end users. It gives the complete status of your IT infrastructure and its performance. Why Nagios Nagios offers the following features making it usable by a large group of user community − It can monitor Database servers such as SQL Server, Oracle, Mysql, Postgres It gives application level information (Apache, Postfix, LDAP, Citrix etc.). Provides active development. Has excellent support form huge active community. Nagios runs on any operating system. It can ping to see if host is reachable. Benefits of Nagios Nagios offers the following benefits for the users − It helps in getting rid of periodic testing. It detects split-second failures when the wrist strap is still in the “intermittent” stage. It reduces maintenance cost without sacrificing performance. It provides timely notification to the management of control and breakdown. Nagios – Architecture This chapter talks in detail about Nagios architecture. Nagios Architecture The following points are worth notable about Nagios architecture − Nagios has server-agent architecture. Nagios server is installed on the host and plugins are installed on the remote hosts/servers which are to be monitored. Nagios sends a signal through a process scheduler to run the plugins on the local/remote hosts/servers. Plugins collect the data (CPU usage, memory usage etc.) and sends it back to the scheduler. Then the process schedules send the notifications to the admin/s and updates Nagios GUI. The following figure shows Nagios Server Agent Architecture in detail − Nagios – Products Nagios contains various products as discussed in detail below − Nagios XI It provides monitoring for complete IT infrastructure components like applications, services, network, operating systems etc. It gives a complete view of your infrastructure and business processes. The GUI is easily customizable giving the used flexibility. The standard edition of this tool costs $1995 and enterprise edition costs $3495. Nagios Core It is the core on monitoring IT infrastructure. Nagios XI product is also fundamentally based on Nagios core. Whenever there is any issue of failure in the infrastructure, it sends an alert/notification to the admin who can take the action quickly to resolve the issue. This tool is absolutely free. Nagios Log Server It makes searching of log data very simple and easy. It keeps all the log data at one location with high availability setup. It can easily send alerts if any issue is found in the log data. It can scale to 1000s of severs giving more power, speed, storage, and reliability to your log analysis platform. The price of this tool depends on the number of instances – 1 Instance $3995, 2 Instances $4995, 3 Instances $5995, 4 Instances $6995, 10 Instances $14995. Nagios Fusion This product provides a centralized view of complete monitoring system. With Nagios Fusion, you scan setup separate monitoring servers for separate geographies. It can be easily integrated with Nagios XI and Nagios core to give the complete visibility of the infrastructure. This tools costs $2495. Nagios Network Analyser It gives the complete information of the network infrastructure to the admin with the potential threats on the network so that admin can take quick actions. It shares very detailed data about the network after in-depth network analysis. This tools costs $1995. Nagios – Installation In this chapter, the steps to setup Nagios on Ubuntu are discussed in detail. Before you install Nagios, some packages such as Apache, PHP, building packages etc., are required to be present on your Ubuntu system. Hence, let us install them first. Step 1 − Run the following command to install pre-required packages − sudo apt-get install wget build-essential apache2 php apache2-mod-php7.0 php-gd libgd-dev sendmail unzip Step 2 − Next, create user and group for Nagios and add them to Apache www-data user. sudo useradd nagios sudo groupadd nagcmd sudo usermod -a -G nagcmd nagios sudo usermod -a -G nagios,nagcmd www-data Step 3 − Download the latest Nagios package. wget https://assets.nagios.com/downloads/nagioscore/releases/nagios- 4.4.3.tar.gz Step 4 − Extract the tarball file. tar -xzf nagios-4.4.3.tar.gz cd nagios-4.4.3/ Step 5 − Run the following command to compile Nagios from source. ./configure –with-nagios-group=nagios –with-command-group=nagcmd Step 6 − Run the following command to build Nagios files. make all Step 7 − Run the command shown below to install all the Nagios files. sudo make install Step 8 − Run the following commands to install init and external command configuration files. sudo make install-commandmode sudo make install-init sudo make install-config sudo /usr/bin/install -c -m 644 sample-config/httpd.conf /etc/apache2/sitesavailable/ nagios.conf Step 9 − Now copy the event handler directory to Nagios directory. sudo cp -R contrib/eventhandlers/ /usr/local/nagios/libexec/ sudo chown -R nagios:nagios /usr/local/nagios/libexec/eventhandlers Step 10 − Download and extract Nagios plugins. cd wget https://nagios-plugins.org/download/nagiosplugins- 2.2.1.tar.gz tar -xzf nagios-plugins*.tar.gz cd nagios-plugins-2.2.1/ Step 11 − Install Nagios plugins using the below command. ./configure –with-nagios-user=nagios –with-nagios-group=nagios –with-openssl make sudo make install Step 12 −

Nagios – NRPE

Nagios – NRPE ”; Previous Next The Nagios daemon which run checks on remote machines in NRPE (Nagios Remote Plugin Executor). It allows you to run Nagios plugins on other machines remotely. You can monitor remote machine metrics such as disk usage, CPU load etc. It can also check metrics of remote windows machines through some windows agent addons. Let us see how to install and configure NRPE step by step on client machine which needs to be monitored. Step 1 − Run below command to install NRPE on the remote linux machine to be monitored. sudo apt-get install nagios-nrpe-server nagios-plugins Step 2 − Now, create a host file inside the server directory, and put all the necessary definitions for the host. sudo gedit /usr/local/nagios/etc/servers/ubuntu_host.cfg # Ubuntu Host configuration file define host { use linux-server host_name ubuntu_host alias Ubuntu Host address 192.168.1.10 register 1 } define service { host_name ubuntu_host service_description PING check_command check_ping!100.0,20%!500.0,60% max_check_attempts 2 check_interval 2 retry_interval 2 check_period 24×7 check_freshness 1 contact_groups admins notification_interval 2 notification_period 24×7 notifications_enabled 1 register 1 } define service { host_name ubuntu_host service_description Check Users check_command check_local_users!20!50 max_check_attempts 2 check_interval 2 retry_interval 2 check_period 24×7 check_freshness 1 contact_groups admins notification_interval 2 notification_period 24×7 notifications_enabled 1 register 1 } define service { host_name ubuntu_host service_description Local Disk check_command check_local_disk!20%!10%!/ max_check_attempts 2 check_interval 2 retry_interval 2 check_period 24×7 check_freshness 1 groups admins notification_interval 2 notification_period 24×7 notifications_enabled 1 register 1 } define service { host_name ubuntu_host service_description Check SSH check_command check_ssh max_check_attempts 2 check_interval 2 retry_interval 2 check_period 24×7 check_freshness 1 contact_groups admins notification_interval 2 notification_period 24×7 notifications_enabled 1 register 1 } define service { host_name ubuntu_host service_description Total Process check_command check_local_procs!250!400!RSZDT max_check_attempts 2 check_interval 2 retry_interval 2 check_period 24×7 check_freshness 1 contact_groups admins notification_interval 2 notification_period 24×7 notifications_enabled 1 register 1 } Step 3 − Run the command shown below for the verification of configuration file. sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg Step 4 − Restart NRPE, Apache and Nagios if there are no errors. service nagios-nrpe-server restart service apache2 restart service nagios restart Step 5 − Open your browser and go to Nagios web interface. You can see the host which needs to be monitored has been added to Nagios core service. Similarly, you can add more hosts to be monitored by Nagios. Print Page Previous Next Advertisements ”;

Nagios – Case Study

Nagios – Case Study ”; Previous Next In this chapter, let us look into case studies of two organizations that have successfully implemented Nagios. Bitnetix with Nagios Bitnetix in an IT consulting organization which is into networking, datacenter, monitoring and Voice over IP. Through their offerings, they make small businesses look big. Their solutions help you in managing customer relationships in a better way by increasing more engagement and improving their satisfaction. They say they are in business of communication, hence communicating right message to their customers at the right time is very important for them. Bitnetix was working with a customer who were into Email Marketing. They used to monitor AWS servers which were dynamically allocated and were responsible to deliver thousands of emails to customers. They were using Nagios core earlier but wanted to move to new Nagios XI and integrate with chef with zero downtime. There were challenges in moving live status configuration on Nagios core to appropriate checks in Nagios XI. But with Nagios, they were able to setup Nagios XI configuration file with chef integrated. They were able to move all the customers from Nagios core to Nagios XI with Zero downtime. Nagios XI was also able to integrate with PagerDuty for sending instant notifications. EverWatch.gobal with Nagios EverWatch.global is an IT management and consulting organization which helps non-profit and small/medium organizations. Its headquarter is based in Rochester, New York. They have won numerous awards for their work with Nagios. EverWatch.global was working with an ecommerce retail client with a billion-dollar annual revenue. They were responsible to keeping the website up and running at all the time, monitoring cart and checkout functionality, send notifications to necessary staff in case of defamation. The challenge was their client’s servers were located 500 miles from its headquarters in New York. For monitoring production, staging, quality assurance and development on the same platform, the configurations were supposed to be unique and similar for both areas. With the help of Nagios, they were able to create ssh firewall rules for equipment and Network Operations Center. They were also able to perform checks for defamation occurrences and reduced false positives. By configuring event handlers in Nagios, the number of notifications drastically decreased. Nagios helped them by keeping their client’s website uptime to 98% annually from 85% annually, this was a huge success. “In real dollar terms, the company was able to achieve almost $125,000,000 in additional sales as a result.” Eric Loyd, CEOEverWatch Global. Print Page Previous Next Advertisements ”;

Nagios – Products

Nagios – Products ”; Previous Next Nagios contains various products as discussed in detail below − Nagios XI It provides monitoring for complete IT infrastructure components like applications, services, network, operating systems etc. It gives a complete view of your infrastructure and business processes. The GUI is easily customizable giving the used flexibility. The standard edition of this tool costs $1995 and enterprise edition costs $3495. Nagios Core It is the core on monitoring IT infrastructure. Nagios XI product is also fundamentally based on Nagios core. Whenever there is any issue of failure in the infrastructure, it sends an alert/notification to the admin who can take the action quickly to resolve the issue. This tool is absolutely free. Nagios Log Server It makes searching of log data very simple and easy. It keeps all the log data at one location with high availability setup. It can easily send alerts if any issue is found in the log data. It can scale to 1000s of severs giving more power, speed, storage, and reliability to your log analysis platform. The price of this tool depends on the number of instances – 1 Instance $3995, 2 Instances $4995, 3 Instances $5995, 4 Instances $6995, 10 Instances $14995. Nagios Fusion This product provides a centralized view of complete monitoring system. With Nagios Fusion, you scan setup separate monitoring servers for separate geographies. It can be easily integrated with Nagios XI and Nagios core to give the complete visibility of the infrastructure. This tools costs $2495. Nagios Network Analyser It gives the complete information of the network infrastructure to the admin with the potential threats on the network so that admin can take quick actions. It shares very detailed data about the network after in-depth network analysis. This tools costs $1995. Print Page Previous Next Advertisements ”;

Nagios – Configuration

Nagios – Configuration ”; Previous Next In the previous chapter, we have seen the installation of Nagios. In this chapter, let us understand its configuration in detail. The configuration files of Nagios are located in /usr/local/nagios/etc. These files are shown in the screenshot given below − Let us understand the importance of each file now − nagios.cfg This is the main configuration file of Nagios core. This file contains the location of log file of Nagios, hosts and services state update interval, lock file and status.dat file. Nagios users and groups on which the instances are running are defined in this file. It has path of all the individual object config files like commands, contacts, templates etc. cgi.cfg By default, the CGI configuration file of Nagios is named cgi.cfg. It tells the CGIs where to find the main configuration file. The CGIs will read the main and host config files for any other data they might need. It contains all the user and group information and their rights and permissions. It also has the path for all frontend files of Nagios. resource.cfg You can define $USERx$ macros in this file, which can in turn be used in command definitions in your host config file(s). $USERx$ macros are useful for storing sensitive information such as usernames, passwords, etc. They are also handy for specifying the path to plugins and event handlers – if you decide to move the plugins or event handlers to a different directory in the future, you can just update one or two $USERx$ macros, instead of modifying a lot of command definitions. Resource files may also be used to store configuration directives for external data sources like MySQL. The configuration files inside objects directory have are used to define commands, contacts, hosts, services etc. commands.cfg This config file provides you with some example command definitions that you can refer in host, service, and contact definitions. These commands are used to check and monitor hosts and services. You can run these commands locally on a Linux console where you will also get the output of the command you run. Example define command { command_name check_local_disk command_line $USER1$/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$ } define command { command_name check_local_load command_line $USER1$/check_load -w $ARG1$ -c $ARG2$ } define command { command_name check_local_procs command_line $USER1$/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$ } contacts.cfg This file contains contacts and groups information of Nagios. By default, one contact is already present Nagios admin. Example define contact { contact_name nagiosadmin use generic-contact alias Nagios Admin email [email protected] } define contactgroup { contactgroup_name admins alias Nagios Administrators members nagiosadmin } templates.cfg This config file provides you with some example object definition templates that are referred by other host, service, contact, etc. definitions in other config files. timeperiods.cfg This config file provides you with some example timeperiod definitions that you can refer in host, service, contact, and dependency definitions. Print Page Previous Next Advertisements ”;