Hello all,
I have a question regarding the mysql.custom.query item key. I'm trying to make some alerts based on this key, just like I did with PostgreSQL and its' agent2 plugin. But I ran into a small problem.
For psql.custom.query, you are able to specify the database the query is run on, as the item key accepts it as a parameter {$PG.DATABASE}. For mysql.custom.query, an equivalent parameter however does not seem to exist. Because of this I cannot get my items to work, they always return error database not selected as mysql does not know which database to run the query on.
So my question is how are you supposed to specify the database? I tried to specify it in the data source name, like tcp://127.0.0.1:3306/dbname , but the last part is just ignored. I tried to write it into the customquery.sql file like
but this returns SQL syntax error, as I'm sure it accepts only 1 query at a time.
Any suggestions? Thank you in advance.
I have a question regarding the mysql.custom.query item key. I'm trying to make some alerts based on this key, just like I did with PostgreSQL and its' agent2 plugin. But I ran into a small problem.
For psql.custom.query, you are able to specify the database the query is run on, as the item key accepts it as a parameter {$PG.DATABASE}. For mysql.custom.query, an equivalent parameter however does not seem to exist. Because of this I cannot get my items to work, they always return error database not selected as mysql does not know which database to run the query on.
So my question is how are you supposed to specify the database? I tried to specify it in the data source name, like tcp://127.0.0.1:3306/dbname , but the last part is just ignored. I tried to write it into the customquery.sql file like
Code:
USE dbname; SELECT * FROM table;
Any suggestions? Thank you in advance.
Comment