@@ -33,7 +33,6 @@ usage() {
33
33
- Unbound Persistent Volumes in unboundpvs mode; default is 5
34
34
- Job failed count in jobs mode; default is 2
35
35
- Pvc storage utilization; default is 90%
36
- -b Brief mode (more suitable for Zabbix)
37
36
-M EXIT_CODE Exit code when resource is missing; default is 2 (CRITICAL)
38
37
-h Show this help and exit
39
38
@@ -54,20 +53,15 @@ usage() {
54
53
exit 2
55
54
}
56
55
57
- BRIEF=0
58
56
TIMEOUT=15
59
57
unset NAME
60
58
61
59
die () {
62
- if [ " $BRIEF " = 1 ]; then
63
- echo " -1"
64
- else
65
60
echo " $1 "
66
- fi
67
61
exit " ${2:- 2} "
68
62
}
69
63
70
- while getopts " :m:M:H:T:t:K:N:n:o:c:w:bh " arg; do
64
+ while getopts " :m:M:H:T:t:K:N:n:o:c:w:h " arg; do
71
65
case $arg in
72
66
h) usage ;;
73
67
m) MODE=" $OPTARG " ;;
@@ -81,7 +75,6 @@ while getopts ":m:M:H:T:t:K:N:n:o:c:w:bh" arg; do
81
75
n) NAME=" $OPTARG " ;;
82
76
w) WARN=" $OPTARG " ;;
83
77
c) CRIT=" $OPTARG " ;;
84
- b) BRIEF=1 ;;
85
78
* ) usage ;;
86
79
esac
87
80
done
@@ -190,10 +183,7 @@ mode_nodes() {
190
183
EXITCODE=" $MISSING_EXITCODE "
191
184
else
192
185
OUTPUT=" OK. ${# nodes[@]} nodes are Ready"
193
- BRIEF_OUTPUT=" ${# nodes[@]} "
194
186
fi
195
- else
196
- BRIEF_OUTPUT=" -1"
197
187
fi
198
188
}
199
189
@@ -214,9 +204,7 @@ mode_unboundpvs() {
214
204
select(.status.phase!=\" Bound\" ) | \
215
205
\" \(.metadata.name):\(.status.phase):\(.spec.claimRef.uid)\" " )
216
206
217
- BRIEF_OUTPUT=" ${# pvsArr[*]} "
218
207
if [ ${# unboundPvsArr[*]} -gt 0 ]; then
219
- BRIEF_OUTPUT=" -${# unboundPvsArr[*]} "
220
208
if [ ${# unboundPvsArr[*]} -ge " $CRIT " ]; then
221
209
OUTPUT=" CRITICAL. Unbound persistentvolumes:\n$OUTPUT "
222
210
EXITCODE=2
@@ -355,7 +343,6 @@ mode_tls() {
355
343
done
356
344
done
357
345
358
- BRIEF_OUTPUT=" $count_ok "
359
346
if [ $EXITCODE = 0 ]; then
360
347
if [ -z " $ns " ]; then
361
348
OUTPUT=" No TLS certs found"
@@ -436,12 +423,6 @@ mode_pods() {
436
423
done
437
424
done
438
425
439
- if [ " $max_restart_count " -ge " $WARN " ]; then
440
- BRIEF_OUTPUT=" -$max_restart_count "
441
- else
442
- BRIEF_OUTPUT=" $count_ready "
443
- fi
444
-
445
426
if [ -z " $ns " ]; then
446
427
OUTPUT=" No pods found"
447
428
EXITCODE=" $MISSING_EXITCODE "
@@ -493,7 +474,6 @@ mode_deployments() {
493
474
done
494
475
done
495
476
496
- BRIEF_OUTPUT=" $count_avail "
497
477
if [ $EXITCODE = 0 ]; then
498
478
if [ -z " $ns " ]; then
499
479
OUTPUT=" No deployments found"
@@ -554,7 +534,6 @@ mode_daemonsets() {
554
534
done
555
535
done
556
536
557
- BRIEF_OUTPUT=" $count_avail "
558
537
if [ $EXITCODE = 0 ]; then
559
538
if [ -z " $ns " ]; then
560
539
OUTPUT=" No daemonsets found"
@@ -616,7 +595,6 @@ mode_replicasets() {
616
595
done
617
596
done
618
597
619
- BRIEF_OUTPUT=" $count_avail "
620
598
if [ $EXITCODE = 0 ]; then
621
599
if [ -z " $ns " ]; then
622
600
OUTPUT=" No replicasets found"
@@ -679,7 +657,6 @@ mode_statefulsets() {
679
657
done
680
658
done
681
659
682
- BRIEF_OUTPUT=" $count_avail "
683
660
if [ $EXITCODE = 0 ]; then
684
661
if [ -z " $ns " ]; then
685
662
OUTPUT=" No statefulsets found"
@@ -780,16 +757,6 @@ case "$MODE" in
780
757
(* ) usage ;;
781
758
esac
782
759
783
- if [ " $BRIEF " = 1 ]; then
784
- if [ " $EXITCODE " = 0 ]; then
785
- echo " ${BRIEF_OUTPUT:- 1} "
786
- elif [ -z " $BRIEF_FAIL_OUTPUT " ]; then
787
- echo " ${BRIEF_OUTPUT:- 0} "
788
- else
789
- echo " ${BRIEF_FAIL_OUTPUT} "
790
- fi
791
- else
792
- echo " $OUTPUT "
793
- fi
760
+ printf " $OUTPUT "
794
761
795
762
exit $EXITCODE
0 commit comments