HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

Monitor user to query processlist

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
userqueryprocesslistmonitor

Problem

We have a corporate monitoring system based in Zabbix. Its MySQL monitoring is quite basic, so I want to add more info. To do so, I've done a script that retrieves this info from MySQL and sends it to Zabbix.

Among the retrieved info, I want to get current connections, but I've only managed to do so with the root user. I've created a zabbix user with SELECT and PROCESS permissions* and tried mysqladmin -u zabbix processlist, but I get Access denied; you need the PROCESS privilege for this operation.

show grants for 'zabbix'@'%';
+----------------------------------------------+
| Grants for zabbix@%                          |
+----------------------------------------------+
| GRANT SELECT, PROCESS ON *.* TO 'zabbix'@'%' |
+----------------------------------------------+
SELECT USER(), CURRENT_USER();
+----------------+----------------+
| USER()         | CURRENT_USER() |
+----------------+----------------+
| root@localhost | root@localhost |
+----------------+----------------+


How can I get zabbix user to retrieve processlist?

* Yes, I've flushed permissions

Solution

Perhaps you can create a DB user whose sole purpose in life is to collect the processlist.

Your error message indicates that zabbix does not have the PROCESS privilege.

Without the PROCESS privilege, zabbix can only view the processlist of zabbix users. Not much fun, eh?

But WAIT, you said

mysqladmin -u zabbix processlist


That will attempt to connect as zabbix@localhost which you did not define. Please note:

  • zabbix@localhost will authenticate via the socket file



  • zabbix@'%' will authenticate via TCP/IP



Simply run

GRANT SELECT, PROCESS ON *.* TO 'zabbix'@'localhost';


and your troubles should be over.

Without adding another MySQL user, just specify the TCP/IP protocol

mysqladmin -u zabbix --protocol=tcp processlist

Code Snippets

mysqladmin -u zabbix processlist
GRANT SELECT, PROCESS ON *.* TO 'zabbix'@'localhost';
mysqladmin -u zabbix --protocol=tcp processlist

Context

StackExchange Database Administrators Q#34131, answer score: 2

Revisions (0)

No revisions yet.