nagios plugin compatibility
This commit is contained in:
parent
84f7d4dc0c
commit
cec57c4f9e
1 changed files with 23 additions and 4 deletions
|
@ -13,21 +13,37 @@ BEGIN {
|
|||
Power_On_Thresh = 720; #30d
|
||||
Power_Cycle_Thresh = 30;
|
||||
Hardware_ECC_Thresh = 1000000; #1M
|
||||
# https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/3/en/pluginapi.html
|
||||
RET_OK = 0;
|
||||
RET_WARN = 1;
|
||||
RET_CRIT = 2;
|
||||
RET_UNKN = 3;
|
||||
RET = RET_OK;
|
||||
}
|
||||
|
||||
END {
|
||||
exit RET;
|
||||
}
|
||||
|
||||
function warn_raw_value(thresh) {
|
||||
if ( $RAW_VALUE > thresh )
|
||||
if ( $RAW_VALUE > thresh ) {
|
||||
print "WARNING : " $ATTRIBUTE_NAME " " $RAW_VALUE ;
|
||||
if ( RET < RET_WARN )
|
||||
RET = RET_WARN;
|
||||
}
|
||||
}
|
||||
function crit_raw_value(thresh) {
|
||||
if ( $RAW_VALUE > thresh )
|
||||
if ( $RAW_VALUE > thresh ) {
|
||||
print "ERROR : " $ATTRIBUTE_NAME " " $RAW_VALUE ;
|
||||
if ( RET < RET_CRIT )
|
||||
RET = RET_CRIT;
|
||||
}
|
||||
}
|
||||
|
||||
/=== START OF READ SMART DATA SECTION ===/ { ACTIVE = 1}
|
||||
/TYPE[[:space:]]+UPDATED[[:space:]]+WHEN/ {
|
||||
print "Wrong format. Please use smartctl -A -f brief";
|
||||
exit 3;
|
||||
exit RET_UNKN;
|
||||
}
|
||||
|
||||
#(Raw Read|Seek) Error Rate
|
||||
|
@ -62,7 +78,10 @@ function crit_raw_value(thresh) {
|
|||
/^230/ { crit_raw_value(0); }
|
||||
|
||||
/^[ ]*[0-9]+ [0-9a-zA-Z_]+ / {
|
||||
if ($WORST < $THRESH)
|
||||
if ($WORST < $THRESH) {
|
||||
print "ERROR : " $ATTRIBUTE_NAME " " $WORST " < " $THRESH " " $FAIL ;
|
||||
if ( RET < RET_CRIT )
|
||||
RET = RET_CRIT;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue