Seeking help,
I am fairly new to PMM and I been creating Prom queries with the provided metrics on the MySQLExpoter. But I’m wanting to create and add to PMM a new query which just collects a count of mysql.users.
So the query looks like this: select count(*) from mysql.user;
I’ve tried some methods in the collectors folder and trying pmm-admin, I feel like I am doing something wrong.
current version of percona is 2.38.1
Yes, I’ve followed the steps and added the query on the mysql server not the PMM server under the medium resolution.
/usr/local/percona/pmm2/collectors/custom-queries/mysql/medium-resolution/queries-mysqld.yml
the query I am trying to create has this format.
mysql_users:
query: "select count(*) from mysql.user;"
metrics:
-user_cnt:
usage: "GAUGE"
description: "Count of Users created"
I am assuming from the forum it should populate automatically. I also tried a reboot on both the PMM and mysql server(Mariadb)
Ok. So now you should be able to create a new dashboard in the UI, create a graph element, and populate it from the metric mysql_users_user_cnt
That’s where the problem is I doesn’t appear on the dashboard and I began to question if I’m not doing something correctly or if I overlooked a step. But the page you provided is pretty straight forward. As a note I did restart the servers.
You might have a mistake. You have -user_cnt
and it should be - user_cnt
Note the spacing. Use a yaml syntax checker online to verify.
I figured out what the problem was for this particular query by trying to run usage as a GAUGE I wasn’t getting any results. Since I am running a count within the query changing it’s usage to COUNTER provided actual results. Other than that all the information and insight you provided to me was correct.