Skip to content

Instantly share code, notes, and snippets.

@ironbishop
Created May 30, 2019 07:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ironbishop/713e7b72f8e4a057569efeeee387658a to your computer and use it in GitHub Desktop.
Save ironbishop/713e7b72f8e4a057569efeeee387658a to your computer and use it in GitHub Desktop.
zabbix full queue content from cache / db into csv

Issue

"Queue Details" in Zabbix web interface is capped to 500 items.

Workaround

To obtain full queue (Zabbix web interface):

  • change value QUEUE_DETAIL_ITEM_COUNT in file frontends\php\include\defines.inc.php

More details:

  • enable "debug" for your user
  • open the "Queue Details" web page and save it (because it autorefreshes and you probably need more than 30 seconds)
  • take the SQL query from the HTML
  • add h.name and INNER JOIN (see below)
  • execute on DB and save

TO DO:

  • add timestamp and delay

Example:

SELECT i.itemid,i.hostid,i.name,h.name,i.key_ FROM items i 
inner join hosts h on h.hostid=i.hostid
WHERE i.flags IN (0,4) AND (i.itemid BETWEEN '69299' AND '69306')
INTO OUTFILE '/var/lib/mysql-files/output-20190529.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n';
# mysql zabbix < select.sql

works_on_my_machine.png

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment