Ad Widget
Collapse
Easy Installation But Complete MySQL Monitoring
Collapse
X
-
Some notes on getting this up and running:
- Install zabbix_sender
yum install zabbix-sender -y
(note I'm using Eric Gearhart's repo)
- On my centos install I have both zabbix_agentd.conf and zabbix_agent.conf and the latter is the one in use in /etc/zabbix
- Make sure Hostname=your.hostname.com line is in your zabbix_agent(d).conf (whichever is in use on your system). Zabbix needs to know which hostname to apply the data it receives.
- In the mysql.pl file add the missing semi colon as noted in the posts above.
- Add a user to mysql:
CREATE USER 'zabbix'@'localhost' IDENTIFIED BY 'asdfasdfasdfasdfasfd';
GRANT SELECT, SUPER, PROCESS ON *.* TO 'zabbix'@'localhost' WITH GRANT OPTION;
- Put that user/pass into the top of your mysql.pl file
- After uploading your mysql.pl file chmod 755 for permissions to execute
- On centos we have the following paths:
/usr/sbin/mysql.pl
/usr/bin/zabbix_sender
So the call is::
/usr/sbin/mysql.pl | /usr/bin/zabbix_sender -z 10.10.1.35 -c /etc/zabbix/zabbix_agent.conf -i -
- Add the line to your zabbix_agent.conf (or zabbix_agentd.conf) at the end like this:
UserParameter=custom.mysql.activate,/usr/sbin/mysql.pl | /usr/bin/zabbix_sender -z 10.10.1.35 -c /etc/zabbix/zabbix_agent.conf -i -
- And then of course import the template and assign it to your host
- in the call replace zabbixserver from the example, or 10.10.1.35 in my example, to your zabbix server locationLast edited by cheezus; 08-01-2012, 08:32.Comment
-
Hmm.... looks like some of the items are failing when sending to the server:
Info from server: "Processed 52 Failed 59 Total 111 Seconds spent 0.001731"
sent: 111; skipped: 1; total: 112
EDIT: re-reading the first post of the author he does say he cut out a lot of unnecessary items so this would seem to be correct behavior.Last edited by cheezus; 08-01-2012, 04:02.Comment
-
Comment
-
This a old but still interesting post, would you remember what you've added?
[edit]
I figured it out with a little help from the IRC Chat.
You create a new Item in your template to trigger the script every time you want to refresh the data.
Type: Zabbix agent
Key: "custom.mysql.activate"
Type of information: Text
Update interval (in sec): 1
Then it's up to you how often you want to receive new fresh data.
As I was debugging a system I set mine to pool every second.
Important to set the Type of information to text. As you'll also receive the output result once the script finishes sending the data with zabbix_sender.
A reminder that you will receive about 58 errors as the template was cleaned up before. Still the script "scrapes" for 110 items. While you only look at about 52. To get see everything you'd need to use the old template or setup all new items that are missing.Comment
-
Great solution, thank you.
But why do you use: (x=0/y=0)>z in triggers? This is not working anymore. Also, this will cause division by zero. Valid way is:
Have to fix triggers and chosen some other counters, redone graphs. If somebody interested, results can be downloaded here:
There are a lot of examples how to monitor MySQL internal by zabbix-agent, like: http://wiki.enchtex.info/howto/zabbix/advanced_mysql_monitoring https://www.zabbix.com/wiki/doku.php?id=howto/monitor/db/mysql/extensive_mysql_monitoring_including_replication https://www.zabbix.com/forum/showthread.php?t=20488 but you know - the main issue is NIH ;) Those solutions are too heavy and use dependencies like php. Also, mysql SHOW GLOBAL STATUS provides with hundreds of values, and its hard to select ~50 of most valuable ones. Last link is the best solution found, I’ve updated it a little: Fast and light - only one bash file Zabbix traps are used to send data in one chunk, lowering system load and bandwidth 45 items, 13 triggers, 11 graphs Installation:Comment
Comment