y"> $ load [1]=$$ resultat {$ nsc_cpu_1m};
$ load [2]=$$ resultat {$ nsc_cpu_5m};
CPU: $ load [0] $ load [1] $ load [2]: raquo ;;
$ exit_val=$ ERRORS { OK }; (my $ i=0; $ i lt; 3; $ i ++) {($ load [$ i] gt; $ o_critL [$ i ]) { $ load [$ i] gt; $ o_critL [$ i]: CRITICAL raquo ;;
$ exit_val=$ ERRORS { CRITICAL };
} ($ load [$ i] gt; $ o_warnL [$ i]) {
# output warn error only if no critical was found ($ exit_val eq $ ERRORS { OK }) { $ load [$ i] gt; $ o_warnL [$ i]: WARNING raquo ;;
$ exit_val=$ ERRORS { WARNING };
}
}
} OK if ($ exit_val eq $ ERRORS { OK }); (defined ($ o_perf)) { | Cpu_5_sec=$ load [0]%; $ o_warnL [0]; $ o_critL [0] raquo ;; cpu_1_min=$ load [1]%; $ o_warnL [1]; $ o_critL [1] raquo ;; laquo ; cpu_5_min=$ load [2]%; $ o_warnL [2]; $ o_critL [2] n raquo ;;
} else { n raquo ;;
}
$ exit_val;
}
################## CPU for: AS/400, Netsnmp, HP, Bluecoat, linkproof, fortigate ######## ### ($ o_check_type=~/netsc | as400 | bc | nokia | ^ hp $ | lp | fg /) {
# Get load table @ oidlist=$ cpu_oid {$ o_check_type}; ( Checking OID: @ oidlist ); $ resultat=(Net :: SNMP- gt; VERSION lt; 4)?
$ session- gt; get_request (oidlist)
: $ session- gt; get_request (-varbindlist= gt; oidlist); (! defined ($ resultat)) {( ERROR: Description table:% s. n raquo ;, $ session- gt; error);
$ session- gt; close; $ ERRORS { UNKNOWN };
}
$ session- gt; close;
(! defined ($$ resultat {$ cpu_oid {$ o_check_type}})) { No CPU information: UNKNOWN n raquo ;; $ ERRORS { UNKNOWN };
}
$ load=$$ resultat {$ cpu_oid {$ o_check_type}}; ( OID returned $ load );
# for AS400, divide by 100 ($ o_check_type eq as400 ) {$ load /=100; };
# for Net-snmp: oid returned idle time so load=100-idle. ($ o_check_type eq netsc ) {$ load=100 - $ load; };
( CPU used% .1f %% (, $ load);
$ exit_val=$ ERRORS { OK }; ($ load gt; $ o_crit) { gt; $ o_crit): CRITICAL raquo ;;
$ exit_val=$ ERRORS { CRITICAL };
} else {($ load gt; $ o_warn) { gt; $ o_warn): WARNING raquo ;;
$ exit_val=$ ERRORS { WARNING };
}
} lt; $ o_warn): OK if ($ exit_val eq $ ERRORS { OK });
(defined ($ o_perf))? | Cpu_prct_used=$ load%; $ o_warn; $ o_crit n
: print n raquo ;; $ exit_val;
}
##### Checking hpux load ($ o_check_type eq hpux ) {
( Checking hpux load );
@ oidlists=($ hpux_load_1_min, $ hpux_load_5_min, $ hpux_load_15_min); $ resultat=(Net :: SNMP- gt; VERSION lt; 4)?
$ session- gt; get_request (oidlists)
: $ session- gt; get_request (-varbindlist= gt; oidlists);
(! defined ($ resultat)) {( ERROR: Load table:% s. n raquo ;, $ session- gt; error);
$ session- gt; close; $ ERRORS { UNKNOWN };
}
$ session- gt; close;
(! defined ($$ resultat {$ hpux_load_1_min})) { No Load information: UNKNOWN n raquo ;; $ ERRORS { UNKNOWN };
}
@ load=undef;
$ load [0]=$$ resultat {$ hpux_load_1_min}/100;
$ load [1]=$$ resultat {$ hpux_load_5_min}/100;
$ load [2]=$$ resultat {$ hpux_load_15_min}/100;
Load: $ load [0] $ load [1] $ load [2]: raquo ;;
$ exit_val=$ ERRORS { OK }; (my $ i=0; $ i lt; 3; $ i ++) {($ load [$ i] gt; $ o_critL [$ i ]) { $ load [$ i] gt; $ o_critL [$ i]: CRITICAL raquo ;;
$ exit_val=$ ERRORS { CRITICAL };
} ($ load [$ i] gt; $ o_warnL [$ i]) {
# output warn error only if no critical was found ($ exit_val eq $ ERRORS { OK }) { $ load [$ i] gt; $ o_warnL [$ i]: WARNING raquo ;;
$ exit_val=$ ERRORS { WARNING };
}
}
...