Last change
on this file since 1850 was
1850,
checked in by adehnert, 14 years ago
|
Consistently use $ECHO
|
-
Property svn:executable set to
*
|
File size:
1.2 KB
|
Rev | Line | |
---|
[1849] | 1 | #!/bin/sh |
---|
| 2 | . /usr/lib64/nagios/plugins/utils.sh |
---|
| 3 | |
---|
| 4 | taintval=$(cat /proc/sys/kernel/tainted) |
---|
| 5 | |
---|
| 6 | if [ "$taintval" = 0 ]; then |
---|
| 7 | $ECHO "Not tainted" |
---|
| 8 | exit $STATE_OK |
---|
| 9 | fi |
---|
| 10 | |
---|
| 11 | # This is a bash reimplementation of kernel/panic.c:print_tainted |
---|
| 12 | # Letters are as follows: |
---|
| 13 | # 181 * print_tainted - return a string to represent the kernel taint state. |
---|
| 14 | # 182 * |
---|
| 15 | # 183 * 'P' - Proprietary module has been loaded. |
---|
| 16 | # 184 * 'F' - Module has been forcibly loaded. |
---|
| 17 | # 185 * 'S' - SMP with CPUs not designed for SMP. |
---|
| 18 | # 186 * 'R' - User forced a module unload. |
---|
| 19 | # 187 * 'M' - System experienced a machine check exception. |
---|
| 20 | # 188 * 'B' - System has hit bad_page. |
---|
| 21 | # 189 * 'U' - Userspace-defined naughtiness. |
---|
| 22 | # 190 * 'D' - Kernel has oopsed before |
---|
| 23 | # 191 * 'A' - ACPI table overridden. |
---|
| 24 | # 192 * 'W' - Taint on warning. |
---|
| 25 | # 193 * 'C' - modules from drivers/staging are loaded. |
---|
| 26 | # 194 * 'I' - Working around severe firmware bug. |
---|
| 27 | # 195 * |
---|
| 28 | |
---|
| 29 | flag=1 |
---|
| 30 | taints="" |
---|
| 31 | for i in P F S R M B U D A W C I; do |
---|
| 32 | if [ $(($taintval & $flag)) -ne 0 ]; then |
---|
| 33 | taints="$taints$i" |
---|
| 34 | else |
---|
| 35 | taints="$taints " |
---|
| 36 | fi |
---|
| 37 | flag=$(($flag * 2)) |
---|
| 38 | done |
---|
| 39 | |
---|
[1850] | 40 | $ECHO "Tainted: $taints" |
---|
[1849] | 41 | |
---|
| 42 | case "$taints" in |
---|
| 43 | *M*|*B*|*D*) exit $STATE_CRITICAL;; |
---|
| 44 | *U*|*W*) exit $STATE_WARNING;; |
---|
| 45 | *) exit $STATE_OK;; |
---|
| 46 | esac |
---|
| 47 | |
---|
Note: See
TracBrowser
for help on using the repository browser.