<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>TomsBlog</title>
    <link>http://www.toms-blog.com/tags/nagios/index.xml</link>
    <description>Recent content on TomsBlog</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-uk</language>
    <atom:link href="http://www.toms-blog.com/tags/nagios/index.xml" rel="self" type="application/rss+xml" />
    
    <item>
      <title>Check a process cpu and memory with Nagios</title>
      <link>http://www.toms-blog.com/post/check-a-process-cpu-and-memory-with-nagios/</link>
      <pubDate>Sat, 18 Jan 2014 19:48:11 +0000</pubDate>
      
      <guid>http://www.toms-blog.com/post/check-a-process-cpu-and-memory-with-nagios/</guid>
      <description>

&lt;p&gt;A check plugin for Nagios to monitor processes and their utilization of system resources.&lt;/p&gt;

&lt;a target=&#34;_blank&#34; href=&#34;https://github.com/thomasweaver/check_cpu_proc&#34;&gt;https://github.com/thomasweaver/check_cpu_proc &lt;/a&gt;

&lt;p&gt;This plugin takes in a process name and then uses the command ps to work out how much memory and cpu all the processes of that name are taking up in percentage. It will output performance data for CPU Usage Percentage, Memory Usage Percentage, VSZ, RSS and the number of processes of that name.&lt;/p&gt;

&lt;h2 id=&#34;options&#34;&gt;Options&lt;/h2&gt;

&lt;p&gt;Only the -p option is required all other options are optional.&lt;/p&gt;

&lt;p&gt;-p allows you to specify the name of the process you want to monitor (REQUIRED)&lt;/p&gt;

&lt;p&gt;-w specify a warning for CPU percentage utilization&lt;/p&gt;

&lt;p&gt;-c specify a critical for CPU percentage utilization&lt;/p&gt;

&lt;p&gt;-m specify a warning for Memory percentage utilization&lt;/p&gt;

&lt;p&gt;-n specify a critical fro Memory percentage utilization&lt;/p&gt;

&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;

&lt;p&gt;To monitor the apache processes and warn when the CPU uses over 20% and critical when over 30%&lt;/p&gt;

&lt;div class=&#34;highlight&#34; style=&#34;background: #f0f3f3&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;./check_cpu_proc.sh -p apache -w &lt;span style=&#34;color: #FF6600&#34;&gt;20&lt;/span&gt; -c 30

OK /usr/sbin/apache2 CPU: 0% MEM: 1.5% over &lt;span style=&#34;color: #FF6600&#34;&gt;6&lt;/span&gt; processes | &lt;span style=&#34;color: #003333&#34;&gt;proc&lt;/span&gt;&lt;span style=&#34;color: #555555&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color: #FF6600&#34;&gt;6&lt;/span&gt; &lt;span style=&#34;color: #003333&#34;&gt;mem&lt;/span&gt;&lt;span style=&#34;color: #555555&#34;&gt;=&lt;/span&gt;1.5% &lt;span style=&#34;color: #003333&#34;&gt;cpu&lt;/span&gt;&lt;span style=&#34;color: #555555&#34;&gt;=&lt;/span&gt;0% &lt;span style=&#34;color: #003333&#34;&gt;rss&lt;/span&gt;&lt;span style=&#34;color: #555555&#34;&gt;=&lt;/span&gt;42116.0KB &lt;span style=&#34;color: #003333&#34;&gt;vsz&lt;/span&gt;&lt;span style=&#34;color: #555555&#34;&gt;=&lt;/span&gt;1274760.0KB
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;To monitor apache processes and warn when the CPU uses over 20% and critical when over 30% . Warn when memory is over 0.2% and Critical when memory is over 0.4%&lt;/p&gt;

&lt;div class=&#34;highlight&#34; style=&#34;background: #f0f3f3&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;./check_cpu_proc.sh -p apache -w &lt;span style=&#34;color: #FF6600&#34;&gt;20&lt;/span&gt; -c &lt;span style=&#34;color: #FF6600&#34;&gt;30&lt;/span&gt; -m 0.2 -n 0.4

CRITICAL /usr/sbin/apache2 CPU: 0% MEM: 1.5% over &lt;span style=&#34;color: #FF6600&#34;&gt;6&lt;/span&gt; processes | &lt;span style=&#34;color: #003333&#34;&gt;proc&lt;/span&gt;&lt;span style=&#34;color: #555555&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color: #FF6600&#34;&gt;6&lt;/span&gt; &lt;span style=&#34;color: #003333&#34;&gt;mem&lt;/span&gt;&lt;span style=&#34;color: #555555&#34;&gt;=&lt;/span&gt;1.5% &lt;span style=&#34;color: #003333&#34;&gt;cpu&lt;/span&gt;&lt;span style=&#34;color: #555555&#34;&gt;=&lt;/span&gt;0% &lt;span style=&#34;color: #003333&#34;&gt;rss&lt;/span&gt;&lt;span style=&#34;color: #555555&#34;&gt;=&lt;/span&gt;42116.0KB &lt;span style=&#34;color: #003333&#34;&gt;vsz&lt;/span&gt;&lt;span style=&#34;color: #555555&#34;&gt;=&lt;/span&gt;1274760.0KB
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;To monitor nagios processes purely for performance data. i.e. no warning or criticals&lt;/p&gt;

&lt;div class=&#34;highlight&#34; style=&#34;background: #f0f3f3&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;./check_cpu_proc.sh -p nagios

OK /usr/lib/nagios/plugins/check_ping CPU: 0% MEM: 0% over &lt;span style=&#34;color: #FF6600&#34;&gt;1&lt;/span&gt; processes | &lt;span style=&#34;color: #003333&#34;&gt;proc&lt;/span&gt;&lt;span style=&#34;color: #555555&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color: #FF6600&#34;&gt;1&lt;/span&gt; &lt;span style=&#34;color: #003333&#34;&gt;mem&lt;/span&gt;&lt;span style=&#34;color: #555555&#34;&gt;=&lt;/span&gt;0% &lt;span style=&#34;color: #003333&#34;&gt;cpu&lt;/span&gt;&lt;span style=&#34;color: #555555&#34;&gt;=&lt;/span&gt;0% &lt;span style=&#34;color: #003333&#34;&gt;rss&lt;/span&gt;&lt;span style=&#34;color: #555555&#34;&gt;=&lt;/span&gt;864.0KB &lt;span style=&#34;color: #003333&#34;&gt;vsz&lt;/span&gt;&lt;span style=&#34;color: #555555&#34;&gt;=&lt;/span&gt;12408.0KB
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;NOTE: this plugin doesn’t check whether the process is running and is purely for monitoring process utilization.&lt;/p&gt;

&lt;h2 id=&#34;nagios-graphs&#34;&gt;Nagios Graphs&lt;/h2&gt;

&lt;p&gt;Below is some examples of graphs created from the performance data output by the plugin:&lt;/p&gt;

&lt;p&gt;The below graphs are of a apache process from a live system&lt;/p&gt;

&lt;p&gt;&lt;img src=&#34;http://www.toms-blog.com/images/posts/nagios-check-process/vsz.jpg&#34; alt=&#34;Apache process vsz graph&#34; class=&#34;pure-img&#34;&gt;
&lt;img src=&#34;http://www.toms-blog.com/images/posts/nagios-check-process/rss.jpg&#34; alt=&#34;Apache process rss graph&#34; class=&#34;pure-img&#34;&gt;
&lt;img src=&#34;http://www.toms-blog.com/images/posts/nagios-check-process/processes.jpg&#34; alt=&#34;Apache number of processes graph&#34; class=&#34;pure-img&#34;&gt;
&lt;img src=&#34;http://www.toms-blog.com/images/posts/nagios-check-process/memory.jpg&#34; alt=&#34;Apache total amount of memory usage&#34; class=&#34;pure-img&#34;&gt;
&lt;img src=&#34;http://www.toms-blog.com/images/posts/nagios-check-process/cpu.jpg&#34; alt=&#34;Apache total amount of CPU usage&#34; class=&#34;pure-img&#34;&gt;&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Nagios Varnish performance plugin</title>
      <link>http://www.toms-blog.com/post/nagios-varnish-performance-plugin/</link>
      <pubDate>Thu, 18 Jul 2013 21:38:03 +0000</pubDate>
      
      <guid>http://www.toms-blog.com/post/nagios-varnish-performance-plugin/</guid>
      <description>

&lt;p&gt;Varnish is a web application accelerator and sits in front of your web server. It speeds up your application by caching some, if not all of the content meaning it reduces the load on your web server and can reduce the load on you backend as less lookups will be needed by the frontend.&lt;/p&gt;

&lt;p&gt;As varnish is the first thing users hit it is imperative it is working properly and you have statistics on how it is performing. This plugin can give you a better insight into how affectively varnish is running and tell you if its having problems.&lt;/p&gt;

&lt;a target=&#34;_blank&#34; href=&#34;https://github.com/thomasweaver/check_varnish&#34;&gt;https://github.com/thomasweaver/check_varnish &lt;/a&gt;

&lt;h2 id=&#34;install&#34;&gt;Install&lt;/h2&gt;

&lt;p&gt;To use this plugin you need to have varnishstat installed which is installed by default when you install varnish.&lt;/p&gt;

&lt;p&gt;Perl is also required for this plugin. If you don’t have Perl installed you can install in by running the command below&lt;/p&gt;

&lt;div class=&#34;highlight&#34; style=&#34;background: #f0f3f3&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;sudo apt-get install perl
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;or&lt;/p&gt;

&lt;div class=&#34;highlight&#34; style=&#34;background: #f0f3f3&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;sudo yum install perl
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Now you can clone the repo above&lt;/p&gt;

&lt;div class=&#34;highlight&#34; style=&#34;background: #f0f3f3&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;git clone https://github.com/thomasweaver/check_varnish.git
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Now you should have a file “check_varnish.pl” make sure that it has execute permissions:&lt;/p&gt;

&lt;div class=&#34;highlight&#34; style=&#34;background: #f0f3f3&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;chmod u+x check_varnish.pl
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;You now need to copy this file to your nagios plugins folder. You should consult your nagios config to find out where this is. Mine was ‘/usr/lib/nagios/plugin’&lt;/p&gt;

&lt;div class=&#34;highlight&#34; style=&#34;background: #f0f3f3&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;mv check_varnish.pl /usr/lib/nagios/plugins/.
&lt;/pre&gt;&lt;/div&gt;


&lt;h2 id=&#34;how-to&#34;&gt;How To&lt;/h2&gt;

&lt;div class=&#34;box&#34;&gt;
&lt;p&gt;check_varnish.pl – Monitor and report on varnish usage&lt;/p&gt;

&lt;p&gt;check_varnish.pl [-c|–cache] [-b|–bin &lt;varnishstatbinary&gt;] [-d|–backend &lt;total|ratio&gt;] [-s|–stats &lt;varnish statfield&gt;]  [-t|–technique &lt;lt|gt&gt;] [-w|–warning &lt;number&gt;] [-c|–critical &lt;number&gt;] [-h|–help]&lt;/p&gt;

&lt;p&gt;DESCRIPTION&lt;/p&gt;

&lt;p&gt;This script will report on various varnish stats including: varnish cache hit ratio backend error count (Total or Ratio) Any other counter in varnishstat If no counters are required the script will ensure the varnish binary is running&lt;/p&gt;

&lt;p&gt;OPTIONS&lt;/p&gt;

&lt;p&gt;-a –cache – this will make the script output cache_hit ratio perfdata&lt;/p&gt;

&lt;p&gt;-b –bin &lt;varnishstat&gt; – to specify a different location of the default varnishstat binary location. Default is ‘/usr/bin/varnishstat’&lt;/p&gt;

&lt;p&gt;-d –backend &lt;all|success|unhealthy|busy|fail|reuse|toolate|recycle|retry&gt; – specify script to output backend data you can output ratio, total or both&lt;/p&gt;

&lt;p&gt;-h –help – output this message&lt;/p&gt;

&lt;p&gt;-w –warning &lt;number&gt; – specify the warning threshold. Required for cache and backend checks&lt;/p&gt;

&lt;p&gt;-c –critical &lt;number&gt; – specify the critical threshold. Required for cache and backend checks&lt;/p&gt;

&lt;p&gt;-s –stats &lt;varnishstat field&gt; – specify a comma separated list of all the stats you wish to check Critical and Warning can be specified and all values will be compared to these values.&lt;/p&gt;

&lt;p&gt;-t –technique &lt;lt|gt&gt; – when specifying stats you can also specify what technique you wish to use to compare the values to the thresholds. specify lt for less than and gt for greater than. Default is gt&lt;/p&gt;

&lt;p&gt;EXAMPLES&lt;/p&gt;

&lt;p&gt;Check varnish is running&lt;/p&gt;

&lt;p&gt;./check_varnish.pl&lt;/p&gt;

&lt;p&gt;Check varnish Cache Hit Ratio and warn if ratio is below 0.8&lt;/p&gt;

&lt;p&gt;./check_varnish.pl -a -w 0.8 -c 0.6&lt;/p&gt;

&lt;p&gt;Check varnish Backends&lt;/p&gt;

&lt;p&gt;./check_varnish.pl -d all&lt;/p&gt;

&lt;p&gt;Check varnish client requests and drops&lt;/p&gt;

&lt;p&gt;./check_varnish.pl -s client_drop,client_req&lt;/p&gt;

&lt;/div&gt;

&lt;h2 id=&#34;nagios-set-up&#34;&gt;Nagios Set Up&lt;/h2&gt;

&lt;p&gt;Once you have run the command in the CLI and all is working you can add the command:&lt;/p&gt;

&lt;div class=&#34;box&#34;&gt;
&lt;p&gt;define command {&lt;/p&gt;

&lt;p&gt;command_name                    check_varnish&lt;/p&gt;

&lt;p&gt;command_line                    $USER1$/check_varnish.pl $ARG1$&lt;/p&gt;

&lt;p&gt;register                        1&lt;/p&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;/div&gt;

&lt;p&gt;$USER1$ is your variable pointing to your nagios plugins folder and $ARG1$ are any command line arguments you specify in the service.&lt;/p&gt;

&lt;div class=&#34;box&#34;&gt;
&lt;p&gt;define service {&lt;/p&gt;

&lt;p&gt;host_name                       localhost&lt;/p&gt;

&lt;p&gt;service_description             Varnish&lt;/p&gt;

&lt;p&gt;check_command                   check_varnish!&amp;ndash;cache -w 0.6 -c 0.4&lt;/p&gt;

&lt;p&gt;register                        1&lt;/p&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;/div&gt;

&lt;p&gt;The service above will give a warning if the hit ratio goes below 0.6 and critical if the ratio goes below 0.4&lt;/p&gt;

&lt;h2 id=&#34;nrpe&#34;&gt;NRPE&lt;/h2&gt;

&lt;p&gt;The below is a line that can be used in the NRPE configuration for remote monitoring:&lt;/p&gt;

&lt;div class=&#34;box&#34;&gt;
&lt;p&gt;command[check_varnish_cache_hit]=/usr/lib/nagios/plugins/check_varnish.pl &amp;ndash;cache -w 0.6 -c 0.4&lt;/p&gt;

&lt;/div&gt;

&lt;p&gt;The NRPE service could look like this:&lt;/p&gt;

&lt;div class=&#34;box&#34;&gt;
&lt;p&gt;define service {&lt;/p&gt;

&lt;p&gt;host_name                  varnishserver&lt;/p&gt;

&lt;p&gt;service_description             Varnish Cache Hit Ratio&lt;/p&gt;

&lt;p&gt;check_command                   check_nrpe!check_varnish_cache_hit&lt;/p&gt;

&lt;p&gt;register                        1&lt;/p&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;/div&gt;

&lt;h2 id=&#34;performance-data&#34;&gt;Performance Data&lt;/h2&gt;

&lt;p&gt;For certain stats the plugin outputs performance data which can be truned into graphs. The graphs below were produced by nagios and nagiosgrapher:
This graph show the performance data when varnish was restarted. As you can see the cache suddenly drops off and then slowly builds back up as more users access the site&lt;/p&gt;

&lt;img src=&#34;http://www.toms-blog.com/images/posts/check_varnish/varnish-perf-data-start.png&#34; alt=&#34;Graph of Varnish cache hit ratio on restart&#34; class=&#34;pure-img&#34;&gt;

&lt;p&gt;The graph below shows the cache hit ratio slowly increasing over a week. This means most of the cache has been populated and so most of the request are coming from the cache.&lt;/p&gt;

&lt;img src=&#34;http://www.toms-blog.com/images/posts/check_varnish/varnish-perf-data-weekly.png&#34; alt=&#34;Graph of Varnish cache hit ratio slowly increasing over a week&#34; class=&#34;pure-img&#34;&gt;
</description>
    </item>
    
    <item>
      <title>F5 LTM virtual server Nagios health performance check</title>
      <link>http://www.toms-blog.com/post/f5-ltm-virtual-server-health-performance-check/</link>
      <pubDate>Tue, 11 Dec 2012 18:42:01 +0000</pubDate>
      
      <guid>http://www.toms-blog.com/post/f5-ltm-virtual-server-health-performance-check/</guid>
      <description>

&lt;p&gt;A plugin for nagios to check the state of virtual servers on an LTM as well as creating Performance Data output on the amount of connections to each Virtual Server.  The plugin is written in PHP and uses SNMP to gather the statuses of each Virtual Server. The plugin currently only supports SNMPv2 and has been tested on Big-IP 10.2 only but should work with other version of Big-IP.&lt;/p&gt;

&lt;p&gt;You can get the plugin from here:&lt;/p&gt;

&lt;p&gt;&lt;a href=&#34;https://github.com/thomasweaver/check_ltm_vs&#34;&gt;https://github.com/thomasweaver/check_ltm_vs&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&#34;help&#34;&gt;Help&lt;/h2&gt;

&lt;div class=&#34;highlight&#34; style=&#34;background: #f0f3f3&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;This performs an SNMP lookup against an LTM and &lt;span style=&#34;color: #006699; font-weight: bold&#34;&gt;then&lt;/span&gt; check all Virtual Servers are OK and outputs current client connections as nagios PerfData

Required Values:

	-H Host address

	-C SNMP Community string
 
Optional Values:

	-t Timeout. Number of microseconds &lt;span style=&#34;color: #006699; font-weight: bold&#34;&gt;until&lt;/span&gt; first timeout

	-r Number of retries

	-e Exceptions. Value is a comma sperated string of exceptions not to check.

	-d Disabled Exceptions. Don&lt;span style=&#34;color: #AA0000; background-color: #FFAAAA&#34;&gt;&amp;#39;&lt;/span&gt;t check whether the provided virtual servers are disabled. Comma Seperated
 
./check_ltm_vs.php -H IPADDRESS -c COMMUNITYSTRING -e vs_virtualserver1,vs_virtualserver2 -d vs_virtualserver1,vs_virtualserver2
&lt;/pre&gt;&lt;/div&gt;


&lt;h2 id=&#34;example&#34;&gt;Example&lt;/h2&gt;

&lt;div class=&#34;highlight&#34; style=&#34;background: #f0f3f3&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;./check_ltm_vs.php -H 192.168.0.1 -C public -d virtualserver1,virtualserver2 -e virtualserver3,virtualserver4 -r 2
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;The example above will check virtual servers on 192.168.0.1 using Community String public. But will exclude virtualserver3 and virtualserver4 from any checks. It will not check whether virtual servers virtualserver1 and virtualserver2 are enabled but will check that there health state is ok. It will also only try and contact the LTM twice.&lt;/p&gt;

&lt;p&gt;The plugin outputs performance data of the virtual servers it checks example out is below:&lt;/p&gt;

&lt;div class=&#34;highlight&#34; style=&#34;background: #f0f3f3&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;OK : &lt;span style=&#34;color: #FF6600&#34;&gt;4&lt;/span&gt; Virtual Servers OK | &lt;span style=&#34;color: #003333&#34;&gt;virtualserver1&lt;/span&gt;&lt;span style=&#34;color: #555555&#34;&gt;=&lt;/span&gt;98;;; &lt;span style=&#34;color: #003333&#34;&gt;virtualserver2&lt;/span&gt;&lt;span style=&#34;color: #555555&#34;&gt;=&lt;/span&gt;23;;; &lt;span style=&#34;color: #003333&#34;&gt;virtualserver3&lt;/span&gt;&lt;span style=&#34;color: #555555&#34;&gt;=&lt;/span&gt;10;;; virtualserver4;;;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Example of a check where the health state of a virtual server is unknown:&lt;/p&gt;

&lt;div class=&#34;highlight&#34; style=&#34;background: #f0f3f3&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;WARNING : virtualserver1, &lt;span style=&#34;color: #FF6600&#34;&gt;90&lt;/span&gt; Virtual Servers OK
&lt;/pre&gt;&lt;/div&gt;

</description>
    </item>
    
    <item>
      <title>Nagios HP MSA P2000 status and performance monitor</title>
      <link>http://www.toms-blog.com/post/nagios-hp-msa-p2000-status-and-performance-monitor/</link>
      <pubDate>Wed, 26 Sep 2012 21:34:01 +0000</pubDate>
      
      <guid>http://www.toms-blog.com/post/nagios-hp-msa-p2000-status-and-performance-monitor/</guid>
      <description>

&lt;p&gt;This script is intended to be used with Nagios to monitor a HP P2000 SAN. Below is a description and the file can be downloaded here:&lt;/p&gt;

&lt;p&gt;All versions can be found here:
&lt;a href=&#34;https://github.com/thomasweaver/check_p2000_api&#34;&gt;https://github.com/thomasweaver/check_p2000_api&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Version 1.2&lt;/strong&gt; allowing input of username and password. Great thanks to Jon Witts who added the code which can be found here &lt;a href=&#34;http://pastebin.com/T1DMYJbu#&#34;&gt;http://pastebin.com/T1DMYJbu#&lt;/a&gt; or download zip below&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Version 1.3&lt;/strong&gt; Adds an extra check to the status check. A problem was found where by some disk failures were not picked up this was found by Tjerk Nan one extra check on the vdisk fixes this.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Version 1.4&lt;/strong&gt; Adds Individual volume status and vdisk status allowing you to create separate services for the checks. Thanks to Jon Witts for writing this &lt;a href=&#34;http://www.jonwitts.co.uk/archives/296&#34;&gt;http://www.jonwitts.co.uk/archives/296&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Version 1.5&lt;/strong&gt; Adds a check for vdisk Read and write latencies that’s available in later firmwares. Thanks to Tjerk Nan for adding these extra checks.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Version 1.6&lt;/strong&gt; Add a curl part to the plugin so the pecl_http module is no longer needed but curl libraries are.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Version 1.7&lt;/strong&gt; Adds a timeout of 120 seconds to the http_pecl module as timeouts on the default value have occurred on slow networks. Thanks to Aurélien MARTY for finding and fixing the issue.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;NOTE:&lt;/strong&gt; For this command to run the php-http module needs to be installed: &lt;a href=&#34;http://php.net/manual/en/book.http.php&#34;&gt;http://php.net/manual/en/book.http.php&lt;/a&gt; or CURL libraries for version 1.6 and above. Only certain P2000 Firmware’s support the statistic commands and so the performance checks won’t work on  some SAN’s but the status check should work on all P2000 Firmware’s. Note you may need to run dos2unix check_p2000_api.php if you get an error about not finding /usr/bin/php. A Bug has been found in version 1.0.1 whereby it may not pick up a broken disk on later Firmware versions, v1.1 fixes this by using multiple different API calls to determine the health.&lt;/p&gt;

&lt;p&gt;The P2000 has an inbuilt API where any CLI command can be run and output in an XML format. This script utilises this api and can gather performance data and component status of the SAN.&lt;/p&gt;

&lt;p&gt;The script uses the following commands:&lt;/p&gt;

&lt;p&gt;show enclosure-status – /API/show/enclosure-status – This outputs all the enclosures, disks, fans, PSUs etc&lt;/p&gt;

&lt;p&gt;show disk-statistics – /api/show/disk-statistics – This outputs the Disk statistics including IOPs, Read Speed etc.&lt;/p&gt;

&lt;p&gt;show controller-statistics – /api/show/controller-statistics – This outputs the controller statistics including cpu etc&lt;/p&gt;

&lt;p&gt;show vdisk-statistics – /api/show/vdisk-statistics – This outputs the vdisk statistics including IOPs, Read Speed etc&lt;/p&gt;

&lt;p&gt;show volume-statistics – /api/show/volume-statistics – This outputs the volume statistics including IOPs, Read Speed etc&lt;/p&gt;

&lt;p&gt;As of Version 1.2 the auth string is replaced with a Username and Password.&lt;/p&gt;

&lt;p&gt;Version 1.1 and below:&lt;/p&gt;

&lt;p&gt;The script first uses an authentication string which is a combination of the username and password. To get this auth string you need to capture the traffic when you login to the SAN Management HTTP interface and look at the first post and there will be the author string. The image below shows a packet capture with an authentication string highlighted.&lt;/p&gt;

&lt;p&gt;&lt;img src=&#34;http://www.toms-blog.com/images/posts/p2000/p2000-packet-capture.png&#34; alt=&#34;P2000 wireshark packet capture&#34; /&gt;&lt;/p&gt;

&lt;p&gt;Once you have the auth string you can run the below command:&lt;/p&gt;

&lt;p&gt;./check_p2000_api.php -H 192.168.0.1 -L 035ce62a046eaace03bface2abf7e740&lt;/p&gt;

&lt;h2 id=&#34;all-versions&#34;&gt;All Versions&lt;/h2&gt;

&lt;p&gt;By default the plugin checks the status of the P2000 SAN and so only the host address username and password.&lt;/p&gt;

&lt;div class=&#34;box&#34;&gt;

./check_p2000_api.php -H 192.168.0.1 -U admin -P password

&lt;/div&gt;

&lt;p&gt;This will loop through all Enclosures, FAN’s, PSU’s, Temperatures, Voltages and Disks. This will not output any performance data. Below is an example of the output:&lt;/p&gt;

&lt;div class=&#34;box&#34;&gt;

OK : Enclosure 1 OK, FAN 2 OK, PSU 2 OK, Temp 4 OK, Voltage 10 OK, Disk 10 OK,

&lt;/div&gt;

&lt;p&gt;To start getting performance data you need to first decide what you want to monitor so first of all log in to the HTTP Management interface and then run the commands in the api yourself and look at the output. Below is some of the output from /api/show/disk-statistics&lt;/p&gt;

&lt;p&gt;So say we want to get the IOPS of each disk we could run the command:&lt;/p&gt;

&lt;div class=&#34;box&#34;&gt;
&lt;p&gt;./check_p2000_api.php -H 192.168.0.1 -U admin -P password -c disk -S iops&lt;/p&gt;

&lt;p&gt;OK : disk iops – disk_1.1 0, disk_1.2 0, disk_1.3 0, disk_1.4 0, disk_1.5 0, disk_1.6 0, disk_1.7 0, disk_1.8 0, disk_1.9 0, disk_1.10 0, | disk_1.1=0;;; disk_1.2=0;;; disk_1.3=0;;; disk_1.4=0;;; disk_1.5=0;;; disk_1.6=0;;; disk_1.7=0;;; disk_1.8=0;;; disk_1.9=0;;; disk_1.10=0;;;&lt;/p&gt;

&lt;/div&gt;

&lt;p&gt;-c is the command we want to run there are currently 5 options status, disk, vdisk, volume and controller these map directly to the commands shown above so specifying disk will run the command /api/show/disk-statistics. -S specifies which value to get from the output. This is basically the value given to the “name” argument in the XML output in our example this is “iops”, but you could use “bytes-per-second-numeric” as the -S option. If no -S value is given then this defaults to iops. If the above command is run it will give the IOPs for all disks in the controller.&lt;/p&gt;

&lt;p&gt;What if we want to get the CPU utilization of the controller. Well we need to specify enclosure for the -c value and then cpu-load for the -S value. We can provide more options to the script such as a warning and critical value these are provided using -w and -C by default this will mean if the value from the API is greater than either warning or critical then return the appropriate warning or critical state. This is great in most situations but what if you want to be warned if the iops or cpu or whatever is lower than these values well you can specify this with the -t option with a value of “lessthan”. We can also specify what units the value is measured in with the -u option this will simply add the value to the end of the output. All this can also be done securely over HTTPS by specifying a value of 1 with the -s option (NOTE there is a bug in at least one version of the HP P2000 where sometimes authentication over HTTPS doesn’t work.). So lets put all this into a command&lt;/p&gt;

&lt;div class=&#34;box&#34;&gt;

./check_p2000_api.php -H 192.168.0.1 -U admin -P password -c controller -S cpu-load -s 1 -u “%” -w 60 -C 80

&lt;/div&gt;

&lt;p&gt;So this command will get the CPU load of the controllers in the enclosure over HTTPS and will append the % sign to the output. It will be in a Warning state if the utilisation is over 60% and Critical if its over 80%.&lt;/p&gt;

&lt;p&gt;The command would output something like below:&lt;/p&gt;

&lt;div class=&#34;box&#34;&gt;

OK : controller cpu-load – controller_A 1%, controller_B 1%, | controller_A=1%;60;80; controller_B=1%;60;80;

&lt;/div&gt;

&lt;p&gt;This command would give you a graph like below:&lt;/p&gt;

&lt;p&gt;&lt;img src=&#34;http://www.toms-blog.com/images/posts/p2000/p2000-cpu-graph.png&#34; alt=&#34;P2000 CPU graph&#34; /&gt;&lt;/p&gt;

&lt;p&gt;Once you have tested everything in the command line its time to add it to nagios. So first create the command:&lt;/p&gt;

&lt;div class=&#34;box&#34;&gt;
&lt;p&gt;define command {&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;   command_name                             check_p2000

   command_line                             $USER1$/check_p2000_api.php -H $HOSTADDRESS$ -U $USER11$ -P $USER12$ $ARG1$
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;$USER1$&lt;/strong&gt; is obviously the path to your plugin directory. I put &lt;strong&gt;$USER11$&lt;/strong&gt; in the nagios resource.cfg this is so you can easily change it if you need to.&lt;/p&gt;

&lt;p&gt;Once you have the command defined you then need to define the service:&lt;/p&gt;

&lt;div class=&#34;box&#34;&gt;
&lt;p&gt;define service {&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;    host_name                       SANHOST

    service_description             Controller CPU

    use                             generic-service

    check_command                   check_p2000!-c controller -S cpu-load -u &amp;quot;%&amp;quot; -w 60 -C 80!!!!!!!

    register                        1

   }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Don’t forget always run nagios -v to confirm your configuration is correct before restarting the nagios service.&lt;/p&gt;

&lt;h2 id=&#34;installing-on-ubuntu&#34;&gt;Installing on Ubuntu&lt;/h2&gt;

&lt;p&gt;To get the plugin working on Ubuntu you will need to install the pecl_http extension. To do this first install php-pear:&lt;/p&gt;

&lt;div class=&#34;highlight&#34; style=&#34;background: #f0f3f3&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;apt-get install  php-pear
apt-get install libcurl4-gnutls-dev
apt-get install make
pecl install pecl_http
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;You will be asked a few questions during this install just use all default answers. If you get an error saying it can’t find curl header make sure you have installed the curl libraries with the command above. If this installs successfully it should say “You should add “extension=http.so” to php.ini”. So lets do that using a text editor:&lt;/p&gt;

&lt;p&gt;Add the line extension=http.so to /etc/php/php
If all that went well then you should now be able to use the script.&lt;/p&gt;

&lt;h2 id=&#34;installing-on-groundwork&#34;&gt;Installing on Groundwork&lt;/h2&gt;

&lt;p&gt;Groundwork comes with its own version of PHP located in /usr/local/groundwork/php.&lt;/p&gt;

&lt;p&gt;To use this version of PHP I had to download the pecl_http extension and compile it from source. Before that you need to make sure a few things are installed first. I used CentOS but the principle should be the same on other Distros:&lt;/p&gt;

&lt;div class=&#34;highlight&#34; style=&#34;background: #f0f3f3&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;yum install autoconf
yum install make
yum install zlib-devel
yum install libcurl-devel
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Now you need to download the latest pecl_http extension source from here:&lt;/p&gt;

&lt;div class=&#34;highlight&#34; style=&#34;background: #f0f3f3&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;wget http://pecl.php.net/get/pecl_http-1.7.4.tgz
tar -xvf pecl_http-1.7.4.tgz
&lt;span style=&#34;color: #336666&#34;&gt;cd&lt;/span&gt; pecl_http-1.7.4.tgz
phpize
./configure
make
make &lt;span style=&#34;color: #336666&#34;&gt;test&lt;/span&gt;
make install
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Once installed add “extension=http.so” (without the quotes) to  /usr/local/groundwork/php/etc/php.ini&lt;/p&gt;

&lt;p&gt;Now change the first line of the script to:&lt;/p&gt;

&lt;p&gt;#!/usr/local/groundwork/php/bin/php&lt;/p&gt;

&lt;p&gt;Everything should work with the script now.&lt;/p&gt;
</description>
    </item>
    
  </channel>
</rss>