===============
 WHAT
===============
This Nagios Plugin gets the size (Kb, Mb, Gb)  of the total/free/used memory of a HP Procurve Switch.

Warning and critical levels (in %) can be set, and plugin gives us perfdata output too, so it can be graphed with graphical tools as pnp4nagios,  besides the usual Nagios states (OK, WARNING and CRITICAL).

============================
PREREQUISITES & INSTALLATION
============================

1) For the check_vmfs.sh plugin to work, it needs snmpget command (inside snmp package in Debian/Ubuntu systems).
$ apt-get install snmp
 
2) Besides the standard commands of any Linux's flavours (grep & cut) we need to install the bc application, which 
is used to work with fractionnary numbers in unit conversion tasks. it's found in standard repositories so, in a debian based Linux
just type:

$ apt-get install bc

3) check_hp_switch_mem.sh is placed in plugins Nagios path=>/usr/local/nagios/libexec with standard permissions and ownership

$ chmod 755 check_hp_switch_mem.sh
$ chown nagios.nagios check_switch_mem.sh

=======================
CONFIGURATION EXAMPLES
=======================

Command line:
 * Checking memory of  a switch HP Procurve 2520 with IP address 10.71.8.25, with public Community, Snmp V2, with a warning level of 75%, a critical level of 90% and used space in Mb
	$ check_hp_switch_mem.sh -h 10.71.8.25 -C public -v 2c -w 75 -c 90 -u Mb

it could give us results similar to these ones:
OK - Memsize - total: 56.00 Mb - used: 17.81 Mb (31%)- free: 38.18 Mb (69%) | Memsize=17.81Mb;42.00;50.40;;56.00

Nagios example:
 1) Add to commands.cfg file (by default in /usr/local/nagios/etc/objects path):

	 define command{
		command_name check_hp_switch_mem
		command_line $USER1$/check_hp_switch_mem.sh -h $HOSTADDRESS$ -C $ARG1$ -w $ARG2$ -c $ARG3$ -u $ARG4$ -v $ARG5$
	}

2) Add to switches.cfg (or any other host with services, file) by example:
define service{
        use                             generic-service         ; Name of service template to use
        host_name                       SW_With_IP_ABOVE
        service_description             MEM_HP_Procurve
        check_command                   check_hp_switch_mem!public!75!90!Mb!2c
        }


3) Reload nagios service
$ sudo /etc/init.d/nagios reload
or
$ sudo service nagios restart


4) Check everything is working!

===============
 CONTACT
===============
jpcozar@notforadsyahoo.es
Remove the *notforads* substring from the address.

===============
 LICENSE
===============
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
