diff options
author | Ethan Galstad <egalstad@users.sourceforge.net> | 2002-02-28 06:42:51 +0000 |
---|---|---|
committer | Ethan Galstad <egalstad@users.sourceforge.net> | 2002-02-28 06:42:51 +0000 |
commit | 44a321cb8a42d6c0ea2d96a1086a17f2134c89cc (patch) | |
tree | a1a4d9f7b92412a17ab08f34f04eec45433048b7 /contrib/check_joy.sh | |
parent | 54fd5d7022ff2d6a59bc52b8869182f3fc77a058 (diff) | |
download | monitoring-plugins-44a321cb8a42d6c0ea2d96a1086a17f2134c89cc.tar.gz |
Initial revision
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@2 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'contrib/check_joy.sh')
-rwxr-xr-x | contrib/check_joy.sh | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/contrib/check_joy.sh b/contrib/check_joy.sh new file mode 100755 index 00000000..cd076db9 --- /dev/null +++ b/contrib/check_joy.sh | |||
@@ -0,0 +1,69 @@ | |||
1 | #! /bin/sh | ||
2 | |||
3 | PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin | ||
4 | |||
5 | PROGNAME=`basename $0` | ||
6 | PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'` | ||
7 | REVISION=`echo '$Revision$' | sed -e 's/[^0-9.]//g'` | ||
8 | STATUS="" | ||
9 | |||
10 | . $PROGPATH/utils.sh | ||
11 | |||
12 | |||
13 | print_usage() { | ||
14 | echo "Usage: $PROGNAME /dev/js<#> <button #>" | ||
15 | } | ||
16 | |||
17 | print_help() { | ||
18 | print_revision $PROGNAME $REVISION | ||
19 | echo "" | ||
20 | print_usage | ||
21 | echo "" | ||
22 | echo "This plugin checks a joystick button status using the " | ||
23 | echo "joyreadbutton utility from the joyd package." | ||
24 | echo "" | ||
25 | support | ||
26 | exit 0 | ||
27 | } | ||
28 | |||
29 | if [ $# -ne 2 ]; then | ||
30 | print_usage | ||
31 | exit 0 | ||
32 | fi | ||
33 | |||
34 | case "$1" in | ||
35 | --help) | ||
36 | print_help | ||
37 | exit 0 | ||
38 | ;; | ||
39 | -h) | ||
40 | print_help | ||
41 | exit 0 | ||
42 | ;; | ||
43 | --version) | ||
44 | print_revision $PROGNAME $REVISION | ||
45 | exit 0 | ||
46 | ;; | ||
47 | -V) | ||
48 | print_revision $PROGNAME $REVISION | ||
49 | exit 0 | ||
50 | ;; | ||
51 | /dev/js*) | ||
52 | joyreadbutton $1 $2 1>&1 1>/dev/null | ||
53 | STATUS=$? | ||
54 | if [ "$STATUS" -eq 0 ]; then | ||
55 | echo OK | ||
56 | exit 0 | ||
57 | elif [ "$STATUS" -eq 1 ];then | ||
58 | echo CRITICAL | ||
59 | exit 2 | ||
60 | else | ||
61 | echo UNKNOWN | ||
62 | exit -1 | ||
63 | fi | ||
64 | ;; | ||
65 | *) | ||
66 | print_usage | ||
67 | exit 0 | ||
68 | ;; | ||
69 | esac | ||