== 1) {
$ c_output.= gt; . $ o_crit;
$ c_status= CRITICAL raquo ;;
} else {($ warn_s == 1) {
$ c_output.= gt; . $ o_warn;
$ c_status= WARNING raquo ;;
}
}
$ c_output.= ; . $ c_status; (defined ($ o_perf)) {
$ c_output.= | Ram_used=. $ used. laquo ;; raquo ;;
$ c_output.=($ o_warn == 0)? laquo ;; :Round ($ o_warn * $ total/100,0). Laquo ;; raquo ;;
$ c_output.=($ o_crit == 0)? laquo ;; :Round ($ o_crit * $ total/100,0). Laquo ;; raquo ;;
$ c_output.= 0; . $ total;
}
$ session- gt; close; $ c_output n raquo ;; $ ERRORS {$ c_status};
}
########### HP Procurve memory check ############ (defined ($ o_hp)) {
# Get hp memory table
$ resultat=(Net :: SNMP- gt; VERSION lt; 4)?
$ session- gt; get_table ($ hp_mem_pool)
: $ session- gt; get_table (Baseoid= gt; $ hp_mem_pool);
(! defined ($ resultat)) {( ERROR: Description table:% s. n raquo ;, $ session- gt; error);
$ session- gt; close; $ ERRORS { UNKNOWN };
} (@ oid, @ index)=(undef, undef); $ nindex=0; my $ key (keys% $ resultat) {( OID: $ key, Desc: $$ resultat {$ key} ); ($ key=~/$ hp_mem_index /) {
@ oid=split (/./,$ key);
$ index [$ nindex ++]=pop (oid);
}
}
# Check if at least 1 memory slots exists ($ nindex == 0) {( ERROR: No memory slots found );
$ session- gt; close; $ ERRORS { UNKNOWN };
}
# Consolidate the datas ($ total, $ free)=(0,0); ($ c_output, $ prct_free)=(undef, undef); (@ index) {
$ c_output.=, if defined ($ c_output);
$ total +=$$ resultat {$ hp_mem_total. . . $ _};
$ free +=$$ resultat {$ hp_mem_free. . . $ _};
$ c_output.= Slot . $$ resultat {$ hp_mem_index. . . $ _}. :
. round (
- ($$ resultat {$ hp_mem_free. . . $ _} * 100/
$$ resultat {$ hp_mem_total. . . $ _}), 0)
. % raquo ;;
} $ used=$ total - $ free;
$ prct_free=round ($ used * 100/($ total), 0); ( Used: $ used, Free: $ free, Output: $ c_output ); $ c_status= laquo ; OK raquo ;;
$ c_output.=: Raquo;. $ prct_free. %: raquo ;; (($ o_crit!=0) amp; amp; ($ o_crit lt;=$ prct_free)) {
$ c_output.= gt; . $ o_crit;
$ c_status= CRITICAL raquo ;;
} else {(($ o_warn!=0) amp; amp; ($ o_warn lt;=$ prct_free)) {
$ c_output.= gt; . $ o_warn;
$ c_status= WARNING raquo ;;
}
}
$ c_output.= ; . $ c_status; (defined ($ o_perf)) {
$ c_output.= | Ram_used=. $ used. laquo ;; raquo ;;
$ c_output.=($ o_warn == 0)? laquo ;; :Round ($ o_warn * $ total/100,0). Laquo ;; raquo ;;
$ c_output.=($ o_crit == 0)? laquo ;; :Round ($ o_crit * $ total/100,0). Laquo ;; raquo ;;
$ c_output.= 0; . $ total;
}
$ session- gt; close; $ c_output n raquo ;; $ ERRORS {$ c_status};
}
########### Net snmp memory check ############ (defined ($ o_netsnmp)) {
# Get NetSNMP memory values ??
$ resultat=(Net :: SNMP- gt; VERSION lt; 4)?
$ session- gt; get_request (nets_oids)
: $ session- gt; get_request (-varbindlist= gt; nets_oids); (! defined ($ resultat)) {( ERROR: netsnmp:% s. n raquo ;, $ session- gt; error);
$ session- gt; close; $ ERRORS { UNKNOWN };
}
($ realused, $ swapused)=(undef, undef);
$ realused=defined ($ o_cache)?
($$resultat{$nets_ram_total}-$$resultat{$nets_ram_free})/$$resultat{$nets_ram_total}
:
($$resultat{$nets_ram_total}-($$resultat{$n...