Dzahn has submitted this change and it was merged. Change subject: fix check_eth icinga plugin ......................................................................
fix check_eth icinga plugin The "configured eth" checks in Icinga are currently: OK but also "NRPE: Unable to read output" as decribed in T92293. This is because it's simply not echoing a string when things are OK. https://icinga.wikimedia.org/cgi-bin/icinga/status.cgi?search_string=configured+eth Besides this quick fix, it would be better design for icinga plugins if we check explicitely for things to be OK and else exit with a warning instead of checking for known error conditions and defaulting to OK. Bug:T92293 Change-Id: I828e805600721f78cf852aeaeff25eece8b93b97 --- M modules/base/templates/check_eth.erb 1 file changed, 9 insertions(+), 3 deletions(-) Approvals: jenkins-bot: Verified Dzahn: Looks good to me, approved diff --git a/modules/base/templates/check_eth.erb b/modules/base/templates/check_eth.erb index 66f0eb8..6200a5e 100644 --- a/modules/base/templates/check_eth.erb +++ b/modules/base/templates/check_eth.erb @@ -4,13 +4,13 @@ REQ_SPEED=1000 # The default for now STATUS=`ip link show ${INTERFACE}` if [ "$?" != "0" ]; then - echo "${INTERFACE} not found. This should never happen. Bailing out" + MESSAGE="${INTERFACE} not found. This should never happen. Bailing out" EXIT_CODE=1 continue fi if echo ${STATUS} | grep -q "NO-CARRIER" then - echo "${INTERFACE} reporting no carrier." + MESSAGE="${INTERFACE} reporting no carrier." EXIT_CODE=2 fi if echo ${STATUS} | grep -q "DOWN" @@ -20,9 +20,15 @@ CONF_SPEED=$(/sbin/ethtool $INTERFACE | awk '/Speed:/ {gsub("Mb/s","",$2);print $2}') if [ -n "$CONF_SPEED" ]; then if [ $CONF_SPEED -lt $REQ_SPEED ]; then - echo "${INTERFACE} has different negotiated speed than requested" + MESSAGE="${INTERFACE} has different negotiated speed than requested" EXIT_CODE=1 fi fi done + +if [ "$EXIT_CODE" -eq "0" ]; then + MESSAGE="OK - interfaces up" +fi + +echo $MESSAGE exit $EXIT_CODE -- To view, visit https://gerrit.wikimedia.org/r/202798 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I828e805600721f78cf852aeaeff25eece8b93b97 Gerrit-PatchSet: 4 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: Dzahn <[email protected]> Gerrit-Reviewer: Alexandros Kosiaris <[email protected]> Gerrit-Reviewer: Andrew Bogott <[email protected]> Gerrit-Reviewer: Dzahn <[email protected]> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
