remove it from this one too

This commit is contained in:
Sean Finney 2008-02-15 20:05:53 +00:00
parent b432090b31
commit 624dc415b3
4 changed files with 876 additions and 780 deletions

125
config.guess vendored
View file

@ -1,9 +1,9 @@
#! /bin/sh #! /bin/sh
# Attempt to guess a canonical system name. # Attempt to guess a canonical system name.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. # 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
timestamp='2005-04-22' timestamp='2003-10-20'
# This file is free software; you can redistribute it and/or modify it # This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by # under the terms of the GNU General Public License as published by
@ -53,7 +53,7 @@ version="\
GNU config.guess ($timestamp) GNU config.guess ($timestamp)
Originally written by Per Bothner. Originally written by Per Bothner.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
Free Software Foundation, Inc. Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO This is free software; see the source for copying conditions. There is NO
@ -197,21 +197,15 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
echo "${machine}-${os}${release}" echo "${machine}-${os}${release}"
exit 0 ;; exit 0 ;;
amd64:OpenBSD:*:*)
echo x86_64-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
amiga:OpenBSD:*:*) amiga:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE} echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
cats:OpenBSD:*:*) arc:OpenBSD:*:*)
echo arm-unknown-openbsd${UNAME_RELEASE} echo mipsel-unknown-openbsd${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
hp300:OpenBSD:*:*) hp300:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE} echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
luna88k:OpenBSD:*:*)
echo m88k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
mac68k:OpenBSD:*:*) mac68k:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE} echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
@ -227,33 +221,28 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
mvmeppc:OpenBSD:*:*) mvmeppc:OpenBSD:*:*)
echo powerpc-unknown-openbsd${UNAME_RELEASE} echo powerpc-unknown-openbsd${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
pegasos:OpenBSD:*:*)
echo powerpc-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
pmax:OpenBSD:*:*)
echo mipsel-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
sgi:OpenBSD:*:*) sgi:OpenBSD:*:*)
echo mips64-unknown-openbsd${UNAME_RELEASE} echo mipseb-unknown-openbsd${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
sun3:OpenBSD:*:*) sun3:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE} echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
wgrisc:OpenBSD:*:*)
echo mipsel-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
*:OpenBSD:*:*) *:OpenBSD:*:*)
echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
*:ekkoBSD:*:*)
echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
exit 0 ;;
macppc:MirBSD:*:*)
echo powerppc-unknown-mirbsd${UNAME_RELEASE}
exit 0 ;;
*:MirBSD:*:*)
echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
exit 0 ;;
alpha:OSF1:*:*) alpha:OSF1:*:*)
case $UNAME_RELEASE in if test $UNAME_RELEASE = "V4.0"; then
*4.0)
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
;; fi
*5.*)
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
;;
esac
# According to Compaq, /usr/sbin/psrinfo has been available on # According to Compaq, /usr/sbin/psrinfo has been available on
# OSF/1 and Tru64 systems produced since 1995. I hope that # OSF/1 and Tru64 systems produced since 1995. I hope that
# covers most systems running today. This code pipes the CPU # covers most systems running today. This code pipes the CPU
@ -291,12 +280,14 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
"EV7.9 (21364A)") "EV7.9 (21364A)")
UNAME_MACHINE="alphaev79" ;; UNAME_MACHINE="alphaev79" ;;
esac esac
# A Pn.n version is a patched version.
# A Vn.n version is a released version. # A Vn.n version is a released version.
# A Tn.n version is a released field test version. # A Tn.n version is a released field test version.
# A Xn.n version is an unreleased experimental baselevel. # A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r. # 1.2 uses "1.2" for uname -r.
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
exit 0 ;;
Alpha*:OpenVMS:*:*)
echo alpha-hp-vms
exit 0 ;; exit 0 ;;
Alpha\ *:Windows_NT*:*) Alpha\ *:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem? # How do we know it's Interix rather than the generic POSIX subsystem?
@ -319,9 +310,6 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
*:OS/390:*:*) *:OS/390:*:*)
echo i370-ibm-openedition echo i370-ibm-openedition
exit 0 ;; exit 0 ;;
*:z/VM:*:*)
echo s390-ibm-zvmoe
exit 0 ;;
*:OS400:*:*) *:OS400:*:*)
echo powerpc-ibm-os400 echo powerpc-ibm-os400
exit 0 ;; exit 0 ;;
@ -345,7 +333,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
DRS?6000:unix:4.0:6*) DRS?6000:unix:4.0:6*)
echo sparc-icl-nx6 echo sparc-icl-nx6
exit 0 ;; exit 0 ;;
DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) DRS?6000:UNIX_SV:4.2*:7*)
case `/usr/bin/uname -p` in case `/usr/bin/uname -p` in
sparc) echo sparc-icl-nx7 && exit 0 ;; sparc) echo sparc-icl-nx7 && exit 0 ;;
esac ;; esac ;;
@ -417,9 +405,6 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
echo m68k-unknown-mint${UNAME_RELEASE} echo m68k-unknown-mint${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
m68k:machten:*:*)
echo m68k-apple-machten${UNAME_RELEASE}
exit 0 ;;
powerpc:machten:*:*) powerpc:machten:*:*)
echo powerpc-apple-machten${UNAME_RELEASE} echo powerpc-apple-machten${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
@ -755,7 +740,7 @@ EOF
echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;; exit 0 ;;
*:UNICOS/mp:*:*) *:UNICOS/mp:*:*)
echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;; exit 0 ;;
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
@ -778,7 +763,21 @@ EOF
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
*:FreeBSD:*:*) *:FreeBSD:*:*)
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` # Determine whether the default compiler uses glibc.
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#include <features.h>
#if __GLIBC__ >= 2
LIBC=gnu
#else
LIBC=
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
# GNU/KFreeBSD systems have a "k" prefix to indicate we are using
# FreeBSD's kernel, but not the complete OS.
case ${LIBC} in gnu) kernel_only='k' ;; esac
echo ${UNAME_MACHINE}-unknown-${kernel_only}freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC}
exit 0 ;; exit 0 ;;
i*:CYGWIN*:*) i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin echo ${UNAME_MACHINE}-pc-cygwin
@ -804,9 +803,6 @@ EOF
i*:UWIN*:*) i*:UWIN*:*)
echo ${UNAME_MACHINE}-pc-uwin echo ${UNAME_MACHINE}-pc-uwin
exit 0 ;; exit 0 ;;
amd64:CYGWIN*:*:*)
echo x86_64-unknown-cygwin
exit 0 ;;
p*:CYGWIN*:*) p*:CYGWIN*:*)
echo powerpcle-unknown-cygwin echo powerpcle-unknown-cygwin
exit 0 ;; exit 0 ;;
@ -830,18 +826,9 @@ EOF
cris:Linux:*:*) cris:Linux:*:*)
echo cris-axis-linux-gnu echo cris-axis-linux-gnu
exit 0 ;; exit 0 ;;
crisv32:Linux:*:*)
echo crisv32-axis-linux-gnu
exit 0 ;;
frv:Linux:*:*)
echo frv-unknown-linux-gnu
exit 0 ;;
ia64:Linux:*:*) ia64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu echo ${UNAME_MACHINE}-unknown-linux-gnu
exit 0 ;; exit 0 ;;
m32r*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit 0 ;;
m68*:Linux:*:*) m68*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu echo ${UNAME_MACHINE}-unknown-linux-gnu
exit 0 ;; exit 0 ;;
@ -1082,9 +1069,9 @@ EOF
M680?0:D-NIX:5.3:*) M680?0:D-NIX:5.3:*)
echo m68k-diab-dnix echo m68k-diab-dnix
exit 0 ;; exit 0 ;;
M68*:*:R3V[5678]*:*) M68*:*:R3V[567]*:*)
test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0)
OS_REL='' OS_REL=''
test -r /etc/.relid \ test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
@ -1140,10 +1127,6 @@ EOF
# From seanf@swdc.stratus.com. # From seanf@swdc.stratus.com.
echo i860-stratus-sysv4 echo i860-stratus-sysv4
exit 0 ;; exit 0 ;;
i*86:VOS:*:*)
# From Paul.Green@stratus.com.
echo ${UNAME_MACHINE}-stratus-vos
exit 0 ;;
*:VOS:*:*) *:VOS:*:*)
# From Paul.Green@stratus.com. # From Paul.Green@stratus.com.
echo hppa1.1-stratus-vos echo hppa1.1-stratus-vos
@ -1186,10 +1169,9 @@ EOF
echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
*:Darwin:*:*) *:Darwin:*:*)
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case `uname -p` in
case $UNAME_PROCESSOR in
*86) UNAME_PROCESSOR=i686 ;; *86) UNAME_PROCESSOR=i686 ;;
unknown) UNAME_PROCESSOR=powerpc ;; powerpc) UNAME_PROCESSOR=powerpc ;;
esac esac
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
@ -1204,10 +1186,7 @@ EOF
*:QNX:*:4*) *:QNX:*:4*)
echo i386-pc-qnx echo i386-pc-qnx
exit 0 ;; exit 0 ;;
NSE-?:NONSTOP_KERNEL:*:*) NSR-[DGKLNPTVWY]:NONSTOP_KERNEL:*:*)
echo nse-tandem-nsk${UNAME_RELEASE}
exit 0 ;;
NSR-?:NONSTOP_KERNEL:*:*)
echo nsr-tandem-nsk${UNAME_RELEASE} echo nsr-tandem-nsk${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
*:NonStop-UX:*:*) *:NonStop-UX:*:*)
@ -1251,18 +1230,8 @@ EOF
SEI:*:*:SEIUX) SEI:*:*:SEIUX)
echo mips-sei-seiux${UNAME_RELEASE} echo mips-sei-seiux${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
*:DragonFly:*:*) *:DRAGONFLY:*:*)
echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` echo ${UNAME_MACHINE}-unknown-dragonfly${UNAME_RELEASE}
exit 0 ;;
*:*VMS:*:*)
UNAME_MACHINE=`(uname -p) 2>/dev/null`
case "${UNAME_MACHINE}" in
A*) echo alpha-dec-vms && exit 0 ;;
I*) echo ia64-dec-vms && exit 0 ;;
V*) echo vax-dec-vms && exit 0 ;;
esac ;;
*:XENIX:*:SysV)
echo i386-pc-xenix
exit 0 ;; exit 0 ;;
esac esac
@ -1423,9 +1392,7 @@ This script, last modified $timestamp, has failed to recognize
the operating system you are using. It is advised that you the operating system you are using. It is advised that you
download the most up to date version of the config scripts from download the most up to date version of the config scripts from
http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess ftp://ftp.gnu.org/pub/gnu/config/
and
http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
If the version you run ($0) is already up to date, please If the version you run ($0) is already up to date, please
send the following data and any information you think might be send the following data and any information you think might be

89
config.sub vendored
View file

@ -1,9 +1,9 @@
#! /bin/sh #! /bin/sh
# Configuration validation subroutine script. # Configuration validation subroutine script.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. # 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
timestamp='2005-04-22' timestamp='2003-11-20'
# This file is (in principle) common to ALL GNU software. # This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software # The presence of a machine in this file suggests that SOME GNU software
@ -70,7 +70,7 @@ Report bugs and patches to <config-patches@gnu.org>."
version="\ version="\
GNU config.sub ($timestamp) GNU config.sub ($timestamp)
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
Free Software Foundation, Inc. Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO This is free software; see the source for copying conditions. There is NO
@ -145,7 +145,7 @@ case $os in
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-apple | -axis | -knuth | -cray) -apple | -axis)
os= os=
basic_machine=$1 basic_machine=$1
;; ;;
@ -231,14 +231,13 @@ case $basic_machine in
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
| am33_2.0 \ | am33_2.0 \
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
| bfin \
| c4x | clipper \ | c4x | clipper \
| d10v | d30v | dlx | dsp16xx \ | d10v | d30v | dlx | dsp16xx \
| fr30 | frv \ | fr30 | frv \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| i370 | i860 | i960 | ia64 \ | i370 | i860 | i960 | ia64 \
| ip2k | iq2000 \ | ip2k | iq2000 \
| m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \ | m32r | m68000 | m68k | m88k | mcore \
| mips | mipsbe | mipseb | mipsel | mipsle \ | mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \ | mips16 \
| mips64 | mips64el \ | mips64 | mips64el \
@ -263,13 +262,12 @@ case $basic_machine in
| pyramid \ | pyramid \
| sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \ | sh64 | sh64le \
| sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \ | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
| sparcv8 | sparcv9 | sparcv9b \
| strongarm \ | strongarm \
| tahoe | thumb | tic4x | tic80 | tron \ | tahoe | thumb | tic4x | tic80 | tron \
| v850 | v850e \ | v850 | v850e \
| we32k \ | we32k \
| x86 | xscale | xscalee[bl] | xstormy16 | xtensa \ | x86 | xscale | xstormy16 | xtensa \
| z8k) | z8k)
basic_machine=$basic_machine-unknown basic_machine=$basic_machine-unknown
;; ;;
@ -300,9 +298,9 @@ case $basic_machine in
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* \ | avr-* \
| bfin-* | bs2000-* \ | bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
| clipper-* | craynv-* | cydra-* \ | clipper-* | cydra-* \
| d10v-* | d30v-* | dlx-* \ | d10v-* | d30v-* | dlx-* \
| elxsi-* \ | elxsi-* \
| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
@ -310,9 +308,9 @@ case $basic_machine in
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
| i*86-* | i860-* | i960-* | ia64-* \ | i*86-* | i860-* | i960-* | ia64-* \
| ip2k-* | iq2000-* \ | ip2k-* | iq2000-* \
| m32r-* | m32rle-* \ | m32r-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
| m88110-* | m88k-* | maxq-* | mcore-* \ | m88110-* | m88k-* | mcore-* \
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
| mips16-* \ | mips16-* \
| mips64-* | mips64el-* \ | mips64-* | mips64el-* \
@ -328,9 +326,8 @@ case $basic_machine in
| mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \
| mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \
| mipstx39-* | mipstx39el-* \ | mipstx39-* | mipstx39el-* \
| mmix-* \
| msp430-* \ | msp430-* \
| none-* | np1-* | ns16k-* | ns32k-* \ | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \
| orion-* \ | orion-* \
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
@ -338,16 +335,15 @@ case $basic_machine in
| romp-* | rs6000-* \ | romp-* | rs6000-* \
| sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
| sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \ | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
| sparclite-* \ | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
| sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
| tahoe-* | thumb-* \ | tahoe-* | thumb-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
| tron-* \ | tron-* \
| v850-* | v850e-* | vax-* \ | v850-* | v850e-* | vax-* \
| we32k-* \ | we32k-* \
| x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \ | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
| xstormy16-* | xtensa-* \ | xtensa-* \
| ymp-* \ | ymp-* \
| z8k-*) | z8k-*)
;; ;;
@ -367,9 +363,6 @@ case $basic_machine in
basic_machine=a29k-amd basic_machine=a29k-amd
os=-udi os=-udi
;; ;;
abacus)
basic_machine=abacus-unknown
;;
adobe68k) adobe68k)
basic_machine=m68010-adobe basic_machine=m68010-adobe
os=-scout os=-scout
@ -387,9 +380,6 @@ case $basic_machine in
amd64) amd64)
basic_machine=x86_64-pc basic_machine=x86_64-pc
;; ;;
amd64-*)
basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
amdahl) amdahl)
basic_machine=580-amdahl basic_machine=580-amdahl
os=-sysv os=-sysv
@ -449,27 +439,12 @@ case $basic_machine in
basic_machine=j90-cray basic_machine=j90-cray
os=-unicos os=-unicos
;; ;;
craynv)
basic_machine=craynv-cray
os=-unicosmp
;;
cr16c)
basic_machine=cr16c-unknown
os=-elf
;;
crds | unos) crds | unos)
basic_machine=m68k-crds basic_machine=m68k-crds
;; ;;
crisv32 | crisv32-* | etraxfs*)
basic_machine=crisv32-axis
;;
cris | cris-* | etrax*) cris | cris-* | etrax*)
basic_machine=cris-axis basic_machine=cris-axis
;; ;;
crx)
basic_machine=crx-unknown
os=-elf
;;
da30 | da30-*) da30 | da30-*)
basic_machine=m68k-da30 basic_machine=m68k-da30
;; ;;
@ -492,10 +467,6 @@ case $basic_machine in
basic_machine=m88k-motorola basic_machine=m88k-motorola
os=-sysv3 os=-sysv3
;; ;;
djgpp)
basic_machine=i586-pc
os=-msdosdjgpp
;;
dpx20 | dpx20-*) dpx20 | dpx20-*)
basic_machine=rs6000-bull basic_machine=rs6000-bull
os=-bosx os=-bosx
@ -674,6 +645,10 @@ case $basic_machine in
mips3*) mips3*)
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
;; ;;
mmix*)
basic_machine=mmix-knuth
os=-mmixware
;;
monitor) monitor)
basic_machine=m68k-rom68k basic_machine=m68k-rom68k
os=-coff os=-coff
@ -754,6 +729,10 @@ case $basic_machine in
np1) np1)
basic_machine=np1-gould basic_machine=np1-gould
;; ;;
nv1)
basic_machine=nv1-cray
os=-unicosmp
;;
nsr-tandem) nsr-tandem)
basic_machine=nsr-tandem basic_machine=nsr-tandem
;; ;;
@ -1036,10 +1015,6 @@ case $basic_machine in
basic_machine=hppa1.1-winbond basic_machine=hppa1.1-winbond
os=-proelf os=-proelf
;; ;;
xbox)
basic_machine=i686-pc
os=-mingw32
;;
xps | xps100) xps | xps100)
basic_machine=xps100-honeywell basic_machine=xps100-honeywell
;; ;;
@ -1070,9 +1045,6 @@ case $basic_machine in
romp) romp)
basic_machine=romp-ibm basic_machine=romp-ibm
;; ;;
mmix)
basic_machine=mmix-knuth
;;
rs6000) rs6000)
basic_machine=rs6000-ibm basic_machine=rs6000-ibm
;; ;;
@ -1095,7 +1067,7 @@ case $basic_machine in
sh64) sh64)
basic_machine=sh64-unknown basic_machine=sh64-unknown
;; ;;
sparc | sparcv8 | sparcv9 | sparcv9b) sparc | sparcv9 | sparcv9b)
basic_machine=sparc-sun basic_machine=sparc-sun
;; ;;
cydra) cydra)
@ -1168,9 +1140,8 @@ case $os in
| -aos* \ | -aos* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \ | -hiux* | -386bsd* | -knetbsd* | -netbsd* | -openbsd* | -kfreebsd* | -freebsd* | -riscix* \
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -chorusos* | -chorusrdb* \ | -chorusos* | -chorusrdb* \
@ -1308,9 +1279,6 @@ case $os in
-kaos*) -kaos*)
os=-kaos os=-kaos
;; ;;
-zvmoe)
os=-zvmoe
;;
-none) -none)
;; ;;
*) *)
@ -1391,9 +1359,6 @@ case $basic_machine in
*-ibm) *-ibm)
os=-aix os=-aix
;; ;;
*-knuth)
os=-mmixware
;;
*-wec) *-wec)
os=-proelf os=-proelf
;; ;;

644
configure vendored

File diff suppressed because it is too large Load diff

View file

@ -1,400 +1,400 @@
#!/bin/bash #!/bin/bash
# #
# Check_procl.sh # Check_procl.sh
# #
# Program: Process load check plugin for Nagios # Program: Process load check plugin for Nagios
# License : GPL # License : GPL
# Copyright (c) 2002 Jerome Tytgat (j.tytgat@sioban.net) # Copyright (c) 2002 Jerome Tytgat (j.tytgat@sioban.net)
# #
# check_procl.sh,v 1.1 2002/07/04 09:35 # check_procl.sh,v 1.1 2002/07/04 09:35
# #
# Description : # Description :
# #
# This plugin is for check the %cpu, %mem or cputime of one or more process # This plugin is for check the %cpu, %mem or cputime of one or more process
# #
# Usage : # Usage :
# #
# check_procl.sh -p process1,process2,... -w a.b -c c.d --cpu # check_procl.sh -p process1,process2,... -w a.b -c c.d --cpu
# check_procl.sh -p process1,process2,... -w a.b -c c.d --mem # check_procl.sh -p process1,process2,... -w a.b -c c.d --mem
# check_procl.sh -p process1,process2,... -w a:b:c -c d:e:f --cputime # check_procl.sh -p process1,process2,... -w a:b:c -c d:e:f --cputime
# #
# check_procl.sh -p %all% -e process1,process2,... -w <a.b | a:b:c> -c <c.d | d:e:f> <--cpu | --mem | --cputime> # check_procl.sh -p %all% -e process1,process2,... -w <a.b | a:b:c> -c <c.d | d:e:f> <--cpu | --mem | --cputime>
# check_procl.sh -p %max% -e process1,process2,... -w <a.b | a:b:c> -c <c.d | d:e:f> <--cpu | --mem | --cputime> # check_procl.sh -p %max% -e process1,process2,... -w <a.b | a:b:c> -c <c.d | d:e:f> <--cpu | --mem | --cputime>
# #
# Example : # Example :
# #
# To know the memory eaten by HTTPD processes, be warned when it reach 50% and be critical when it reach 75% # To know the memory eaten by HTTPD processes, be warned when it reach 50% and be critical when it reach 75%
# check_procl.sh -p httpd -w 50.0 -c 75.0 --mem # check_procl.sh -p httpd -w 50.0 -c 75.0 --mem
# > OK - total %MEM for process httpd : 46.1 # > OK - total %MEM for process httpd : 46.1
# #
# To know the process which eat the more cpu time, but as we are under linux and are using kapm we do : # To know the process which eat the more cpu time, but as we are under linux and are using kapm we do :
# check_procl.sh -p %max% -e kapmd-idle,kapmd -w 0:1:0 -c 0:2:0 --cputime # check_procl.sh -p %max% -e kapmd-idle,kapmd -w 0:1:0 -c 0:2:0 --cputime
# > CRITICAL - total CPUTIME for process named : 02:32:10 # > CRITICAL - total CPUTIME for process named : 02:32:10
# #
# Tested on solaris 7/8, Linux Redhat 7.3 and Linux Suse 7.1 # Tested on solaris 7/8, Linux Redhat 7.3 and Linux Suse 7.1
# #
# BUGS : problems with handling time on solaris... # BUGS : problems with handling time on solaris...
help_usage() { help_usage() {
echo "Usage:" echo "Usage:"
echo " $0 -p <process_name1,process_name2,... | %all% | %max%>" echo " $0 -p <process_name1,process_name2,... | %all% | %max%>"
echo " [-e <process_name1,process_name2,...>] -w warning -c critical < --cpu | --mem | --cputime>" echo " [-e <process_name1,process_name2,...>] -w warning -c critical < --cpu | --mem | --cputime>"
echo " $0 (-v | --version)" echo " $0 (-v | --version)"
echo " $0 (-h | --help)" echo " $0 (-h | --help)"
} }
help_version() { help_version() {
echo "check_procl.sh (nagios-plugins) 1.1" echo "check_procl.sh (nagios-plugins) 1.1"
echo "The nagios plugins come with ABSOLUTELY NO WARRANTY. You may redistribute" echo "The nagios plugins come with ABSOLUTELY NO WARRANTY. You may redistribute"
echo "copies of the plugins under the terms of the GNU General Public License." echo "copies of the plugins under the terms of the GNU General Public License."
echo "For more information about these matters, see the file named COPYING." echo "For more information about these matters, see the file named COPYING."
echo "Copyright (c) 2002 Jerome Tytgat - j.tytgat@sioban.net" echo "Copyright (c) 2002 Jerome Tytgat - j.tytgat@sioban.net"
echo "Greetings goes to Websurg which kindly let me took time to develop this" echo "Greetings goes to Websurg which kindly let me took time to develop this"
echo " Manu Feig and Jacques Kern who were my beta testers, thanks to them !" echo " Manu Feig and Jacques Kern who were my beta testers, thanks to them !"
} }
verify_dep() { verify_dep() {
needed="bash cut egrep expr grep let ps sed sort tail test tr wc" needed="bash cut egrep expr grep let ps sed sort tail test tr wc"
for i in `echo $needed` for i in `echo $needed`
do do
type $i > /dev/null 2>&1 /dev/null type $i > /dev/null 2>&1 /dev/null
if [ $? -eq 1 ] if [ $? -eq 1 ]
then then
echo "I am missing an important component : $i" echo "I am missing an important component : $i"
echo "Cannot continue, sorry, try to find the missing one..." echo "Cannot continue, sorry, try to find the missing one..."
exit 3 exit 3
fi fi
done done
} }
myself=$0 myself=$0
verify_dep verify_dep
if [ "$1" = "-h" -o "$1" = "--help" ] if [ "$1" = "-h" -o "$1" = "--help" ]
then then
help_version help_version
echo "" echo ""
echo "This plugin will check either the cumulutative %cpu, %mem or cputime" echo "This plugin will check either the cumulutative %cpu, %mem or cputime"
echo "of a process." echo "of a process."
echo "" echo ""
help_usage help_usage
echo "" echo ""
echo "Required Arguments:" echo "Required Arguments:"
echo " -p, --process STRING1,STRING2,..." echo " -p, --process STRING1,STRING2,..."
echo " names of the processes we want to monitor," echo " names of the processes we want to monitor,"
echo " you can add as much as process as you want, separated by comma," echo " you can add as much as process as you want, separated by comma,"
echo " hey will be cumulated" echo " hey will be cumulated"
echo " -p, --process %all%" echo " -p, --process %all%"
echo " The special keyword %all% will check the cumulative cpu/mem/time of all process" echo " The special keyword %all% will check the cumulative cpu/mem/time of all process"
echo " WARNING : Can be very slow on heavy loaded servers, watch your timeout !" echo " WARNING : Can be very slow on heavy loaded servers, watch your timeout !"
echo " -p, --process %max%" echo " -p, --process %max%"
echo " The special keyword %max% will check the process which eat the most" echo " The special keyword %max% will check the process which eat the most"
echo " WARNING : only select the process which eat the more, not the cumulative," echo " WARNING : only select the process which eat the more, not the cumulative,"
echo " but return the cumulative" echo " but return the cumulative"
echo " -w, --warning INTEGER.INTEGER or INTERGER:INTEGER:INTEGER" echo " -w, --warning INTEGER.INTEGER or INTERGER:INTEGER:INTEGER"
echo " generate warning state if process count is outside this range" echo " generate warning state if process count is outside this range"
echo " -c, --critical INTEGER.INTEGER or INTERGER:INTEGER:INTEGER" echo " -c, --critical INTEGER.INTEGER or INTERGER:INTEGER:INTEGER"
echo " generate critical state if process count is outside this range" echo " generate critical state if process count is outside this range"
echo " --cpu" echo " --cpu"
echo " return the current cpu usage for the given process" echo " return the current cpu usage for the given process"
echo " --mem" echo " --mem"
echo " return the current memory usage for the given process" echo " return the current memory usage for the given process"
echo " --cputime" echo " --cputime"
echo " return the total cputime usage for the given process" echo " return the total cputime usage for the given process"
echo "" echo ""
echo "Optional Argument:" echo "Optional Argument:"
echo " -e, --exclude-process STRING1,STRING2,..." echo " -e, --exclude-process STRING1,STRING2,..."
echo " names of the processes we want don't want to monitor" echo " names of the processes we want don't want to monitor"
echo " only useful when associated with %all% or %max% keywords, else ignored" echo " only useful when associated with %all% or %max% keywords, else ignored"
echo " ex : kapm-idled on linux is a process which eat memory / cputime but not really... ;-)" echo " ex : kapm-idled on linux is a process which eat memory / cputime but not really... ;-)"
echo "" echo ""
exit 3 exit 3
fi fi
if [ "$1" = "-v" -o "$1" = "--version" ] if [ "$1" = "-v" -o "$1" = "--version" ]
then then
help_version help_version
exit 3 exit 3
fi fi
if [ `echo $@|tr "=" " "|wc -w` -lt 7 ] if [ `echo $@|tr "=" " "|wc -w` -lt 7 ]
then then
echo "Bad arguments number (need at least 7)!" echo "Bad arguments number (need at least 7)!"
help_usage help_usage
exit 3 exit 3
fi fi
tt=0 tt=0
process_name="" process_name=""
exclude_process_name="" exclude_process_name=""
wt="" wt=""
ct="" ct=""
# Test of the command lines arguments # Test of the command lines arguments
while test $# -gt 0 while test $# -gt 0
do do
case "$1" in case "$1" in
-p|--process) -p|--process)
if [ -n "$process_name" ] if [ -n "$process_name" ]
then then
echo "Only one --process argument is useful..." echo "Only one --process argument is useful..."
help_usage help_usage
exit 3 exit 3
fi fi
shift shift
process_name="`echo $1|tr \",\" \"|\"`" process_name="`echo $1|tr \",\" \"|\"`"
;; ;;
-e|--exclude-process) -e|--exclude-process)
if [ -n "$exclude_process_name" ] if [ -n "$exclude_process_name" ]
then then
echo "Only one --exclude-process argument is useful..." echo "Only one --exclude-process argument is useful..."
help_usage help_usage
exit 3 exit 3
fi fi
shift shift
exclude_process_name="`echo $1|tr \",\" \"|\"`" exclude_process_name="`echo $1|tr \",\" \"|\"`"
;; ;;
-w|--warning) -w|--warning)
if [ -n "$wt" ] if [ -n "$wt" ]
then then
echo "Only one --warning argument needed... Trying to test bad things ? :-)" echo "Only one --warning argument needed... Trying to test bad things ? :-)"
help_usage help_usage
exit 3 exit 3
fi fi
shift shift
wt=$1 wt=$1
;; ;;
-c|--critical) -c|--critical)
if [ -n "$ct" ] if [ -n "$ct" ]
then then
echo "Only one --critical argument needed... Trying to test bad things ? :-)" echo "Only one --critical argument needed... Trying to test bad things ? :-)"
help_usage help_usage
exit 3 exit 3
fi fi
shift shift
ct=$1 ct=$1
;; ;;
--cpu) --cpu)
if [ $tt -eq 0 ] if [ $tt -eq 0 ]
then then
tt=1 tt=1
else else
echo "Only one of the arguments --cpu/--mem/--cputime can be used at a time !" echo "Only one of the arguments --cpu/--mem/--cputime can be used at a time !"
help_usage help_usage
exit 3 exit 3
fi fi
type_arg_aff="%CPU" type_arg_aff="%CPU"
type_arg="pcpu" type_arg="pcpu"
delim="." delim="."
;; ;;
--mem) --mem)
if [ $tt -eq 0 ] if [ $tt -eq 0 ]
then then
tt=2 tt=2
else else
echo "Only one of the arguments --cpu/--mem/--cputime can be used at a time !" echo "Only one of the arguments --cpu/--mem/--cputime can be used at a time !"
help_usage help_usage
exit 3 exit 3
fi fi
type_arg_aff="%MEM" type_arg_aff="%MEM"
type_arg="pmem" type_arg="pmem"
delim="." delim="."
;; ;;
--cputime) --cputime)
if [ $tt -eq 0 ] if [ $tt -eq 0 ]
then then
tt=3 tt=3
else else
echo "Only one of the arguments --cpu/--mem/--cputime can be used at a time !" echo "Only one of the arguments --cpu/--mem/--cputime can be used at a time !"
help_usage help_usage
exit 3 exit 3
fi fi
type_arg_aff="TIME" type_arg_aff="TIME"
type_arg="time" type_arg="time"
delim=":" delim=":"
;; ;;
*) *)
echo "Unknown argument $1" echo "Unknown argument $1"
help_usage help_usage
exit 3 exit 3
;; ;;
esac esac
shift shift
done done
# Is the process running ? # Is the process running ?
if [ -z "`ps -e | egrep \"$process_name?\"`" -a "$process_name" != "%all%" -a "$process_name" != "%max%" ] if [ -z "`ps -e | egrep \"$process_name?\"`" -a "$process_name" != "%all%" -a "$process_name" != "%max%" ]
then then
echo "WARNING: process $process_name not running !" echo "WARNING: process $process_name not running !"
exit 3 exit 3
fi fi
# Cut of warning and critical values # Cut of warning and critical values
wt_value1=`echo $wt|cut -d"$delim" -f1` wt_value1=`echo $wt|cut -d"$delim" -f1`
wt_value2=`echo $wt|cut -d"$delim" -f2` wt_value2=`echo $wt|cut -d"$delim" -f2`
ct_value1=`echo $ct|cut -d"$delim" -f1` ct_value1=`echo $ct|cut -d"$delim" -f1`
ct_value2=`echo $ct|cut -d"$delim" -f2` ct_value2=`echo $ct|cut -d"$delim" -f2`
if [ $tt -eq 3 ] if [ $tt -eq 3 ]
then then
wt_value3=`echo $wt|cut -d"$delim" -f3` wt_value3=`echo $wt|cut -d"$delim" -f3`
ct_value3=`echo $ct|cut -d"$delim" -f3` ct_value3=`echo $ct|cut -d"$delim" -f3`
else else
wt_value3=0 wt_value3=0
ct_value3=0 ct_value3=0
fi fi
# Integrity check of warning and critical values # Integrity check of warning and critical values
if [ -z "$wt_value1" -o -z "$wt_value2" -o -z "$wt_value3" ] if [ -z "$wt_value1" -o -z "$wt_value2" -o -z "$wt_value3" ]
then then
echo "Bad expression in the WARNING field : $wt" echo "Bad expression in the WARNING field : $wt"
help_usage help_usage
exit 3 exit 3
fi fi
if [ "`echo $wt_value1|tr -d \"[:digit:]\"`" != "" -o "`echo $wt_value2|tr -d \"[:digit:]\"`" != "" -o "`echo $wt_value3|tr -d \"[:digit:]\"`" != "" ] if [ "`echo $wt_value1|tr -d \"[:digit:]\"`" != "" -o "`echo $wt_value2|tr -d \"[:digit:]\"`" != "" -o "`echo $wt_value3|tr -d \"[:digit:]\"`" != "" ]
then then
echo "Bad expression in the WARNING field : $wt" echo "Bad expression in the WARNING field : $wt"
help_usage help_usage
exit 3 exit 3
fi fi
if [ -z "$ct_value1" -o -z "$ct_value2" -o -z "$ct_value3" ] if [ -z "$ct_value1" -o -z "$ct_value2" -o -z "$ct_value3" ]
then then
echo "Bad expression in the CRITICAL field : $ct" echo "Bad expression in the CRITICAL field : $ct"
help_usage help_usage
exit 3 exit 3
fi fi
if [ "`echo $ct_value1|tr -d \"[:digit:]\"`" != "" -o "`echo $ct_value2|tr -d \"[:digit:]\"`" != "" -o "`echo $ct_value3|tr -d \"[:digit:]\"`" != "" ] if [ "`echo $ct_value1|tr -d \"[:digit:]\"`" != "" -o "`echo $ct_value2|tr -d \"[:digit:]\"`" != "" -o "`echo $ct_value3|tr -d \"[:digit:]\"`" != "" ]
then then
echo "Bad expression in the CRITICAL field : $ct" echo "Bad expression in the CRITICAL field : $ct"
help_usage help_usage
exit 3 exit 3
fi fi
# ps line construction set... # ps line construction set...
case "$process_name" in case "$process_name" in
%all%) %all%)
if [ -z "$exclude_process_name" ] if [ -z "$exclude_process_name" ]
then then
psline=`ps -eo $type_arg,comm|egrep -v "$myself|$type_arg_aff?"|sed "s/^ *\([0-9]\)/\1/"|cut -d" " -f1` psline=`ps -eo $type_arg,comm|egrep -v "$myself|$type_arg_aff?"|sed "s/^ *\([0-9]\)/\1/"|cut -d" " -f1`
else else
psline=`ps -eo $type_arg,comm|egrep -v "$myself|$type_arg_aff|$exclude_process_name?"|sed "s/^ *\([0-9]\)/\1/"|cut -d" " -f1` psline=`ps -eo $type_arg,comm|egrep -v "$myself|$type_arg_aff|$exclude_process_name?"|sed "s/^ *\([0-9]\)/\1/"|cut -d" " -f1`
fi fi
;; ;;
%max%) %max%)
if [ -z "$exclude_process_name" ] if [ -z "$exclude_process_name" ]
then then
pstmp=`ps -eo $type_arg,comm|egrep -v "$myself|$type_arg_aff?"|sort|tail -1|sed "s/^ *\([0-9]\)/\1/"|cut -d" " -f2` pstmp=`ps -eo $type_arg,comm|egrep -v "$myself|$type_arg_aff?"|sort|tail -1|sed "s/^ *\([0-9]\)/\1/"|cut -d" " -f2`
else else
pstmp=`ps -eo $type_arg,comm|egrep -v "$myself|$type_arg_aff|$exclude_process_name?"|sort|tail -1|sed "s/^ *\([0-9]\)/\1/"|cut -d" " -f2` pstmp=`ps -eo $type_arg,comm|egrep -v "$myself|$type_arg_aff|$exclude_process_name?"|sort|tail -1|sed "s/^ *\([0-9]\)/\1/"|cut -d" " -f2`
fi fi
psline=`ps -eo $type_arg,comm|grep $pstmp|sed "s/^ *\([0-9]\)/\1/"|cut -d" " -f1` psline=`ps -eo $type_arg,comm|grep $pstmp|sed "s/^ *\([0-9]\)/\1/"|cut -d" " -f1`
process_name=$pstmp process_name=$pstmp
;; ;;
*) *)
psline=`ps -eo $type_arg,comm|egrep "$process_name?"|sed "s/^ *\([0-9]\)/\1/"|cut -d" " -f1` psline=`ps -eo $type_arg,comm|egrep "$process_name?"|sed "s/^ *\([0-9]\)/\1/"|cut -d" " -f1`
;; ;;
esac esac
total1=0 total1=0
total2=0 total2=0
total3=0 total3=0
# fetching the values # fetching the values
for i in $psline for i in $psline
do do
# Special case for solaris - several format exist for the time function... # Special case for solaris - several format exist for the time function...
if [ ${#i} -le 6 -a "$tt" -eq 3 ] if [ ${#i} -le 6 -a "$tt" -eq 3 ]
then then
i="00:$i" i="00:$i"
fi fi
value1=`echo $i|cut -d$delim -f1` value1=`echo $i|cut -d$delim -f1`
value2=`echo $i|cut -d$delim -f2` value2=`echo $i|cut -d$delim -f2`
value3=`echo $i|cut -d$delim -f3` value3=`echo $i|cut -d$delim -f3`
value3=`test -z "$value3" && echo 0 || echo $value3` value3=`test -z "$value3" && echo 0 || echo $value3`
total1=`expr $total1 + $value1` total1=`expr $total1 + $value1`
total2=`expr $total2 + $value2` total2=`expr $total2 + $value2`
total3=`expr $total3 + $value3` total3=`expr $total3 + $value3`
if [ $tt -eq 3 ] if [ $tt -eq 3 ]
then then
if [ $total3 -ge 60 ] if [ $total3 -ge 60 ]
then then
let total2+=1 let total2+=1
let total3-=60 let total3-=60
fi fi
if [ $total2 -ge 60 ] if [ $total2 -ge 60 ]
then then
let total1+=1 let total1+=1
let total2-=60 let total2-=60
fi fi
else else
if [ $total2 -ge 10 ] if [ $total2 -ge 10 ]
then then
let total1+=1 let total1+=1
let total2=total2-10 let total2=total2-10
fi fi
fi fi
done done
warn=0 warn=0
crit=0 crit=0
# evaluation of the cumulative values vs warning and critical values # evaluation of the cumulative values vs warning and critical values
case "$tt" in case "$tt" in
1) 1)
return_total="$total1.$total2" return_total="$total1.$total2"
test $total1 -gt $ct_value1 && crit=1 test $total1 -gt $ct_value1 && crit=1
test $total1 -eq $ct_value1 -a $total2 -ge $ct_value2 && crit=1 test $total1 -eq $ct_value1 -a $total2 -ge $ct_value2 && crit=1
test $total1 -gt $wt_value1 && warn=1 test $total1 -gt $wt_value1 && warn=1
test $total1 -eq $wt_value1 -a $total2 -ge $wt_value2 && warn=1 test $total1 -eq $wt_value1 -a $total2 -ge $wt_value2 && warn=1
;; ;;
2) 2)
return_total="$total1.$total2" return_total="$total1.$total2"
test $total1 -gt $ct_value1 && crit=1 test $total1 -gt $ct_value1 && crit=1
test $total1 -eq $ct_value1 -a $total2 -ge $ct_value2 && crit=1 test $total1 -eq $ct_value1 -a $total2 -ge $ct_value2 && crit=1
test $total1 -gt $wt_value1 && warn=1 test $total1 -gt $wt_value1 && warn=1
test $total1 -eq $wt_value1 -a $total2 -ge $wt_value2 && warn=1 test $total1 -eq $wt_value1 -a $total2 -ge $wt_value2 && warn=1
;; ;;
3) 3)
return_total="`test ${#total1} -eq 1 && echo 0`$total1:`test ${#total2} -eq 1 && echo 0`$total2:`test ${#total3} -eq 1 && echo 0`$total3" return_total="`test ${#total1} -eq 1 && echo 0`$total1:`test ${#total2} -eq 1 && echo 0`$total2:`test ${#total3} -eq 1 && echo 0`$total3"
test $total1 -gt $ct_value1 && crit=1 test $total1 -gt $ct_value1 && crit=1
test $total1 -eq $ct_value1 -a $total2 -gt $ct_value2 && crit=1 test $total1 -eq $ct_value1 -a $total2 -gt $ct_value2 && crit=1
test $total1 -eq $ct_value1 -a $total2 -eq $ct_value2 -a $total3 -ge $ct_value3 && crit=1 test $total1 -eq $ct_value1 -a $total2 -eq $ct_value2 -a $total3 -ge $ct_value3 && crit=1
test $total1 -gt $wt_value1 && warn=1 test $total1 -gt $wt_value1 && warn=1
test $total1 -eq $wt_value1 -a $total2 -gt $wt_value2 && warn=1 test $total1 -eq $wt_value1 -a $total2 -gt $wt_value2 && warn=1
test $total1 -eq $wt_value1 -a $total2 -eq $wt_value2 -a $total3 -ge $wt_value3 && warn=1 test $total1 -eq $wt_value1 -a $total2 -eq $wt_value2 -a $total3 -ge $wt_value3 && warn=1
;; ;;
esac esac
# last check ... # last check ...
if [ $crit -eq 1 -a $warn -eq 0 ] if [ $crit -eq 1 -a $warn -eq 0 ]
then then
echo "Critical value must be greater than warning value !" echo "Critical value must be greater than warning value !"
help_usage help_usage
exit 3 exit 3
fi fi
# Finally Inform Nagios of what we found... # Finally Inform Nagios of what we found...
if [ $crit -eq 1 ] if [ $crit -eq 1 ]
then then
echo "CRITICAL - total $type_arg_aff for process `echo $process_name|tr \"|\" \",\"` : $return_total" echo "CRITICAL - total $type_arg_aff for process `echo $process_name|tr \"|\" \",\"` : $return_total"
exit 2 exit 2
elif [ $warn -eq 1 ] elif [ $warn -eq 1 ]
then then
echo "WARNING - total $type_arg_aff for process `echo $process_name|tr \"|\" \",\"` : $return_total" echo "WARNING - total $type_arg_aff for process `echo $process_name|tr \"|\" \",\"` : $return_total"
exit 1 exit 1
else else
echo "OK - total $type_arg_aff for process `echo $process_name|tr \"|\" \",\"` : $return_total" echo "OK - total $type_arg_aff for process `echo $process_name|tr \"|\" \",\"` : $return_total"
exit 0 exit 0
fi fi
# Hey what are we doing here ??? # Hey what are we doing here ???
exit 3 exit 3