Sie sind auf Seite 1von 4

scp -P 550 ecuevah@192.168.10.122:/home/ecuevah/* .

rpm -Uivh fping-2.4-1.b2.3.el5.rf.i386.rpm


rpm -Uivh perl-Net-SNMP-5.2.0-1.2.el5.rf.noarch.rpm perl-Crypt-DES-2.05-3.2.el5.
rf.i386.rpm perl-Digest-HMAC-1.01-1.el5.pp.noarch.rpm perl-Digest-SHA1-2.13-1.el
5.rf.i386.rpm perl-Socket6-0.23-1.el5.rf.i386.rpm
rpm -Uivh nagios-nrpe-2.5.2-1.el5.rf.i386.rpm nagios-plugins-1.4.15-1.el5.rf.i38
6.rpm
vi /etc/nagios/nrpe.cfg

command[check_load]=/usr/lib/nagios/plugins/check_load -w 15,10,5 -c 30,25,20


command[check_sda]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/sda
command[check_mem]=/usr/lib/nagios/plugins/check_mem -w 10 -c 5
command[check_swap]=/usr/lib/nagios/plugins/check_swap -w 90% -c 80%

================================================================================
====
# Script to check real memory usage
# L.Gill 02/05/06 - V.1.0
# ------------------------------------------
# ######## Script Modifications ##########
# ------------------------------------------
# Who When What
# --- ---- ----
# LGill 17/05/06 "$percent" lt 1% fix - sed edits dc result beggining with "."
#
#
#!/bin/bash
USAGE="`basename $0` [-w|--warning]<percent free> [-c|--critical]<percent free>"
THRESHOLD_USAGE="WARNING threshold must be greater than CRITICAL: `basename $0`
$*"
calc=/tmp/memcalc
percent_free=/tmp/mempercent
critical=""
warning=""
STATE_OK=0
STATE_WARNING=1
STATE_CRITICAL=2
STATE_UNKNOWN=3
# print usage
if [[ $# -lt 4 ]]
then
echo ""
echo "Wrong Syntax: `basename $0` $*"
echo ""
echo "Usage: $USAGE"
echo ""
exit 0
fi
# read input
while [[ $# -gt 0 ]]
do
case "$1" in
-w|--warning)
shift
warning=$1
;;
-c|--critical)
shift
critical=$1
;;
esac
shift
done
# verify input
if [[ $warning -eq $critical || $warning -lt $critical ]]
then
echo ""
echo "$THRESHOLD_USAGE"
echo ""
echo "Usage: $USAGE"
echo ""
exit 0
fi
# Total memory available
total=`free -m | head -2 |tail -1 |gawk '{print $2}'`
# Total memory used
used=`free -m | head -2 |tail -1 |gawk '{print $3}'`
# Calc total minus used
free=`free -m | head -2 |tail -1 |gawk '{print $2-$3}'`
# normal values
#echo "$total"MB total
#echo "$used"MB used
#echo "$free"MB free
# make it into % percent free = ((free mem / total mem) * 100)
echo "5" > $calc # decimal accuracy
echo "k" >> $calc # commit
echo "100" >> $calc # multiply
echo "$free" >> $calc # division integer
echo "$total" >> $calc # division integer
echo "/" >> $calc # division sign
echo "*" >> $calc # multiplication sign
echo "p" >> $calc # print
percent=`/usr/bin/dc $calc|/bin/sed 's/^\./0./'|/usr/bin/tr "." " "|/usr/bin/gaw
k {'print $1'}`
#percent1=`/usr/bin/dc $calc`
#echo "$percent1"
if [[ "$percent" -le $critical ]]
then
echo "CRITICAL - $free MB ($percent%) Free Memory"
exit 2
fi
if [[ "$percent" -le $warning ]]
then
echo "WARNING - $free MB ($percent%) Free Memory"
exit 1
fi
if [[ "$percent" -gt $warning ]]
then
echo "OK - $free MB ($percent%) Free Memory"
exit 0
fi
============================================================
chmod 755 /usr/lib/nagios/plugins/check_mem
setup
service nrpe start
==============================================================
define host {
host_name servidor
alias Servidor de
address direccion_IP
max_check_attempts 3
notification_interval 5
notification_period 24x7
notification_options d,u,r
contact_groups admin
}

adicionar a hostgroup

define service {
host_name servidor
service_description DISCO
check_command check_nrpe!check_sda
max_check_attempts 2
normal_check_interval 1
retry_check_interval 1
check_period 24x7
notification_interval 5
notification_period 24x7
notification_options w,u,c,r
contact_groups admin
}
define service {
host_name servidor
service_description CARGA CPU
check_command check_nrpe!check_load
max_check_attempts 2
normal_check_interval 1
retry_check_interval 1
check_period 24x7
notification_interval 5
notification_period 24x7
notification_options w,u,c,r
contact_groups admin
}
define service {
host_name servidor
service_description MEMORIA FISICA
check_command check_nrpe!check_mem
max_check_attempts 2
normal_check_interval 1
retry_check_interval 1
check_period 24x7
notification_interval 5
notification_period 24x7
notification_options w,u,c,r
contact_groups admin
}
define service {
host_name servidor
service_description MEMORIA SWAP
check_command check_nrpe!check_swap
max_check_attempts 2
normal_check_interval 1
retry_check_interval 1
check_period 24x7
notification_interval 5
notification_period 24x7
notification_options w,u,c,r
contact_groups admin
}

Das könnte Ihnen auch gefallen