init
This commit is contained in:
43
root/observium/port_alert_disable.sh
Executable file
43
root/observium/port_alert_disable.sh
Executable file
@@ -0,0 +1,43 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 3Tage = 3*24*60*60 = 259200
|
||||
TIME_IN_DAYS=28
|
||||
TIME_WAIT_FOR_DISABLE_ALERTS=`expr $TIME_IN_DAYS \* 24 \* 60 \* 60`
|
||||
|
||||
SCRIPTPATH=/scripts/root/observium
|
||||
echo "" > $SCRIPTPATH/script.sql
|
||||
|
||||
echo "setze alle ports auf nicht! ignorieren"
|
||||
echo "update ports set \`ignore\`='0';" >> $SCRIPTPATH/script.sql
|
||||
|
||||
#echo "diese ports sind seit mindestens $TIME_IN_DAYS Tagen down"
|
||||
#echo "select \`port_id\`, \`ignore\`, \`ifOperStatus\`, \`ifLastChange\`, TIMESTAMPDIFF(SECOND, \`ifLastChange\`, NOW()) diff from ports where \`ifOperStatus\`='down' and TIMESTAMPDIFF(SECOND, \`ifLastChange\`, NOW())>'$TIME_WAIT_FOR_DISABLE_ALERTS';" > $SCRIPTPATH/script.sql
|
||||
|
||||
echo "setze ports die seit mindestens $TIME_IN_DAYS Tagen down aber nicht shut sind auf ignore"
|
||||
echo "update ports set \`ignore\`='1' where \`ifOperStatus\`='down' and \`ifAdminStatus\`='up' and TIMESTAMPDIFF(SECOND, \`ifLastChange\`, NOW())>'$TIME_WAIT_FOR_DISABLE_ALERTS';" >> $SCRIPTPATH/script.sql
|
||||
|
||||
echo "setze ports auf immer alarmieren für bestimmte Geräte"
|
||||
HOSTID="switch-sp-% switch-catalyst-% switch-nexus-% router-% asa-% switch-vwd-%"
|
||||
for HOST in `echo $HOSTID`
|
||||
do
|
||||
echo "update ports inner join devices on ports.device_id=devices.device_id set ports.ignore='0' where hostname like '$HOST';" >> $SCRIPTPATH/script.sql
|
||||
done
|
||||
|
||||
echo "setze ports auf nie alarmieren für bestimmte Geräte"
|
||||
HOSTID="switch-fibre-% %.conadm.de"
|
||||
for HOST in `echo $HOSTID`
|
||||
do
|
||||
echo "update ports inner join devices on ports.device_id=devices.device_id set ports.ignore='1' where hostname like '$HOST';" >> $SCRIPTPATH/script.sql
|
||||
done
|
||||
|
||||
echo "setze alle admin down ports auf ignorieren"
|
||||
echo "update ports set \`ignore\`='1' where \`ifAdminStatus\`='down';" >> $SCRIPTPATH/script.sql
|
||||
|
||||
echo "setze alle ports < 100 kbit auf ignorieren"
|
||||
echo "update ports set \`ignore\`='1' where \`ifSpeed\`<100000;" >> $SCRIPTPATH/script.sql
|
||||
|
||||
echo "setze wichtige Ports (!!!) auf nie!!!!!!!!!! ignorieren"
|
||||
echo "update ports set \`ignore\`='0' where \`ifAlias\` like '%!!!%';" >> $SCRIPTPATH/script.sql
|
||||
|
||||
echo "Führe sql Skript jetzt aus"
|
||||
mysql --user=observium --password=observium observium < $SCRIPTPATH/script.sql >> $SCRIPTPATH/result.txt
|
||||
Reference in New Issue
Block a user