zabbix4.2删除故障消息

作者: admin 分类: zabbix 发布时间: 2019-09-02 10:18

当zabix-WEB界面中所显示的故障信息无法通过手动操作关闭时,我们还可以通过直接操作数据库进行删除。

#!/bin/bash

MYSQL_BIN=mysql

MYSQL_USER=zabbix

MYSQL_PWD=123456

MSQL_PORT=3306

MYSQL_HOST=127.0.0.1

DB_NAME=zabbix

MYSQL_LOGIN="${MYSQL_BIN} -u${MYSQL_USER} -p${MYSQL_PWD} -h${MYSQL_HOST} ${DB_NAME}"

triggerids="13614 13684"

for ID in ${triggerids};do

   echo "--------------------------------------------------------------------------------"

   echo "update zabbix.triggers set value=0 where triggerid=${ID} and value=1"

   ${MYSQL_LOGIN} -e "update zabbix.triggers set value=0 where triggerids=${ID} and value=1" 2>&1 | grep -v "Warning: Using a password"

   echo "delete from zabbix.events where objectid=${ID} and object=0"

   ${MYSQL_LOGIN} -e "delete from zabbix.events where objectid=${ID} and object=0" 2>&1 | grep -v "Warning: Using a password"

   ${MYSQL_LOGIN} -e "delete from zabbix.problem where objectid=${ID} and object=0" 2>&1 | grep -v "Warning: Using a password"

echo ""

done

 

Linux 命令大全

如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!