Nagios Exchange Nagios Exchange
  • Home
  • Directory
  • Library
  • Support
  • About

Advanced Search

Build precise queries to find exactly what you need

Search Logic

Select compatible versions

Press ESC to close

Sign In Sign Up

Nagios World Conference 2026: Sept. 14-17 in St. Paul, MN | Learn More

  • Home
  • Directory
  • Library
  • Support
  • About
Plugins4404Themes and Skins13Add-ons757Graphics and Logos36View All Categories
LinuxSecuritySNMPFile SystemCloud
New Listings Recently Updated Listings Most Favored Listings Most Popular Listings Most Rated Listings Most Reviewed Listings
Random Project
Microsoft Exchange Exchange 2010 Services Check
0.0 (0)
8K
RSS Feed
Newest Listings Updated Listings
Top Contributors
Yoann LAMY (7)deskwork_itunes142 (4)Chad Columbus (3)Marcin Bednarski (3)Sam N (3)
See More
Newest Contributors
signalgrid (1)Sanna Glue (2)fisherrs (1)smolinux (1)juanfertor (1)
See More

Copyright © 2009-2026 Nagios Enterprises, LLC. All rights reserved.

Privacy PolicyTerms of UseTrademarks
Home > Gérard Gold
GG

Gérard Gold

@Goldie2009

User Stats

Member Since: June 23, 2015

Favorites0

Views

Projects0

No Projects Found
check_dhcp_all_pools.sh

Customized for better PERFDATA and STATUS output

Some customizing für usage with a Windows Server 2008 R2 (SNMP feature installed): if [ $# -lt 2 ]; then echo "check_dhcp_all_pools" echo "Usage: $0 " echo "Example: WARN at 50 & CRIT at 30 will WARN you when the percentage of free DHCP addresses" echo "is less than or equal to 50% of available addresses and alarm CRITICAL whe the percentage" echo "of free addresses is less than or equal to 30% of available addresses." exit 3 fi IP="$1" COMMUNITY="$2" WARN="$3" CRIT="$4" RET=0 RETW=0 RETC=0 Z=0 STAT=( ) i=0 RESULT="" if [ ${#WARN} -lt 1 ] then WARN=20 fi if [ ${#CRIT} -lt 1 ] then CRIT=10 fi #Get the list of all scopes/subnets from the server: TEMP=($( snmpwalk -v2c -c $COMMUNITY $IP .1.3.6.1.4.1.311.1.3.2.1.1.1 | cut -d " " -f4 )) #Traverse array and get usage information per scope: for i in ${!TEMP[*]};do POOL=${TEMP[$i]} FREEOID=".1.3.6.1.4.1.311.1.3.2.1.1.3.$POOL" USEDOID=".1.3.6.1.4.1.311.1.3.2.1.1.2.$POOL" SNMP_RESULT=`snmpget -v 2c -c $COMMUNITY $IP $FREEOID` FREE=`echo $SNMP_RESULT|cut -d " " -f4` SNMP_RESULT=`snmpget -v 2c -c $COMMUNITY $IP $USEDOID` USED=`echo $SNMP_RESULT|cut -d " " -f4` MAX=`echo "$FREE+$USED" |bc` if [ "$MAX" -ne 0 ]; then PERCFREE=`echo "$FREE*100/$MAX" |bc` PERCUSED=`echo "$USED*100/$MAX" |bc` #Debug: echo "FREE: $FREE USED: $USED MAX: $MAX PERC: $PERCFREE,$PERCUSED" if [ "$PERCFREE" -le "$WARN" -a "$PERCFREE" -gt "$CRIT" ]; then let "RETW += 1" STAT=( "${STAT[@]}" "Warning: $POOL - $PERCFREE% free - $PERCUSED% used - $USED/$MAX - Threshold is $WARN% freen" ) elif [ "$PERCFREE" -le "$CRIT" ]; then let "RETC += 1" STAT=( "${STAT[@]}" "Critical: $POOL - $PERCFREE% free - $PERCUSED% used - $USED/$MAX - Threshold is $CRIT% freen" ) else STAT=( "${STAT[@]}" "OK: $POOL - $PERCUSED% used - $USED/$MAXn" ) fi # elif [ "$MAX" -eq 0 ]; then #Debug for detecting 100% excluded ranges (reservations only): # STAT=( "${STAT[@]}" "OK: $POOL Nothing used, could be excluded" ) fi # Performance-Data PERFDATA="${PERFDATA} | 'Scope Usage' $POOL=$PERCUSED%;$WARN;$CRIT;0;$MAX" # PERFDATA="${PERFDATA} | $POOL OK - Usage: $PERCUSED% ($FREE Addresses of $MAX in pool free) n" done #Evaluate return code: if [ "$RETC" -eq 0 -a "$RETW" -eq 0 ]; then RET=0 RESULT="${RESULT} OK: All scopes finenn" elif [ "$RETW" -ne 0 -a "$RETC" -eq 0 ]; then RET=1 RESULT="${RESULT} Warning: One or more scopes is nearing capacitynn" elif [ "$RETC" -ne 0 ]; then RET=2 RESULT="${RESULT} Critical: One or more scopes is nearing capacitynn" fi ###### Second loop for long service output: for i in ${!STAT[*]};do RESULT="${RESULT} ${STAT[$i]}" done #Echo the total amount of scopes available vs those shown: RESULT="${RESULT} nShowing ${#STAT[@]} of ${#TEMP[@]} configured scopes" echo "$RESULT|$PERFDATA" exit $RET

Reviewed 11 years ago

No Favorites Found

Copyright © 2009-2026 Nagios Enterprises, LLC. All rights reserved.

Privacy PolicyTerms of UseTrademarks
Home Browse Submit Profile