#!/bin/bash echo "select a.hostname, b.timestamp, b.msg from syslog b inner join devices a on b.device_id=a.device_id where b.msg like '%LINK-3-UPDOWN%' and b.timestamp > DATE_SUB(NOW(), INTERVAL 3 DAY);" > /tmp/select_input echo "select a.hostname, b.timestamp, b.msg from syslog b inner join devices a on b.device_id=a.device_id where b.msg like '%PORT-5-IF_DOWN%' and b.timestamp > DATE_SUB(NOW(), INTERVAL 3 DAY);" >> /tmp/select_input echo "select a.hostname, b.timestamp, b.msg from syslog b inner join devices a on b.device_id=a.device_id where b.msg like '%LINEPROTO-5-UPDOWN%' and b.timestamp > DATE_SUB(NOW(), INTERVAL 3 DAY);" >> /tmp/select_input echo "select a.hostname, b.timestamp, b.msg from syslog b inner join devices a on b.device_id=a.device_id where b.msg like '%PORT-5-IF_UP%' and b.timestamp > DATE_SUB(NOW(), INTERVAL 3 DAY);" >> /tmp/select_input echo "select a.hostname, b.timestamp, b.msg from syslog b inner join devices a on b.device_id=a.device_id where b.msg like '%CANNOT_BUNDLE%' and b.timestamp > DATE_SUB(NOW(), INTERVAL 3 DAY);" >> /tmp/select_input echo "select a.hostname, b.timestamp, b.msg from syslog b inner join devices a on b.device_id=a.device_id where b.msg like '%SNMP-4-HIGHCPU%' and b.timestamp > DATE_SUB(NOW(), INTERVAL 3 DAY);" >> /tmp/select_input echo "select a.hostname, b.timestamp, b.msg from syslog b inner join devices a on b.device_id=a.device_id where b.msg like '%Excessive Broadcast%' and b.timestamp > DATE_SUB(NOW(), INTERVAL 3 DAY);" >> /tmp/select_input echo "select a.hostname, b.timestamp, b.msg from syslog b inner join devices a on b.device_id=a.device_id where b.msg like '%Excessive CRC%' and b.timestamp > DATE_SUB(NOW(), INTERVAL 3 DAY);" >> /tmp/select_input echo "select a.hostname, b.timestamp, b.msg from syslog b inner join devices a on b.device_id=a.device_id where b.msg like '%Duplex Mismatch%' and b.timestamp > DATE_SUB(NOW(), INTERVAL 3 DAY);" >> /tmp/select_input echo "select a.hostname, b.timestamp, b.msg from syslog b inner join devices a on b.device_id=a.device_id where b.msg like '%Excessive late%' and b.timestamp > DATE_SUB(NOW(), INTERVAL 3 DAY);" >> /tmp/select_input echo "select a.hostname, b.timestamp, b.msg from syslog b inner join devices a on b.device_id=a.device_id where b.msg like '%Excessive link state%' and b.timestamp > DATE_SUB(NOW(), INTERVAL 3 DAY);" >> /tmp/select_input echo "select a.hostname, b.timestamp, b.msg from syslog b inner join devices a on b.device_id=a.device_id where b.msg like '%High collision%' and b.timestamp > DATE_SUB(NOW(), INTERVAL 3 DAY);" >> /tmp/select_input echo "select a.hostname, b.timestamp, b.msg from syslog b inner join devices a on b.device_id=a.device_id where b.msg like '%Excessive undersized%' and b.timestamp > DATE_SUB(NOW(), INTERVAL 3 DAY);" >> /tmp/select_input echo "select a.hostname, b.timestamp, b.msg from syslog b inner join devices a on b.device_id=a.device_id where b.msg like '%Excessive jabbering%' and b.timestamp > DATE_SUB(NOW(), INTERVAL 3 DAY);" >> /tmp/select_input echo "
" > /tmp/mail_output mysql -H -uroot -p@Defender2013! -Dobservium < /tmp/select_input >> /tmp/mail_output echo "" >> /tmp/mail_output cat /tmp/mail_output | mail -a "From: conlxsyslog02" -a "Content-Type: text/html" -s "Switchportfehler der letzten 3 Tage" ageissler@conet.de rm /tmp/select_input rm /tmp/mail_output