diff options
author | mboelen <michael@cisofy.com> | 2014-09-15 14:01:09 +0400 |
---|---|---|
committer | mboelen <michael@cisofy.com> | 2014-09-15 14:01:09 +0400 |
commit | c9fde8c2d11744cc0875bc3e5dd0abf096211755 (patch) | |
tree | 0997d08919db7ec4e2aa9065c3e9aaf1671c4d6f /include/tests_snmp | |
parent | 35d32fb5e40b86632677fd2256aebeddf926394a (diff) |
Code cleanup and small enhancements
Diffstat (limited to 'include/tests_snmp')
-rw-r--r-- | include/tests_snmp | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/include/tests_snmp b/include/tests_snmp index 92344a17..e05a9bf1 100644 --- a/include/tests_snmp +++ b/include/tests_snmp @@ -30,17 +30,17 @@ # Description : Check for a running SNMP daemon Register --test-no SNMP-3302 --weight L --network NO --description "Check for running SNMP daemon" if [ ${SKIPTEST} -eq 0 ]; then - logtext "Test: Searching for a SNMP daemon..." - # Check running processes - FIND=`${PSBINARY} ax | grep "snmpd" | grep -v "grep"` - if [ ! "${FIND}" = "" ]; then - SNMP_DAEMON_RUNNING=1 - logtext "Result: SNMP daemon is running" - Display --indent 2 --text "- Checking running SNMP daemon..." --result FOUND --color GREEN - else - logtext "Result: No running SNMP daemon found" - Display --indent 2 --text "- Checking running SNMP daemon..." --result "NOT FOUND" --color WHITE - fi + logtext "Test: Searching for a SNMP daemon" + # Check running processes + IsRunning snmpd + if [ ${RUNNING} -eq 1 ]; then + SNMP_DAEMON_RUNNING=1 + logtext "Result: SNMP daemon is running" + Display --indent 2 --text "- Checking running SNMP daemon" --result FOUND --color GREEN + else + logtext "Result: No running SNMP daemon found" + Display --indent 2 --text "- Checking running SNMP daemon" --result "NOT FOUND" --color WHITE + fi fi # ################################################################################# @@ -51,19 +51,19 @@ Register --test-no SNMP-3304 --preqs-met ${PREQS_MET} --weight L --network NO --description "Check SNMP daemon file location" if [ ${SKIPTEST} -eq 0 ]; then logtext "Action: searching for snmpd.conf file" - for I in ${SNMP_DAEMON_CONFIG_LOCS}; do - if [ -f "${I}/snmpd.conf" ]; then - logtext "Result: ${I}/snmpd.conf exists" - SNMPD_DAEMON_CONFIG="${I}/snmpd.conf" - fi - done - if [ "${SNMPD_DAEMON_CONFIG}" = "" ]; then - logtext "Result: No snmpd configuration found" - Display --indent 4 --text "- Checking SNMP configuration..." --result "NOT FOUND" --color WHITE - else - logtext "Restult: using last found configuration file: ${SNMPD_DAEMON_CONFIG}" - Display --indent 4 --text "- Checking SNMP configuration..." --result "FOUND" --color GREEN - fi + for I in ${SNMP_DAEMON_CONFIG_LOCS}; do + if [ -f "${I}/snmpd.conf" ]; then + logtext "Result: ${I}/snmpd.conf exists" + SNMPD_DAEMON_CONFIG="${I}/snmpd.conf" + fi + done + if [ "${SNMPD_DAEMON_CONFIG}" = "" ]; then + logtext "Result: No snmpd configuration found" + Display --indent 4 --text "- Checking SNMP configuration" --result "NOT FOUND" --color WHITE + else + logtext "Restult: using last found configuration file: ${SNMPD_DAEMON_CONFIG}" + Display --indent 4 --text "- Checking SNMP configuration" --result "FOUND" --color GREEN + fi fi # ################################################################################# @@ -87,10 +87,10 @@ # Check status of test if [ ${WARN} -eq 0 ]; then - Display --indent 2 --text "- Checking SNMP community strings..." --result OK --color GREEN + Display --indent 2 --text "- Checking SNMP community strings" --result OK --color GREEN AddHP 2 2 else - Display --indent 2 --text "- Checking SNMP community strings..." --result WARNING --color RED + Display --indent 2 --text "- Checking SNMP community strings" --result WARNING --color RED ReportWarning ${TEST_NO} "M" "Found easy guessable SNMP community string" fi fi |