Remove unused files since 4a81d12
This commit is contained in:
parent
44de2b84ec
commit
3d35f7f763
|
@ -1,65 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Copyright (c) 2012, Claudiu Vasadi
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this
|
||||
# list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# The views and conclusions contained in the software and documentation are those
|
||||
# of the authors and should not be interpreted as representing official policies,
|
||||
# either expressed or implied, of the FreeBSD Project.
|
||||
|
||||
|
||||
#
|
||||
# Script to check the state (master/backup) of a carp internface
|
||||
# $1 - carp if
|
||||
# $2 - state
|
||||
#
|
||||
|
||||
. /usr/local/libexec/nagios/utils.sh
|
||||
|
||||
# check if $1 and $2 is set
|
||||
if [ -z "$1" ];then
|
||||
echo "carp interface not set. Exiting ..."
|
||||
exit "$STATE_CRITICAL"
|
||||
fi
|
||||
|
||||
if [ -z "$2" ];then
|
||||
echo "Interface status not set. Exiting ..."
|
||||
exit "$STATE_CRITICAL"
|
||||
fi
|
||||
|
||||
# check if the carp interface exists or not
|
||||
ifconfig $1 > /dev/null
|
||||
if [ $? != "0" ];then
|
||||
echo "carp interface $1 does not exist. Exiting ...."
|
||||
exit "$STATE_CRITICAL"
|
||||
fi
|
||||
|
||||
# check state
|
||||
ifconfig $1 | grep -i $2 > /dev/null
|
||||
if [ $? != "0" ];then
|
||||
echo "NOT_OK - $1 should be $2"
|
||||
exit "$STATE_CRITICAL"
|
||||
else
|
||||
echo "OK - $1 is $2"
|
||||
exit "$STATE_OK"
|
||||
fi
|
|
@ -1,162 +0,0 @@
|
|||
#!/bin/ksh
|
||||
|
||||
################################################################################
|
||||
# Sample Nagios plugin to monitor free memory on the local machine #
|
||||
# Author: Daniele Mazzocchio (http://www.kernel-panic.it/) #
|
||||
################################################################################
|
||||
|
||||
VERSION="Version 1.0"
|
||||
AUTHOR="(c) 2007-2009 Daniele Mazzocchio (danix@kernel-panic.it)"
|
||||
|
||||
PROGNAME=`/usr/bin/basename $0`
|
||||
|
||||
# Constants
|
||||
BYTES_IN_MB=$(( 1024 * 1024 ))
|
||||
KB_IN_MB=1024
|
||||
|
||||
# Exit codes
|
||||
STATE_OK=0
|
||||
STATE_WARNING=1
|
||||
STATE_CRITICAL=2
|
||||
STATE_UNKNOWN=3
|
||||
|
||||
# Helper functions #############################################################
|
||||
|
||||
function print_revision {
|
||||
# Print the revision number
|
||||
echo "$PROGNAME - $VERSION"
|
||||
}
|
||||
|
||||
function print_usage {
|
||||
# Print a short usage statement
|
||||
echo "Usage: $PROGNAME [-v] -w <limit> -c <limit>"
|
||||
}
|
||||
|
||||
function print_help {
|
||||
# Print detailed help information
|
||||
print_revision
|
||||
echo "$AUTHOR\n\nCheck free memory on local machine\n"
|
||||
print_usage
|
||||
|
||||
/bin/cat <<__EOT
|
||||
|
||||
Options:
|
||||
-h
|
||||
Print detailed help screen
|
||||
-V
|
||||
Print version information
|
||||
|
||||
-w INTEGER
|
||||
Exit with WARNING status if less than INTEGER MB of memory are free
|
||||
-w PERCENT%
|
||||
Exit with WARNING status if less than PERCENT of memory is free
|
||||
-c INTEGER
|
||||
Exit with CRITICAL status if less than INTEGER MB of memory are free
|
||||
-c PERCENT%
|
||||
Exit with CRITICAL status if less than PERCENT of memory is free
|
||||
-v
|
||||
Verbose output
|
||||
__EOT
|
||||
}
|
||||
|
||||
# Main #########################################################################
|
||||
|
||||
# Total memory size (in MB)
|
||||
tot_mem=$(( `/sbin/sysctl -n hw.physmem` / BYTES_IN_MB))
|
||||
# Free memory size (in MB)
|
||||
free_mem=$(/usr/bin/vmstat | /usr/bin/tail -1 | /usr/bin/awk '{ print $4 }' | tr -d 'M')
|
||||
# Free memory size (in percentage)
|
||||
free_mem_perc=$(( free_mem * 100 / tot_mem ))
|
||||
|
||||
# Verbosity level
|
||||
verbosity=0
|
||||
# Warning threshold
|
||||
thresh_warn=
|
||||
# Critical threshold
|
||||
thresh_crit=
|
||||
|
||||
# Parse command line options
|
||||
while [ "$1" ]; do
|
||||
case "$1" in
|
||||
-h | --help)
|
||||
print_help
|
||||
exit $STATE_OK
|
||||
;;
|
||||
-V | --version)
|
||||
print_revision
|
||||
exit $STATE_OK
|
||||
;;
|
||||
-v | --verbose)
|
||||
: $(( verbosity++ ))
|
||||
shift
|
||||
;;
|
||||
-w | --warning | -c | --critical)
|
||||
if [[ -z "$2" || "$2" = -* ]]; then
|
||||
# Threshold not provided
|
||||
echo "$PROGNAME: Option '$1' requires an argument"
|
||||
print_usage
|
||||
exit $STATE_UNKNOWN
|
||||
elif [[ "$2" = +([0-9]) ]]; then
|
||||
# Threshold is a number (MB)
|
||||
thresh=$2
|
||||
elif [[ "$2" = +([0-9])% ]]; then
|
||||
# Threshold is a percentage
|
||||
thresh=$(( tot_mem * ${2%\%} / 100 ))
|
||||
else
|
||||
# Threshold is neither a number nor a percentage
|
||||
echo "$PROGNAME: Threshold must be integer or percentage"
|
||||
print_usage
|
||||
exit $STATE_UNKNOWN
|
||||
fi
|
||||
[[ "$1" = *-w* ]] && thresh_warn=$thresh || thresh_crit=$thresh
|
||||
shift 2
|
||||
;;
|
||||
-?)
|
||||
print_usage
|
||||
exit $STATE_OK
|
||||
;;
|
||||
*)
|
||||
echo "$PROGNAME: Invalid option '$1'"
|
||||
print_usage
|
||||
exit $STATE_UNKNOWN
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ -z "$thresh_warn" || -z "$thresh_crit" ]]; then
|
||||
# One or both thresholds were not specified
|
||||
echo "$PROGNAME: Threshold not set"
|
||||
print_usage
|
||||
exit $STATE_UNKNOWN
|
||||
elif [[ "$thresh_crit" -gt "$thresh_warn" ]]; then
|
||||
# The warning threshold must be greater than the critical threshold
|
||||
echo "$PROGNAME: Warning free space should be more than critical free space"
|
||||
print_usage
|
||||
exit $STATE_UNKNOWN
|
||||
fi
|
||||
|
||||
if [[ "$verbosity" -ge 2 ]]; then
|
||||
# Print debugging information
|
||||
/bin/cat <<__EOT
|
||||
Debugging information:
|
||||
Warning threshold: $thresh_warn MB
|
||||
Critical threshold: $thresh_crit MB
|
||||
Verbosity level: $verbosity
|
||||
Total memory: $tot_mem MB
|
||||
Free memory: $free_mem MB ($free_mem_perc%)
|
||||
__EOT
|
||||
fi
|
||||
|
||||
if [[ "$free_mem" -lt "$thresh_crit" ]]; then
|
||||
# Free memory is less than the critical threshold
|
||||
echo "MEMORY CRITICAL - $free_mem_perc% free ($free_mem MB out of $tot_mem MB)"
|
||||
exit $STATE_CRITICAL
|
||||
elif [[ "$free_mem" -lt "$thresh_warn" ]]; then
|
||||
# Free memory is less than the warning threshold
|
||||
echo "MEMORY WARNING - $free_mem_perc% free ($free_mem MB out of $tot_mem MB)"
|
||||
exit $STATE_WARNING
|
||||
else
|
||||
# There's enough free memory!
|
||||
echo "MEMORY OK - $free_mem_perc% free ($free_mem MB out of $tot_mem MB)"
|
||||
exit $STATE_OK
|
||||
fi
|
|
@ -1,23 +0,0 @@
|
|||
#!/bin/sh
|
||||
IPSECCTL="/sbin/ipsecctl -s sa"
|
||||
STATUS=0
|
||||
|
||||
LINE1=`$IPSECCTL | grep "from $1 to $2" `
|
||||
if [ $? -eq 1 ]; then
|
||||
STATUS=2;
|
||||
OUTPUT1="No VPN from $1 to $2 "
|
||||
fi
|
||||
|
||||
LINE2=`$IPSECCTL | grep "from $2 to $1" `
|
||||
if [ $? -eq 1 ]; then
|
||||
STATUS=2;
|
||||
OUTPUT2="No VPN from $2 to $1"
|
||||
fi
|
||||
|
||||
if [ $STATUS -eq 0 ]; then
|
||||
echo "VPN OK - $3 is up"
|
||||
exit $STATUS
|
||||
else
|
||||
echo "VPN DOWN - $3 is down ($OUTPUT1 $OUTPUT2)"
|
||||
exit $STATUS
|
||||
fi
|
|
@ -1,9 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
if netstat -an|grep '.1194' >/dev/null; then
|
||||
echo "VPN OK"
|
||||
return 0
|
||||
else
|
||||
echo "PROCESS NOT LISTENING"
|
||||
return 2
|
||||
fi
|
|
@ -1,21 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Script writen by Evolix
|
||||
|
||||
_WARNING_STATES_LIMIT=130000
|
||||
_CRTICAL_STATES_LIMIT=150000
|
||||
|
||||
. /usr/local/libexec/nagios/utils.sh
|
||||
|
||||
_CHECK_STATES=$(/sbin/pfctl -si | /usr/bin/grep current | /usr/bin/sed s,\ current\ entries\ ,,g | /usr/bin/sed -e 's,^[ \t]*,,' | /usr/bin/sed 's, *$,,')
|
||||
|
||||
if [ $_CHECK_STATES -lt $_WARNING_STATES_LIMIT ];then
|
||||
echo "OK: States number ($_CHECK_STATES) is below threshold ($_WARNING_STATES_LIMIT / $_CRTICAL_STATES_LIMIT)"
|
||||
exit "$STATE_OK"
|
||||
elif [ $_CHECK_STATES -ge $_WARNING_STATES_LIMIT ] && [ $_CHECK_STATES -lt $_CRTICAL_STATES_LIMIT ];then
|
||||
echo "WARNING: States number is $_CHECK_STATES (threshold WARNING = $_WARNING_STATES_LIMIT)"
|
||||
exit "$_STATE_WARNING"
|
||||
else
|
||||
echo "CRITICAL: States number is $_CHECK_STATES (threshold CRITICAL = $_CRTICAL_STATES_LIMIT)"
|
||||
exit "$_STATE_CRITICAL"
|
||||
fi
|
Loading…
Reference in a new issue