Difference between revisions of "Nagios"

Jump to navigation Jump to search
3,174 bytes added ,  10:42, 19 March 2012
Added "Web Site Content and Response Time Monitoring"
m (→‎Create SNMP Checks: Updated checks that return text)
(Added "Web Site Content and Response Time Monitoring")
Line 336: Line 336:
         notification_interval          0 ; set > 0 if you want to be renotified
         notification_interval          0 ; set > 0 if you want to be renotified
  }
  }
== Web Site Content and Response Time Monitoring ==
The stock <code>[http://nagiosplugins.org/man/check_http check_http]</code> is very good at basic web server checks, but once you host multiple sites, or want to monitor that your site is actually returning good pages it starts to lack.  There are also plenty of plugins available for monitoring websites from the [http://exchange.nagios.org/directory/Plugins/Websites%2C-Forms-and-Transactions Nagios Plugin exchange].  However none seemed to match the following requirements (I may have missed one that did)...
* Page content checking
** This makes it possible to verify that the whole LAMP stack is working as expected.
* Web page response time
** Important as just because your site(s) are delivering good content, if it takes over 3 secs, nobody is going to hang around to look at it
* Ability to monitor user/password protected pages
Therefore I took one that almost did, <code>[http://exchange.nagios.org/directory/Plugins/Websites%2C-Forms-and-Transactions/check_http_content/details check_http_content]</code>, and modified it to match my requirements (which I'll upload to the exchange once I've got it working with the <code>Nagios::Plugin</code> Perl module), and called it <code>[http://dl.sandfordit.com/scripts/check_url_content check_url_content]</code> (for the time being its available via the previous link).
=== Script Options ===
{|class="vwikitable"
|-
! Option !! Purpose !! Default
|-
! -U <url>
| URL to retrieve (http or https)
|-
! -m <text>
| Text to match in the output of the URL
|-
! -w <secs>
| Warning time threshold || 3 secs
|-
! -c <secs>
| Critical time threshold || 10 secs
|-
! -t <secs>
| Timeout in seconds to wait for the URL to load || 30 secs
|-
! -u <user>
| Username (only required if server requires authentication)
|-
! -p <pass>
| Password (required if Username specified)
|-
! -r <realm>
| Realm (required if Username specified), when accessing a protected site an Authentication pop-up will display 'The site says "realm"'.
|-
! -h <host>
| Host (optional when Username specified), should be in the following format 'www.domain.com:443'
|}
=== Examples ===
* '''Basic check example'''
define command{
        command_name    check_http_content
        command_line    /usr/lib/nagios/plugins/check_http_content -U $ARG1$ -m $ARG2$
        }
define service{
        use                    generic-service
        host_name          www.sandfordit.com
        service_description    www - vWiki
        check_command          check_http_content!http://www.sandfordit.com/vwiki!'Monitoring system'
        }
* '''All options example'''
define command{
        command_name    check_url_content_opt
        command_line    /usr/lib/nagios/plugins/check_url_content -U $ARG1$ -m $ARG2$ -r $ARG3$ -u $ARG4$ -p $ARG5$ -w $ARG6$ -c $ARG7$ -t $ARG8$
        }
define service{
        use                    generic-service
        host_name              www.sandfordit.com
        service_description    www - Secure
        check_command          check_url_content!'http://www.sandfordit.com/secure'!'This page works'!Realm!user!password!5!10!60
        }


[[Category:Nagios]]
[[Category:Nagios]]

Navigation menu