ets_ram_free}+$$resultat{$nets_ram_cache}))/$$resultat{$nets_ram_total};
($$ resultat {$ nets_ram_total} == 0) {$ realused=0; }
$ swapused=($$ resultat {$ nets_swap_total} == 0)? 0:
($$resultat{$nets_swap_total}-$$resultat{$nets_swap_free})/$$resultat{$nets_swap_total};
$ realused=round ($ realused * 100,0);
$ swapused=round ($ swapused * 100,0); ($ o_cache)? ( Ram: $$ resultat {$ nets_ram_free}/$$ resultat {$ nets_ram_total}: ??$ realused )
: ( Ram: $$ resultat {$ nets_ram_free} ($$ resultat {$ nets_ram_cache} cached)/$$ resultat {$ nets_ram_total}: ??$ realused ); ( Swap: $$ resultat {$ nets_swap_free}/$$ resultat {$ nets_swap_total}: ??$ swapused );
$ n_status= OK raquo ;; $ n_output= Ram: . $ realused. %, Swap: . $ swapused. %: raquo ;; ((($ o_critR!=0) amp; amp; ($ o_critR lt;=$ realused)) || (($ o_critS!=0) amp; amp; ($ o_critS lt;= $ swapused))) {
$ n_output.= gt; . $ o_critR. laquo ;, . $ o_critS;
$ n_status= CRITICAL raquo ;;
} else {((($ o_warnR!=0) amp; amp; ($ o_warnR lt;=$ realused)) || (($ o_warnS!=0) amp; amp; ($ o_warnS lt;=$ swapused))) {
$ n_output.= gt; . $ o_warnR. laquo ;, . $ o_warnS;
$ n_status= WARNING raquo ;;
}
}
$ n_output.= ; . $ n_status; (defined ($ o_perf)) {(defined ($ o_cache)) {
$ n_output.= | Ram_used=. ($$ resultat {$ nets_ram_total} - $$ resultat {$ nets_ram_free}). laquo ;; raquo ;;
} {
$ n_output.= | Ram_used=. ($$resultat{$nets_ram_total}-$$resultat{$nets_ram_free}-$$resultat{$nets_ram_cache}).laquo;;raquo;;
}
$ n_output.=($ o_warnR == 0)? laquo ;; :Round ($ o_warnR * $$ resultat {$ nets_ram_total}/100,0). Laquo ;; raquo ;;
$ n_output.=($ o_critR == 0)? laquo ;; :Round ($ o_critR * $$ resultat {$ nets_ram_total}/100,0). Laquo ;; raquo ;;
$ n_output.= 0; . $$ resultat {$ nets_ram_total}. raquo ;;
$ n_output.= swap_used=. ($$ resultat {$ nets_swap_total} - $$ resultat {$ nets_swap_free}). laquo ;; raquo ;;
$ n_output.=($ o_warnS == 0)? laquo ;; :Round ($ o_warnS * $$ resultat {$ nets_swap_total}/100,0). Laquo ;; raquo ;;
$ n_output.=($ o_critS == 0)? laquo ;; :Round ($ o_critS * $$ resultat {$ nets_swap_total}/100,0). Laquo ;; raquo ;;
$ n_output.= 0; . $$ resultat {$ nets_swap_total};
}
$ session- gt; close; $ n_output n raquo ;; $ ERRORS {$ n_status};
}
Додаток К
Конфігурація протоколу SNMP на віддалених хостах
# sec.name source community
# com2sec paranoid default publicsec readonly default public
# com2sec readwrite default private
####
# Second, map the security names into group names:
# sec.model sec.nameMyROSystem v1 paranoidMyROSystem v2c paranoidMyROSystem usm paranoidMyROGroup v1 readonlyMyROGroup v2c readonlyMyROGroup usm readonlyMyRWGroup v1 readwriteMyRWGroup v2c readwriteMyRWGroup usm readwrite
####
# Third, create a view for us to let the groups have rights to:
# incl/excl subtree maskall included .1 80system included .iso.dod.internet.mgmt.mib - 2.system
####
# Finally, grant the 2 groups access to the 1 view with different
# write permissions:
# context sec.model sec.level match read write notifMyROSystem any noauth exact system none noneMyROGroup any noauth exact all none noneMyRWGroup any noauth exact all all none
Додаток Л
Конфігурація агента ядра мережевого моніторингу на віддалених хостах
/etc/nagios/nrpe.cfg
# PID FILE
# The name of the file in which the NRPE daemon should write it's process ID
# number. The file is only written if the NRPE daemon is started by the root
# user and is running in standalone mode.
_ file=/ var/run/nrpe.pid
...