File tree 1 file changed +14
-1
lines changed
1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -94,6 +94,13 @@ check_arguments() {
94
94
fi
95
95
}
96
96
97
+ # Joins arrays by given delimiter
98
+ join_by () {
99
+ local IFS=" ${1} "
100
+ shift
101
+ echo " ${* } "
102
+ }
103
+
97
104
# Main function
98
105
main () {
99
106
# Dump data of consumer group to a file
@@ -127,6 +134,7 @@ main() {
127
134
128
135
# Check thresholds
129
136
state=${STATE_OK}
137
+ perfdata=()
130
138
for item in ${lags[@]}
131
139
do
132
140
topic=$( echo ${item} | awk -F# ' {print $1}' )
@@ -147,9 +155,14 @@ main() {
147
155
echo -n " ${topic} topic's lag (${partition} ): ${lag} "
148
156
state=${STATE_CRITICAL}
149
157
fi
158
+ perfdata+=(" part_${partition} =${lag} ;${warn} ;${crit} " )
150
159
done
151
160
152
- [ ${state} -eq ${STATE_OK} ] && echo ' Lag within normal limits'
161
+ [ ${state} -eq ${STATE_OK} ] && echo -n ' Lag within normal limits '
162
+
163
+ # Attach perfdata
164
+ echo " | $( join_by ' ' ${perfdata[@]} ) "
165
+
153
166
exit ${state}
154
167
}
155
168
You can’t perform that action at this time.
0 commit comments