{"id":503,"date":"2013-10-13T09:59:01","date_gmt":"2013-10-13T07:59:01","guid":{"rendered":"http:\/\/bergs.biz\/blog\/?p=503"},"modified":"2013-10-13T09:59:01","modified_gmt":"2013-10-13T07:59:01","slug":"nagios-check-for-avira-antivirus-definitions","status":"publish","type":"post","link":"https:\/\/bergs.biz\/blog\/2013\/10\/13\/nagios-check-for-avira-antivirus-definitions\/","title":{"rendered":"Nagios check for Avira AntiVirus definitions"},"content":{"rendered":"<p>I wrapped up a quick script to check whether my Avira AntiVirus definitions are current. Since it might be useful to other people I thought I&#8217;d just publish it here:<\/p>\n<pre>#!\/bin\/bash\r\n\r\nYOUNGEST_FILE=$(ls -tr \/usr\/lib\/AntiVir\/guard\/*.vdf|tail -1)\r\n\r\nWARN=$1\r\nCRIT=$2\r\nWARN=$((${WARN:=3} * 86400))\r\nCRIT=$((${CRIT:=7} * 86400))\r\n\r\nfunction age() {\r\n\u00a0\u00a0 local filename=$1\r\n\u00a0\u00a0 local changed=`stat -c %Y \"$filename\"`\r\n\u00a0\u00a0 local now=`date +%s`\r\n\u00a0\u00a0 local elapsed\r\n\r\n\u00a0\u00a0 let elapsed=now-changed\r\n\u00a0\u00a0 echo $elapsed\r\n}\r\n\r\nFILEAGE=$(age \"${YOUNGEST_FILE}\")\r\n\r\nif [ $FILEAGE -gt $CRIT ]; then\r\n\u00a0\u00a0 \u00a0echo \"CRITICAL - Youngest file is $FILEAGE sec old\"\r\n\u00a0\u00a0 \u00a0exit 2\r\nelif [ $FILEAGE -gt $WARN ]; then\r\n\u00a0\u00a0 \u00a0echo \"WARNING - Youngest file is $FILEAGE sec old\"\r\n\u00a0\u00a0 \u00a0exit 1\r\nelse\r\n\u00a0\u00a0 \u00a0echo \"OK - Youngest file is $FILEAGE sec old\"\r\nfi<\/pre>\n<p>The default (if you don&#8217;t supply any command-line parms) is to warn if the youngest of all virus definition files is older than 3 days, and a critical alert will be triggered if it is older than 7 days. If you supply only one parm it will change the number of days until a warning is triggered, and if you also supply the second parm it will also change the days for a critical alert.<\/p>\n<p>I hope this is useful for someone!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Nagios check for Avira AntiVirus definitions<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[46],"tags":[94,23],"class_list":["post-503","post","type-post","status-publish","format-standard","hentry","category-security-computers","tag-monitoring","tag-nagios"],"_links":{"self":[{"href":"https:\/\/bergs.biz\/blog\/wp-json\/wp\/v2\/posts\/503","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bergs.biz\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bergs.biz\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bergs.biz\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/bergs.biz\/blog\/wp-json\/wp\/v2\/comments?post=503"}],"version-history":[{"count":1,"href":"https:\/\/bergs.biz\/blog\/wp-json\/wp\/v2\/posts\/503\/revisions"}],"predecessor-version":[{"id":504,"href":"https:\/\/bergs.biz\/blog\/wp-json\/wp\/v2\/posts\/503\/revisions\/504"}],"wp:attachment":[{"href":"https:\/\/bergs.biz\/blog\/wp-json\/wp\/v2\/media?parent=503"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bergs.biz\/blog\/wp-json\/wp\/v2\/categories?post=503"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bergs.biz\/blog\/wp-json\/wp\/v2\/tags?post=503"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}