remove it from this one too
This commit is contained in:
parent
b432090b31
commit
624dc415b3
125
config.guess
vendored
125
config.guess
vendored
|
@ -1,9 +1,9 @@
|
|||
#! /bin/sh
|
||||
# Attempt to guess a canonical system name.
|
||||
# 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
|
||||
# under the terms of the GNU General Public License as published by
|
||||
|
@ -53,7 +53,7 @@ version="\
|
|||
GNU config.guess ($timestamp)
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
echo "${machine}-${os}${release}"
|
||||
exit 0 ;;
|
||||
amd64:OpenBSD:*:*)
|
||||
echo x86_64-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
amiga:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
cats:OpenBSD:*:*)
|
||||
echo arm-unknown-openbsd${UNAME_RELEASE}
|
||||
arc:OpenBSD:*:*)
|
||||
echo mipsel-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
hp300:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
luna88k:OpenBSD:*:*)
|
||||
echo m88k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mac68k:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
|
@ -227,33 +221,28 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||
mvmeppc:OpenBSD:*:*)
|
||||
echo powerpc-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
pegasos:OpenBSD:*:*)
|
||||
echo powerpc-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
pmax:OpenBSD:*:*)
|
||||
echo mipsel-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
sgi:OpenBSD:*:*)
|
||||
echo mips64-unknown-openbsd${UNAME_RELEASE}
|
||||
echo mipseb-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
sun3:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
wgrisc:OpenBSD:*:*)
|
||||
echo mipsel-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
*:OpenBSD:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
|
||||
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:*:*)
|
||||
case $UNAME_RELEASE in
|
||||
*4.0)
|
||||
if test $UNAME_RELEASE = "V4.0"; then
|
||||
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
|
||||
;;
|
||||
*5.*)
|
||||
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
# According to Compaq, /usr/sbin/psrinfo has been available on
|
||||
# OSF/1 and Tru64 systems produced since 1995. I hope that
|
||||
# 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)")
|
||||
UNAME_MACHINE="alphaev79" ;;
|
||||
esac
|
||||
# A Pn.n version is a patched version.
|
||||
# A Vn.n version is a released version.
|
||||
# A Tn.n version is a released field test version.
|
||||
# A Xn.n version is an unreleased experimental baselevel.
|
||||
# 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 ;;
|
||||
Alpha\ *:Windows_NT*:*)
|
||||
# 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:*:*)
|
||||
echo i370-ibm-openedition
|
||||
exit 0 ;;
|
||||
*:z/VM:*:*)
|
||||
echo s390-ibm-zvmoe
|
||||
exit 0 ;;
|
||||
*:OS400:*:*)
|
||||
echo powerpc-ibm-os400
|
||||
exit 0 ;;
|
||||
|
@ -345,7 +333,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||
DRS?6000:unix:4.0:6*)
|
||||
echo sparc-icl-nx6
|
||||
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
|
||||
sparc) echo sparc-icl-nx7 && exit 0 ;;
|
||||
esac ;;
|
||||
|
@ -417,9 +405,6 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
|
||||
echo m68k-unknown-mint${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
m68k:machten:*:*)
|
||||
echo m68k-apple-machten${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
powerpc:machten:*:*)
|
||||
echo powerpc-apple-machten${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
|
@ -755,7 +740,7 @@ EOF
|
|||
echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
|
||||
exit 0 ;;
|
||||
*:UNICOS/mp:*:*)
|
||||
echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
|
||||
echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
|
||||
exit 0 ;;
|
||||
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
|
||||
FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
|
||||
|
@ -778,7 +763,21 @@ EOF
|
|||
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
*: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 ;;
|
||||
i*:CYGWIN*:*)
|
||||
echo ${UNAME_MACHINE}-pc-cygwin
|
||||
|
@ -804,9 +803,6 @@ EOF
|
|||
i*:UWIN*:*)
|
||||
echo ${UNAME_MACHINE}-pc-uwin
|
||||
exit 0 ;;
|
||||
amd64:CYGWIN*:*:*)
|
||||
echo x86_64-unknown-cygwin
|
||||
exit 0 ;;
|
||||
p*:CYGWIN*:*)
|
||||
echo powerpcle-unknown-cygwin
|
||||
exit 0 ;;
|
||||
|
@ -830,18 +826,9 @@ EOF
|
|||
cris:Linux:*:*)
|
||||
echo cris-axis-linux-gnu
|
||||
exit 0 ;;
|
||||
crisv32:Linux:*:*)
|
||||
echo crisv32-axis-linux-gnu
|
||||
exit 0 ;;
|
||||
frv:Linux:*:*)
|
||||
echo frv-unknown-linux-gnu
|
||||
exit 0 ;;
|
||||
ia64:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit 0 ;;
|
||||
m32r*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit 0 ;;
|
||||
m68*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit 0 ;;
|
||||
|
@ -1082,9 +1069,9 @@ EOF
|
|||
M680?0:D-NIX:5.3:*)
|
||||
echo m68k-diab-dnix
|
||||
exit 0 ;;
|
||||
M68*:*:R3V[5678]*:*)
|
||||
M68*:*:R3V[567]*:*)
|
||||
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=''
|
||||
test -r /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.
|
||||
echo i860-stratus-sysv4
|
||||
exit 0 ;;
|
||||
i*86:VOS:*:*)
|
||||
# From Paul.Green@stratus.com.
|
||||
echo ${UNAME_MACHINE}-stratus-vos
|
||||
exit 0 ;;
|
||||
*:VOS:*:*)
|
||||
# From Paul.Green@stratus.com.
|
||||
echo hppa1.1-stratus-vos
|
||||
|
@ -1186,10 +1169,9 @@ EOF
|
|||
echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
*:Darwin:*:*)
|
||||
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
|
||||
case $UNAME_PROCESSOR in
|
||||
case `uname -p` in
|
||||
*86) UNAME_PROCESSOR=i686 ;;
|
||||
unknown) UNAME_PROCESSOR=powerpc ;;
|
||||
powerpc) UNAME_PROCESSOR=powerpc ;;
|
||||
esac
|
||||
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
|
@ -1204,10 +1186,7 @@ EOF
|
|||
*:QNX:*:4*)
|
||||
echo i386-pc-qnx
|
||||
exit 0 ;;
|
||||
NSE-?:NONSTOP_KERNEL:*:*)
|
||||
echo nse-tandem-nsk${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
NSR-?:NONSTOP_KERNEL:*:*)
|
||||
NSR-[DGKLNPTVWY]:NONSTOP_KERNEL:*:*)
|
||||
echo nsr-tandem-nsk${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
*:NonStop-UX:*:*)
|
||||
|
@ -1251,18 +1230,8 @@ EOF
|
|||
SEI:*:*:SEIUX)
|
||||
echo mips-sei-seiux${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
*:DragonFly:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
|
||||
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
|
||||
*:DRAGONFLY:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-dragonfly${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
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
|
||||
download the most up to date version of the config scripts from
|
||||
|
||||
http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
|
||||
and
|
||||
http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
|
||||
ftp://ftp.gnu.org/pub/gnu/config/
|
||||
|
||||
If the version you run ($0) is already up to date, please
|
||||
send the following data and any information you think might be
|
||||
|
|
89
config.sub
vendored
89
config.sub
vendored
|
@ -1,9 +1,9 @@
|
|||
#! /bin/sh
|
||||
# Configuration validation subroutine script.
|
||||
# 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.
|
||||
# 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="\
|
||||
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.
|
||||
|
||||
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* |\
|
||||
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
|
||||
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
|
||||
-apple | -axis | -knuth | -cray)
|
||||
-apple | -axis)
|
||||
os=
|
||||
basic_machine=$1
|
||||
;;
|
||||
|
@ -231,14 +231,13 @@ case $basic_machine in
|
|||
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
|
||||
| am33_2.0 \
|
||||
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
|
||||
| bfin \
|
||||
| c4x | clipper \
|
||||
| d10v | d30v | dlx | dsp16xx \
|
||||
| fr30 | frv \
|
||||
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
|
||||
| i370 | i860 | i960 | ia64 \
|
||||
| ip2k | iq2000 \
|
||||
| m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \
|
||||
| m32r | m68000 | m68k | m88k | mcore \
|
||||
| mips | mipsbe | mipseb | mipsel | mipsle \
|
||||
| mips16 \
|
||||
| mips64 | mips64el \
|
||||
|
@ -263,13 +262,12 @@ case $basic_machine in
|
|||
| pyramid \
|
||||
| sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
|
||||
| sh64 | sh64le \
|
||||
| sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \
|
||||
| sparcv8 | sparcv9 | sparcv9b \
|
||||
| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
|
||||
| strongarm \
|
||||
| tahoe | thumb | tic4x | tic80 | tron \
|
||||
| v850 | v850e \
|
||||
| we32k \
|
||||
| x86 | xscale | xscalee[bl] | xstormy16 | xtensa \
|
||||
| x86 | xscale | xstormy16 | xtensa \
|
||||
| z8k)
|
||||
basic_machine=$basic_machine-unknown
|
||||
;;
|
||||
|
@ -300,9 +298,9 @@ case $basic_machine in
|
|||
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
|
||||
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
|
||||
| avr-* \
|
||||
| bfin-* | bs2000-* \
|
||||
| bs2000-* \
|
||||
| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
|
||||
| clipper-* | craynv-* | cydra-* \
|
||||
| clipper-* | cydra-* \
|
||||
| d10v-* | d30v-* | dlx-* \
|
||||
| elxsi-* \
|
||||
| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
|
||||
|
@ -310,9 +308,9 @@ case $basic_machine in
|
|||
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
|
||||
| i*86-* | i860-* | i960-* | ia64-* \
|
||||
| ip2k-* | iq2000-* \
|
||||
| m32r-* | m32rle-* \
|
||||
| m32r-* \
|
||||
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
|
||||
| m88110-* | m88k-* | maxq-* | mcore-* \
|
||||
| m88110-* | m88k-* | mcore-* \
|
||||
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
|
||||
| mips16-* \
|
||||
| mips64-* | mips64el-* \
|
||||
|
@ -328,9 +326,8 @@ case $basic_machine in
|
|||
| mipsisa64sb1-* | mipsisa64sb1el-* \
|
||||
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
|
||||
| mipstx39-* | mipstx39el-* \
|
||||
| mmix-* \
|
||||
| msp430-* \
|
||||
| none-* | np1-* | ns16k-* | ns32k-* \
|
||||
| none-* | np1-* | nv1-* | ns16k-* | ns32k-* \
|
||||
| orion-* \
|
||||
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
|
||||
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
|
||||
|
@ -338,16 +335,15 @@ case $basic_machine in
|
|||
| romp-* | rs6000-* \
|
||||
| sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \
|
||||
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
|
||||
| sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \
|
||||
| sparclite-* \
|
||||
| sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
|
||||
| sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
|
||||
| sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
|
||||
| tahoe-* | thumb-* \
|
||||
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
|
||||
| tron-* \
|
||||
| v850-* | v850e-* | vax-* \
|
||||
| we32k-* \
|
||||
| x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \
|
||||
| xstormy16-* | xtensa-* \
|
||||
| x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
|
||||
| xtensa-* \
|
||||
| ymp-* \
|
||||
| z8k-*)
|
||||
;;
|
||||
|
@ -367,9 +363,6 @@ case $basic_machine in
|
|||
basic_machine=a29k-amd
|
||||
os=-udi
|
||||
;;
|
||||
abacus)
|
||||
basic_machine=abacus-unknown
|
||||
;;
|
||||
adobe68k)
|
||||
basic_machine=m68010-adobe
|
||||
os=-scout
|
||||
|
@ -387,9 +380,6 @@ case $basic_machine in
|
|||
amd64)
|
||||
basic_machine=x86_64-pc
|
||||
;;
|
||||
amd64-*)
|
||||
basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
amdahl)
|
||||
basic_machine=580-amdahl
|
||||
os=-sysv
|
||||
|
@ -449,27 +439,12 @@ case $basic_machine in
|
|||
basic_machine=j90-cray
|
||||
os=-unicos
|
||||
;;
|
||||
craynv)
|
||||
basic_machine=craynv-cray
|
||||
os=-unicosmp
|
||||
;;
|
||||
cr16c)
|
||||
basic_machine=cr16c-unknown
|
||||
os=-elf
|
||||
;;
|
||||
crds | unos)
|
||||
basic_machine=m68k-crds
|
||||
;;
|
||||
crisv32 | crisv32-* | etraxfs*)
|
||||
basic_machine=crisv32-axis
|
||||
;;
|
||||
cris | cris-* | etrax*)
|
||||
basic_machine=cris-axis
|
||||
;;
|
||||
crx)
|
||||
basic_machine=crx-unknown
|
||||
os=-elf
|
||||
;;
|
||||
da30 | da30-*)
|
||||
basic_machine=m68k-da30
|
||||
;;
|
||||
|
@ -492,10 +467,6 @@ case $basic_machine in
|
|||
basic_machine=m88k-motorola
|
||||
os=-sysv3
|
||||
;;
|
||||
djgpp)
|
||||
basic_machine=i586-pc
|
||||
os=-msdosdjgpp
|
||||
;;
|
||||
dpx20 | dpx20-*)
|
||||
basic_machine=rs6000-bull
|
||||
os=-bosx
|
||||
|
@ -674,6 +645,10 @@ case $basic_machine in
|
|||
mips3*)
|
||||
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
|
||||
;;
|
||||
mmix*)
|
||||
basic_machine=mmix-knuth
|
||||
os=-mmixware
|
||||
;;
|
||||
monitor)
|
||||
basic_machine=m68k-rom68k
|
||||
os=-coff
|
||||
|
@ -754,6 +729,10 @@ case $basic_machine in
|
|||
np1)
|
||||
basic_machine=np1-gould
|
||||
;;
|
||||
nv1)
|
||||
basic_machine=nv1-cray
|
||||
os=-unicosmp
|
||||
;;
|
||||
nsr-tandem)
|
||||
basic_machine=nsr-tandem
|
||||
;;
|
||||
|
@ -1036,10 +1015,6 @@ case $basic_machine in
|
|||
basic_machine=hppa1.1-winbond
|
||||
os=-proelf
|
||||
;;
|
||||
xbox)
|
||||
basic_machine=i686-pc
|
||||
os=-mingw32
|
||||
;;
|
||||
xps | xps100)
|
||||
basic_machine=xps100-honeywell
|
||||
;;
|
||||
|
@ -1070,9 +1045,6 @@ case $basic_machine in
|
|||
romp)
|
||||
basic_machine=romp-ibm
|
||||
;;
|
||||
mmix)
|
||||
basic_machine=mmix-knuth
|
||||
;;
|
||||
rs6000)
|
||||
basic_machine=rs6000-ibm
|
||||
;;
|
||||
|
@ -1095,7 +1067,7 @@ case $basic_machine in
|
|||
sh64)
|
||||
basic_machine=sh64-unknown
|
||||
;;
|
||||
sparc | sparcv8 | sparcv9 | sparcv9b)
|
||||
sparc | sparcv9 | sparcv9b)
|
||||
basic_machine=sparc-sun
|
||||
;;
|
||||
cydra)
|
||||
|
@ -1168,9 +1140,8 @@ case $os in
|
|||
| -aos* \
|
||||
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
|
||||
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
|
||||
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \
|
||||
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
|
||||
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
|
||||
| -hiux* | -386bsd* | -knetbsd* | -netbsd* | -openbsd* | -kfreebsd* | -freebsd* | -riscix* \
|
||||
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
|
||||
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
|
||||
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
|
||||
| -chorusos* | -chorusrdb* \
|
||||
|
@ -1308,9 +1279,6 @@ case $os in
|
|||
-kaos*)
|
||||
os=-kaos
|
||||
;;
|
||||
-zvmoe)
|
||||
os=-zvmoe
|
||||
;;
|
||||
-none)
|
||||
;;
|
||||
*)
|
||||
|
@ -1391,9 +1359,6 @@ case $basic_machine in
|
|||
*-ibm)
|
||||
os=-aix
|
||||
;;
|
||||
*-knuth)
|
||||
os=-mmixware
|
||||
;;
|
||||
*-wec)
|
||||
os=-proelf
|
||||
;;
|
||||
|
|
|
@ -1,400 +1,400 @@
|
|||
#!/bin/bash
|
||||
|
||||
#
|
||||
# Check_procl.sh
|
||||
#
|
||||
# Program: Process load check plugin for Nagios
|
||||
# License : GPL
|
||||
# Copyright (c) 2002 Jerome Tytgat (j.tytgat@sioban.net)
|
||||
#
|
||||
# check_procl.sh,v 1.1 2002/07/04 09:35
|
||||
#
|
||||
# Description :
|
||||
#
|
||||
# This plugin is for check the %cpu, %mem or cputime of one or more process
|
||||
#
|
||||
# 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 --mem
|
||||
# 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 %max% -e process1,process2,... -w <a.b | a:b:c> -c <c.d | d:e:f> <--cpu | --mem | --cputime>
|
||||
#
|
||||
# Example :
|
||||
#
|
||||
# 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
|
||||
# > 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 :
|
||||
# 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
|
||||
#
|
||||
# Tested on solaris 7/8, Linux Redhat 7.3 and Linux Suse 7.1
|
||||
#
|
||||
# BUGS : problems with handling time on solaris...
|
||||
|
||||
|
||||
help_usage() {
|
||||
echo "Usage:"
|
||||
echo " $0 -p <process_name1,process_name2,... | %all% | %max%>"
|
||||
echo " [-e <process_name1,process_name2,...>] -w warning -c critical < --cpu | --mem | --cputime>"
|
||||
echo " $0 (-v | --version)"
|
||||
echo " $0 (-h | --help)"
|
||||
}
|
||||
|
||||
help_version() {
|
||||
echo "check_procl.sh (nagios-plugins) 1.1"
|
||||
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 "For more information about these matters, see the file named COPYING."
|
||||
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 " Manu Feig and Jacques Kern who were my beta testers, thanks to them !"
|
||||
}
|
||||
|
||||
verify_dep() {
|
||||
needed="bash cut egrep expr grep let ps sed sort tail test tr wc"
|
||||
for i in `echo $needed`
|
||||
do
|
||||
type $i > /dev/null 2>&1 /dev/null
|
||||
if [ $? -eq 1 ]
|
||||
then
|
||||
echo "I am missing an important component : $i"
|
||||
echo "Cannot continue, sorry, try to find the missing one..."
|
||||
exit 3
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
myself=$0
|
||||
|
||||
verify_dep
|
||||
|
||||
if [ "$1" = "-h" -o "$1" = "--help" ]
|
||||
then
|
||||
help_version
|
||||
echo ""
|
||||
echo "This plugin will check either the cumulutative %cpu, %mem or cputime"
|
||||
echo "of a process."
|
||||
echo ""
|
||||
help_usage
|
||||
echo ""
|
||||
echo "Required Arguments:"
|
||||
echo " -p, --process STRING1,STRING2,..."
|
||||
echo " names of the processes we want to monitor,"
|
||||
echo " you can add as much as process as you want, separated by comma,"
|
||||
echo " hey will be cumulated"
|
||||
echo " -p, --process %all%"
|
||||
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 " -p, --process %max%"
|
||||
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 " but return the cumulative"
|
||||
echo " -w, --warning INTEGER.INTEGER or INTERGER:INTEGER:INTEGER"
|
||||
echo " generate warning state if process count is outside this range"
|
||||
echo " -c, --critical INTEGER.INTEGER or INTERGER:INTEGER:INTEGER"
|
||||
echo " generate critical state if process count is outside this range"
|
||||
echo " --cpu"
|
||||
echo " return the current cpu usage for the given process"
|
||||
echo " --mem"
|
||||
echo " return the current memory usage for the given process"
|
||||
echo " --cputime"
|
||||
echo " return the total cputime usage for the given process"
|
||||
echo ""
|
||||
echo "Optional Argument:"
|
||||
echo " -e, --exclude-process STRING1,STRING2,..."
|
||||
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 " ex : kapm-idled on linux is a process which eat memory / cputime but not really... ;-)"
|
||||
echo ""
|
||||
exit 3
|
||||
fi
|
||||
|
||||
if [ "$1" = "-v" -o "$1" = "--version" ]
|
||||
then
|
||||
help_version
|
||||
exit 3
|
||||
fi
|
||||
|
||||
if [ `echo $@|tr "=" " "|wc -w` -lt 7 ]
|
||||
then
|
||||
echo "Bad arguments number (need at least 7)!"
|
||||
help_usage
|
||||
exit 3
|
||||
fi
|
||||
|
||||
tt=0
|
||||
process_name=""
|
||||
exclude_process_name=""
|
||||
wt=""
|
||||
ct=""
|
||||
|
||||
# Test of the command lines arguments
|
||||
while test $# -gt 0
|
||||
do
|
||||
|
||||
case "$1" in
|
||||
-p|--process)
|
||||
if [ -n "$process_name" ]
|
||||
then
|
||||
echo "Only one --process argument is useful..."
|
||||
help_usage
|
||||
exit 3
|
||||
fi
|
||||
shift
|
||||
process_name="`echo $1|tr \",\" \"|\"`"
|
||||
;;
|
||||
-e|--exclude-process)
|
||||
if [ -n "$exclude_process_name" ]
|
||||
then
|
||||
echo "Only one --exclude-process argument is useful..."
|
||||
help_usage
|
||||
exit 3
|
||||
fi
|
||||
shift
|
||||
exclude_process_name="`echo $1|tr \",\" \"|\"`"
|
||||
;;
|
||||
-w|--warning)
|
||||
if [ -n "$wt" ]
|
||||
then
|
||||
echo "Only one --warning argument needed... Trying to test bad things ? :-)"
|
||||
help_usage
|
||||
exit 3
|
||||
fi
|
||||
shift
|
||||
wt=$1
|
||||
;;
|
||||
-c|--critical)
|
||||
if [ -n "$ct" ]
|
||||
then
|
||||
echo "Only one --critical argument needed... Trying to test bad things ? :-)"
|
||||
help_usage
|
||||
exit 3
|
||||
fi
|
||||
shift
|
||||
ct=$1
|
||||
;;
|
||||
--cpu)
|
||||
if [ $tt -eq 0 ]
|
||||
then
|
||||
tt=1
|
||||
else
|
||||
echo "Only one of the arguments --cpu/--mem/--cputime can be used at a time !"
|
||||
help_usage
|
||||
exit 3
|
||||
fi
|
||||
type_arg_aff="%CPU"
|
||||
type_arg="pcpu"
|
||||
delim="."
|
||||
;;
|
||||
--mem)
|
||||
if [ $tt -eq 0 ]
|
||||
then
|
||||
tt=2
|
||||
else
|
||||
echo "Only one of the arguments --cpu/--mem/--cputime can be used at a time !"
|
||||
help_usage
|
||||
exit 3
|
||||
fi
|
||||
type_arg_aff="%MEM"
|
||||
type_arg="pmem"
|
||||
delim="."
|
||||
;;
|
||||
--cputime)
|
||||
if [ $tt -eq 0 ]
|
||||
then
|
||||
tt=3
|
||||
else
|
||||
echo "Only one of the arguments --cpu/--mem/--cputime can be used at a time !"
|
||||
help_usage
|
||||
exit 3
|
||||
fi
|
||||
type_arg_aff="TIME"
|
||||
type_arg="time"
|
||||
delim=":"
|
||||
;;
|
||||
*)
|
||||
echo "Unknown argument $1"
|
||||
help_usage
|
||||
exit 3
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# Is the process running ?
|
||||
if [ -z "`ps -e | egrep \"$process_name?\"`" -a "$process_name" != "%all%" -a "$process_name" != "%max%" ]
|
||||
then
|
||||
echo "WARNING: process $process_name not running !"
|
||||
exit 3
|
||||
fi
|
||||
|
||||
# Cut of warning and critical values
|
||||
wt_value1=`echo $wt|cut -d"$delim" -f1`
|
||||
wt_value2=`echo $wt|cut -d"$delim" -f2`
|
||||
ct_value1=`echo $ct|cut -d"$delim" -f1`
|
||||
ct_value2=`echo $ct|cut -d"$delim" -f2`
|
||||
|
||||
if [ $tt -eq 3 ]
|
||||
then
|
||||
wt_value3=`echo $wt|cut -d"$delim" -f3`
|
||||
ct_value3=`echo $ct|cut -d"$delim" -f3`
|
||||
else
|
||||
wt_value3=0
|
||||
ct_value3=0
|
||||
fi
|
||||
|
||||
# Integrity check of warning and critical values
|
||||
if [ -z "$wt_value1" -o -z "$wt_value2" -o -z "$wt_value3" ]
|
||||
then
|
||||
echo "Bad expression in the WARNING field : $wt"
|
||||
help_usage
|
||||
exit 3
|
||||
fi
|
||||
|
||||
if [ "`echo $wt_value1|tr -d \"[:digit:]\"`" != "" -o "`echo $wt_value2|tr -d \"[:digit:]\"`" != "" -o "`echo $wt_value3|tr -d \"[:digit:]\"`" != "" ]
|
||||
then
|
||||
echo "Bad expression in the WARNING field : $wt"
|
||||
help_usage
|
||||
exit 3
|
||||
fi
|
||||
|
||||
if [ -z "$ct_value1" -o -z "$ct_value2" -o -z "$ct_value3" ]
|
||||
then
|
||||
echo "Bad expression in the CRITICAL field : $ct"
|
||||
help_usage
|
||||
exit 3
|
||||
fi
|
||||
|
||||
|
||||
if [ "`echo $ct_value1|tr -d \"[:digit:]\"`" != "" -o "`echo $ct_value2|tr -d \"[:digit:]\"`" != "" -o "`echo $ct_value3|tr -d \"[:digit:]\"`" != "" ]
|
||||
then
|
||||
echo "Bad expression in the CRITICAL field : $ct"
|
||||
help_usage
|
||||
exit 3
|
||||
fi
|
||||
|
||||
# ps line construction set...
|
||||
case "$process_name" in
|
||||
%all%)
|
||||
if [ -z "$exclude_process_name" ]
|
||||
then
|
||||
psline=`ps -eo $type_arg,comm|egrep -v "$myself|$type_arg_aff?"|sed "s/^ *\([0-9]\)/\1/"|cut -d" " -f1`
|
||||
else
|
||||
psline=`ps -eo $type_arg,comm|egrep -v "$myself|$type_arg_aff|$exclude_process_name?"|sed "s/^ *\([0-9]\)/\1/"|cut -d" " -f1`
|
||||
fi
|
||||
;;
|
||||
%max%)
|
||||
if [ -z "$exclude_process_name" ]
|
||||
then
|
||||
pstmp=`ps -eo $type_arg,comm|egrep -v "$myself|$type_arg_aff?"|sort|tail -1|sed "s/^ *\([0-9]\)/\1/"|cut -d" " -f2`
|
||||
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`
|
||||
fi
|
||||
psline=`ps -eo $type_arg,comm|grep $pstmp|sed "s/^ *\([0-9]\)/\1/"|cut -d" " -f1`
|
||||
process_name=$pstmp
|
||||
;;
|
||||
*)
|
||||
psline=`ps -eo $type_arg,comm|egrep "$process_name?"|sed "s/^ *\([0-9]\)/\1/"|cut -d" " -f1`
|
||||
;;
|
||||
esac
|
||||
|
||||
total1=0
|
||||
total2=0
|
||||
total3=0
|
||||
|
||||
|
||||
# fetching the values
|
||||
for i in $psline
|
||||
do
|
||||
# Special case for solaris - several format exist for the time function...
|
||||
if [ ${#i} -le 6 -a "$tt" -eq 3 ]
|
||||
then
|
||||
i="00:$i"
|
||||
fi
|
||||
value1=`echo $i|cut -d$delim -f1`
|
||||
value2=`echo $i|cut -d$delim -f2`
|
||||
value3=`echo $i|cut -d$delim -f3`
|
||||
value3=`test -z "$value3" && echo 0 || echo $value3`
|
||||
total1=`expr $total1 + $value1`
|
||||
total2=`expr $total2 + $value2`
|
||||
total3=`expr $total3 + $value3`
|
||||
if [ $tt -eq 3 ]
|
||||
then
|
||||
if [ $total3 -ge 60 ]
|
||||
then
|
||||
let total2+=1
|
||||
let total3-=60
|
||||
fi
|
||||
if [ $total2 -ge 60 ]
|
||||
then
|
||||
let total1+=1
|
||||
let total2-=60
|
||||
fi
|
||||
else
|
||||
if [ $total2 -ge 10 ]
|
||||
then
|
||||
let total1+=1
|
||||
let total2=total2-10
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
warn=0
|
||||
crit=0
|
||||
|
||||
# evaluation of the cumulative values vs warning and critical values
|
||||
case "$tt" in
|
||||
1)
|
||||
return_total="$total1.$total2"
|
||||
test $total1 -gt $ct_value1 && crit=1
|
||||
test $total1 -eq $ct_value1 -a $total2 -ge $ct_value2 && crit=1
|
||||
test $total1 -gt $wt_value1 && warn=1
|
||||
test $total1 -eq $wt_value1 -a $total2 -ge $wt_value2 && warn=1
|
||||
;;
|
||||
2)
|
||||
return_total="$total1.$total2"
|
||||
test $total1 -gt $ct_value1 && crit=1
|
||||
test $total1 -eq $ct_value1 -a $total2 -ge $ct_value2 && crit=1
|
||||
test $total1 -gt $wt_value1 && warn=1
|
||||
test $total1 -eq $wt_value1 -a $total2 -ge $wt_value2 && warn=1
|
||||
;;
|
||||
3)
|
||||
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 -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 -gt $wt_value1 && 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
|
||||
;;
|
||||
esac
|
||||
|
||||
# last check ...
|
||||
if [ $crit -eq 1 -a $warn -eq 0 ]
|
||||
then
|
||||
echo "Critical value must be greater than warning value !"
|
||||
help_usage
|
||||
exit 3
|
||||
fi
|
||||
|
||||
# Finally Inform Nagios of what we found...
|
||||
if [ $crit -eq 1 ]
|
||||
then
|
||||
echo "CRITICAL - total $type_arg_aff for process `echo $process_name|tr \"|\" \",\"` : $return_total"
|
||||
exit 2
|
||||
elif [ $warn -eq 1 ]
|
||||
then
|
||||
echo "WARNING - total $type_arg_aff for process `echo $process_name|tr \"|\" \",\"` : $return_total"
|
||||
exit 1
|
||||
else
|
||||
echo "OK - total $type_arg_aff for process `echo $process_name|tr \"|\" \",\"` : $return_total"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Hey what are we doing here ???
|
||||
#!/bin/bash
|
||||
|
||||
#
|
||||
# Check_procl.sh
|
||||
#
|
||||
# Program: Process load check plugin for Nagios
|
||||
# License : GPL
|
||||
# Copyright (c) 2002 Jerome Tytgat (j.tytgat@sioban.net)
|
||||
#
|
||||
# check_procl.sh,v 1.1 2002/07/04 09:35
|
||||
#
|
||||
# Description :
|
||||
#
|
||||
# This plugin is for check the %cpu, %mem or cputime of one or more process
|
||||
#
|
||||
# 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 --mem
|
||||
# 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 %max% -e process1,process2,... -w <a.b | a:b:c> -c <c.d | d:e:f> <--cpu | --mem | --cputime>
|
||||
#
|
||||
# Example :
|
||||
#
|
||||
# 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
|
||||
# > 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 :
|
||||
# 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
|
||||
#
|
||||
# Tested on solaris 7/8, Linux Redhat 7.3 and Linux Suse 7.1
|
||||
#
|
||||
# BUGS : problems with handling time on solaris...
|
||||
|
||||
|
||||
help_usage() {
|
||||
echo "Usage:"
|
||||
echo " $0 -p <process_name1,process_name2,... | %all% | %max%>"
|
||||
echo " [-e <process_name1,process_name2,...>] -w warning -c critical < --cpu | --mem | --cputime>"
|
||||
echo " $0 (-v | --version)"
|
||||
echo " $0 (-h | --help)"
|
||||
}
|
||||
|
||||
help_version() {
|
||||
echo "check_procl.sh (nagios-plugins) 1.1"
|
||||
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 "For more information about these matters, see the file named COPYING."
|
||||
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 " Manu Feig and Jacques Kern who were my beta testers, thanks to them !"
|
||||
}
|
||||
|
||||
verify_dep() {
|
||||
needed="bash cut egrep expr grep let ps sed sort tail test tr wc"
|
||||
for i in `echo $needed`
|
||||
do
|
||||
type $i > /dev/null 2>&1 /dev/null
|
||||
if [ $? -eq 1 ]
|
||||
then
|
||||
echo "I am missing an important component : $i"
|
||||
echo "Cannot continue, sorry, try to find the missing one..."
|
||||
exit 3
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
myself=$0
|
||||
|
||||
verify_dep
|
||||
|
||||
if [ "$1" = "-h" -o "$1" = "--help" ]
|
||||
then
|
||||
help_version
|
||||
echo ""
|
||||
echo "This plugin will check either the cumulutative %cpu, %mem or cputime"
|
||||
echo "of a process."
|
||||
echo ""
|
||||
help_usage
|
||||
echo ""
|
||||
echo "Required Arguments:"
|
||||
echo " -p, --process STRING1,STRING2,..."
|
||||
echo " names of the processes we want to monitor,"
|
||||
echo " you can add as much as process as you want, separated by comma,"
|
||||
echo " hey will be cumulated"
|
||||
echo " -p, --process %all%"
|
||||
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 " -p, --process %max%"
|
||||
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 " but return the cumulative"
|
||||
echo " -w, --warning INTEGER.INTEGER or INTERGER:INTEGER:INTEGER"
|
||||
echo " generate warning state if process count is outside this range"
|
||||
echo " -c, --critical INTEGER.INTEGER or INTERGER:INTEGER:INTEGER"
|
||||
echo " generate critical state if process count is outside this range"
|
||||
echo " --cpu"
|
||||
echo " return the current cpu usage for the given process"
|
||||
echo " --mem"
|
||||
echo " return the current memory usage for the given process"
|
||||
echo " --cputime"
|
||||
echo " return the total cputime usage for the given process"
|
||||
echo ""
|
||||
echo "Optional Argument:"
|
||||
echo " -e, --exclude-process STRING1,STRING2,..."
|
||||
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 " ex : kapm-idled on linux is a process which eat memory / cputime but not really... ;-)"
|
||||
echo ""
|
||||
exit 3
|
||||
fi
|
||||
|
||||
if [ "$1" = "-v" -o "$1" = "--version" ]
|
||||
then
|
||||
help_version
|
||||
exit 3
|
||||
fi
|
||||
|
||||
if [ `echo $@|tr "=" " "|wc -w` -lt 7 ]
|
||||
then
|
||||
echo "Bad arguments number (need at least 7)!"
|
||||
help_usage
|
||||
exit 3
|
||||
fi
|
||||
|
||||
tt=0
|
||||
process_name=""
|
||||
exclude_process_name=""
|
||||
wt=""
|
||||
ct=""
|
||||
|
||||
# Test of the command lines arguments
|
||||
while test $# -gt 0
|
||||
do
|
||||
|
||||
case "$1" in
|
||||
-p|--process)
|
||||
if [ -n "$process_name" ]
|
||||
then
|
||||
echo "Only one --process argument is useful..."
|
||||
help_usage
|
||||
exit 3
|
||||
fi
|
||||
shift
|
||||
process_name="`echo $1|tr \",\" \"|\"`"
|
||||
;;
|
||||
-e|--exclude-process)
|
||||
if [ -n "$exclude_process_name" ]
|
||||
then
|
||||
echo "Only one --exclude-process argument is useful..."
|
||||
help_usage
|
||||
exit 3
|
||||
fi
|
||||
shift
|
||||
exclude_process_name="`echo $1|tr \",\" \"|\"`"
|
||||
;;
|
||||
-w|--warning)
|
||||
if [ -n "$wt" ]
|
||||
then
|
||||
echo "Only one --warning argument needed... Trying to test bad things ? :-)"
|
||||
help_usage
|
||||
exit 3
|
||||
fi
|
||||
shift
|
||||
wt=$1
|
||||
;;
|
||||
-c|--critical)
|
||||
if [ -n "$ct" ]
|
||||
then
|
||||
echo "Only one --critical argument needed... Trying to test bad things ? :-)"
|
||||
help_usage
|
||||
exit 3
|
||||
fi
|
||||
shift
|
||||
ct=$1
|
||||
;;
|
||||
--cpu)
|
||||
if [ $tt -eq 0 ]
|
||||
then
|
||||
tt=1
|
||||
else
|
||||
echo "Only one of the arguments --cpu/--mem/--cputime can be used at a time !"
|
||||
help_usage
|
||||
exit 3
|
||||
fi
|
||||
type_arg_aff="%CPU"
|
||||
type_arg="pcpu"
|
||||
delim="."
|
||||
;;
|
||||
--mem)
|
||||
if [ $tt -eq 0 ]
|
||||
then
|
||||
tt=2
|
||||
else
|
||||
echo "Only one of the arguments --cpu/--mem/--cputime can be used at a time !"
|
||||
help_usage
|
||||
exit 3
|
||||
fi
|
||||
type_arg_aff="%MEM"
|
||||
type_arg="pmem"
|
||||
delim="."
|
||||
;;
|
||||
--cputime)
|
||||
if [ $tt -eq 0 ]
|
||||
then
|
||||
tt=3
|
||||
else
|
||||
echo "Only one of the arguments --cpu/--mem/--cputime can be used at a time !"
|
||||
help_usage
|
||||
exit 3
|
||||
fi
|
||||
type_arg_aff="TIME"
|
||||
type_arg="time"
|
||||
delim=":"
|
||||
;;
|
||||
*)
|
||||
echo "Unknown argument $1"
|
||||
help_usage
|
||||
exit 3
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# Is the process running ?
|
||||
if [ -z "`ps -e | egrep \"$process_name?\"`" -a "$process_name" != "%all%" -a "$process_name" != "%max%" ]
|
||||
then
|
||||
echo "WARNING: process $process_name not running !"
|
||||
exit 3
|
||||
fi
|
||||
|
||||
# Cut of warning and critical values
|
||||
wt_value1=`echo $wt|cut -d"$delim" -f1`
|
||||
wt_value2=`echo $wt|cut -d"$delim" -f2`
|
||||
ct_value1=`echo $ct|cut -d"$delim" -f1`
|
||||
ct_value2=`echo $ct|cut -d"$delim" -f2`
|
||||
|
||||
if [ $tt -eq 3 ]
|
||||
then
|
||||
wt_value3=`echo $wt|cut -d"$delim" -f3`
|
||||
ct_value3=`echo $ct|cut -d"$delim" -f3`
|
||||
else
|
||||
wt_value3=0
|
||||
ct_value3=0
|
||||
fi
|
||||
|
||||
# Integrity check of warning and critical values
|
||||
if [ -z "$wt_value1" -o -z "$wt_value2" -o -z "$wt_value3" ]
|
||||
then
|
||||
echo "Bad expression in the WARNING field : $wt"
|
||||
help_usage
|
||||
exit 3
|
||||
fi
|
||||
|
||||
if [ "`echo $wt_value1|tr -d \"[:digit:]\"`" != "" -o "`echo $wt_value2|tr -d \"[:digit:]\"`" != "" -o "`echo $wt_value3|tr -d \"[:digit:]\"`" != "" ]
|
||||
then
|
||||
echo "Bad expression in the WARNING field : $wt"
|
||||
help_usage
|
||||
exit 3
|
||||
fi
|
||||
|
||||
if [ -z "$ct_value1" -o -z "$ct_value2" -o -z "$ct_value3" ]
|
||||
then
|
||||
echo "Bad expression in the CRITICAL field : $ct"
|
||||
help_usage
|
||||
exit 3
|
||||
fi
|
||||
|
||||
|
||||
if [ "`echo $ct_value1|tr -d \"[:digit:]\"`" != "" -o "`echo $ct_value2|tr -d \"[:digit:]\"`" != "" -o "`echo $ct_value3|tr -d \"[:digit:]\"`" != "" ]
|
||||
then
|
||||
echo "Bad expression in the CRITICAL field : $ct"
|
||||
help_usage
|
||||
exit 3
|
||||
fi
|
||||
|
||||
# ps line construction set...
|
||||
case "$process_name" in
|
||||
%all%)
|
||||
if [ -z "$exclude_process_name" ]
|
||||
then
|
||||
psline=`ps -eo $type_arg,comm|egrep -v "$myself|$type_arg_aff?"|sed "s/^ *\([0-9]\)/\1/"|cut -d" " -f1`
|
||||
else
|
||||
psline=`ps -eo $type_arg,comm|egrep -v "$myself|$type_arg_aff|$exclude_process_name?"|sed "s/^ *\([0-9]\)/\1/"|cut -d" " -f1`
|
||||
fi
|
||||
;;
|
||||
%max%)
|
||||
if [ -z "$exclude_process_name" ]
|
||||
then
|
||||
pstmp=`ps -eo $type_arg,comm|egrep -v "$myself|$type_arg_aff?"|sort|tail -1|sed "s/^ *\([0-9]\)/\1/"|cut -d" " -f2`
|
||||
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`
|
||||
fi
|
||||
psline=`ps -eo $type_arg,comm|grep $pstmp|sed "s/^ *\([0-9]\)/\1/"|cut -d" " -f1`
|
||||
process_name=$pstmp
|
||||
;;
|
||||
*)
|
||||
psline=`ps -eo $type_arg,comm|egrep "$process_name?"|sed "s/^ *\([0-9]\)/\1/"|cut -d" " -f1`
|
||||
;;
|
||||
esac
|
||||
|
||||
total1=0
|
||||
total2=0
|
||||
total3=0
|
||||
|
||||
|
||||
# fetching the values
|
||||
for i in $psline
|
||||
do
|
||||
# Special case for solaris - several format exist for the time function...
|
||||
if [ ${#i} -le 6 -a "$tt" -eq 3 ]
|
||||
then
|
||||
i="00:$i"
|
||||
fi
|
||||
value1=`echo $i|cut -d$delim -f1`
|
||||
value2=`echo $i|cut -d$delim -f2`
|
||||
value3=`echo $i|cut -d$delim -f3`
|
||||
value3=`test -z "$value3" && echo 0 || echo $value3`
|
||||
total1=`expr $total1 + $value1`
|
||||
total2=`expr $total2 + $value2`
|
||||
total3=`expr $total3 + $value3`
|
||||
if [ $tt -eq 3 ]
|
||||
then
|
||||
if [ $total3 -ge 60 ]
|
||||
then
|
||||
let total2+=1
|
||||
let total3-=60
|
||||
fi
|
||||
if [ $total2 -ge 60 ]
|
||||
then
|
||||
let total1+=1
|
||||
let total2-=60
|
||||
fi
|
||||
else
|
||||
if [ $total2 -ge 10 ]
|
||||
then
|
||||
let total1+=1
|
||||
let total2=total2-10
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
warn=0
|
||||
crit=0
|
||||
|
||||
# evaluation of the cumulative values vs warning and critical values
|
||||
case "$tt" in
|
||||
1)
|
||||
return_total="$total1.$total2"
|
||||
test $total1 -gt $ct_value1 && crit=1
|
||||
test $total1 -eq $ct_value1 -a $total2 -ge $ct_value2 && crit=1
|
||||
test $total1 -gt $wt_value1 && warn=1
|
||||
test $total1 -eq $wt_value1 -a $total2 -ge $wt_value2 && warn=1
|
||||
;;
|
||||
2)
|
||||
return_total="$total1.$total2"
|
||||
test $total1 -gt $ct_value1 && crit=1
|
||||
test $total1 -eq $ct_value1 -a $total2 -ge $ct_value2 && crit=1
|
||||
test $total1 -gt $wt_value1 && warn=1
|
||||
test $total1 -eq $wt_value1 -a $total2 -ge $wt_value2 && warn=1
|
||||
;;
|
||||
3)
|
||||
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 -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 -gt $wt_value1 && 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
|
||||
;;
|
||||
esac
|
||||
|
||||
# last check ...
|
||||
if [ $crit -eq 1 -a $warn -eq 0 ]
|
||||
then
|
||||
echo "Critical value must be greater than warning value !"
|
||||
help_usage
|
||||
exit 3
|
||||
fi
|
||||
|
||||
# Finally Inform Nagios of what we found...
|
||||
if [ $crit -eq 1 ]
|
||||
then
|
||||
echo "CRITICAL - total $type_arg_aff for process `echo $process_name|tr \"|\" \",\"` : $return_total"
|
||||
exit 2
|
||||
elif [ $warn -eq 1 ]
|
||||
then
|
||||
echo "WARNING - total $type_arg_aff for process `echo $process_name|tr \"|\" \",\"` : $return_total"
|
||||
exit 1
|
||||
else
|
||||
echo "OK - total $type_arg_aff for process `echo $process_name|tr \"|\" \",\"` : $return_total"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Hey what are we doing here ???
|
||||
exit 3
|
Loading…
Reference in a new issue