Difference between revisions of "Nagios monitoring"
Jump to navigation
Jump to search
Line 80: | Line 80: | ||
= References = | = References = | ||
*[http://nagios.sourceforge.net/docs/3_0/quickstart-fedora.html Fedora Quickstart] Rpm based quide and install from sources | *[http://nagios.sourceforge.net/docs/3_0/quickstart-fedora.html Fedora Quickstart] Rpm based quide and install from sources | ||
Revision as of 21:30, 2 February 2014
Installation Nagios on EC2 Ami instance and monitor a generic host on Internet.
Installation
Install Nagios core package
sudo yum install nagios
Install plugins. Without the plugins you will not be able to monitor even localhost.
sudo yum install nagios nagios-plugins-all
Install SNMP
yum install net-snmp-utils net-snmp
Post installation configuration
Set up user name and password. A default username is nagiosadmin
sudo htpasswd -c -b /etc/nagios/passwd nagiosadmin nagiospassword
Adding host to monitor
Create new object to monitor
sudo vi /etc/nagios/objects/o2box.cfg
Paste below standard minimum config
# Define a host for the local machine define host{ use linux-server ; Name of host template to use ; This host definition will inherit all variables that are defined ; in (or inherited by) the linux-server host template definition. host_name o2box alias Thomson TG585 address 212.77.100.101 } ############################################################################### ############################################################################### # # SERVICE DEFINITIONS # ############################################################################### ############################################################################### # Define a service to "ping" the local machine define service{ use generic-service ; Name of service template to use host_name o2box service_description PING check_command check_ping!100.0,20%!500.0,60% } # Define a service to check HTTP on the local machine. # Disable notifications for this service by default, as not all users may have HTTP enabled. define service{ use generic-service ; Name of service template to use host_name o2box service_description HTTP check_command check_http notifications_enabled 0 }
- Define host
- use linux-server: We use Linux-Server because its the easiest template to use, more on this later
- host_name o2box: This is the host name, this is how you reference your hosts settings, it doesn’t have to be its address just something meaningful related to the host
- alias Thomson TG585: This is the long name for the host, this is only used for display purposes
- address 8.8.8.8: This is important, its the actual address for the host, either a DNS name or IP address will work here.
- Define service
This is were we define the services on each host, for o2box home router we are only going to check if its alive(ping) and check to see if its web server is running (http). We need to two services for this, however the settings are the same for each:
- use this is the service template, use generic-serivce is the standard template.
- host_name This is where we reference what host we want the service connected to, use the name of the host defined earlier.
- service_description This is the name the user will see on the Nagios web page
- check_command This is the command we are going to run to test if the service is running, more on commands later.
Add to /etc/nagios/nagios.cfg following lines in appropriate sections:
cfg_file=/etc/nagios/objects/o2box.cfg
Restart Nagios
sudo service nagios restart
- Troubleshooting
If you receive errors after restarting, run verbose mode on the main config
nagios -v /etc/nagios/nagios.cfg
References
- Fedora Quickstart Rpm based quide and install from sources