Skip to content

Commit

Permalink
add LLD triggers removal
Browse files Browse the repository at this point in the history
  • Loading branch information
burner1024 committed Aug 3, 2015
1 parent 66d6cd6 commit 4cc1dab
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ This repo contains a few useful queries for Zabbix database, mostly to cleanup o
* [Old data] (#old-data)
* [Unused data] (#unused-data)
* [Stop email flood] (#stop-email-flood)
* [LLD triggers] (#lld-triggers)

### Important notes

Expand Down Expand Up @@ -55,3 +56,12 @@ This deletes all history for disabled items. May come in handy when you disable
sudo service zabbix-server stop
psql zabbix < stop-email-alerts.sql
sudo service zabbix-server start

#### LLD triggers

Zabbix will create automatically create "Mounted Filesystem Discovery" triggers, which you can't delete or remove from the web interface. These queries will allow you to delete them all at once (disk space and inodes).
mysql zabbix < check-lld-triggers.my.sql
psql -A -R ' : ' -P 'footer=off' zabbix < check-lld-triggers.pg.sql

mysql zabbix < delete-lld-triggers.my.sql
psql -A -R ' : ' -P 'footer=off' zabbix < delete-lld-triggers.pg.sql
13 changes: 13 additions & 0 deletions check-lld-triggers.my.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
SELECT count(triggerid)
AS diskspace
FROM triggers
WHERE description LIKE 'Free disk space is less than 20|%%'
ESCAPE '|'
AND NOT description LIKE '%{#FSNAME}%';

SELECT count(triggerid)
AS inodes
FROM triggers
WHERE description LIKE 'Free disk space is less than 20|%%'
ESCAPE '|'
AND NOT description LIKE '%{#FSNAME}%';
3 changes: 3 additions & 0 deletions check-lld-triggers.pg.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SELECT count(triggerid)
FROM triggers
WHERE description ~* 'disk space.*less.*20%' AND NOT description ~* '{#';
4 changes: 4 additions & 0 deletions delete-lld-triggers.my.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
DELETE FROM triggers
WHERE description LIKE 'Free disk space is less than 20|%%'
ESCAPE '|'
AND NOT description LIKE '%{#FSNAME}%';
3 changes: 3 additions & 0 deletions delete-lld-triggers.pg.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
DELETE
FROM triggers
WHERE description ~* 'disk space.*less.*20%' AND NOT description ~* '{#';

0 comments on commit 4cc1dab

Please sign in to comment.