Hi,
I run into the following problem.
The idea is to check the contents of a mysql database table via a check_mysql_query plugin and if there is any content, you can report this and preferably send the content.
when there is content in the table, a notification is already made, but the question is whether there is an option to place the content directly in the notification (by mail).
I am using now the code below to do the check
command[check_mysql]=/usr/lib64/nagios/plugins/check_mysql_query -H 127.0.0.1 -d callanalysis -u user -p pass -q "select length(results) from runs order by id desc limit 1" -c 100:10000 -w 0:1
Thanks in advance!
check_mysql_query and sent content
Re: check_mysql_query and sent content
What is the full output of this command from the command line?
My assumption is that it just returns an integer, correct? It should display it but what specifically are you trying to have in the message, the integer from the length(results) or something else?
Code: Select all
/usr/lib64/nagios/plugins/check_mysql_query -H 127.0.0.1 -d callanalysis -u user -p pass -q "select length(results) from runs order by id desc limit 1" -c 100:10000 -w 0:1
-
- Posts: 2
- Joined: Fri Aug 02, 2019 2:32 am
Re: check_mysql_query and sent content
Hi,
Thanks for your help and input.
The exact output right now is:
QUERY WARNING: 'select length(results) from runs order by id desc limit 1' returned 1024.000000 | result=1024.000000;1.000000;;
which is valid but it results in email being sent with this in the mail body:
***** Nagios *****
Notification Type: PROBLEM
Service: POSSIBLE HACK suspicious calls
State: WARNING
Date/Time: Thu Aug 1 15:06:40 CEST 2019
Additional Info:
QUERY WARNING: select length(results) from runs order by id desc limit 1 returned 1396.000000
But we would like to see the results text in the email, which is a text describing why the warning goes off. Is there any way to accomplish this?
Thx in advance
Thanks for your help and input.
The exact output right now is:
QUERY WARNING: 'select length(results) from runs order by id desc limit 1' returned 1024.000000 | result=1024.000000;1.000000;;
which is valid but it results in email being sent with this in the mail body:
***** Nagios *****
Notification Type: PROBLEM
Service: POSSIBLE HACK suspicious calls
State: WARNING
Date/Time: Thu Aug 1 15:06:40 CEST 2019
Additional Info:
QUERY WARNING: select length(results) from runs order by id desc limit 1 returned 1396.000000
But we would like to see the results text in the email, which is a text describing why the warning goes off. Is there any way to accomplish this?
Thx in advance
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: check_mysql_query and sent content
the result of your plugin is this
Your email contains this:
If you want more information, you would need to write a plugin that contains the detailed information.
Code: Select all
QUERY WARNING: select length(results) from runs order by id desc limit 1 returned 1396.000000
There is no way for Nagios to know any more details than the plugin returns.PatrickNagios2019 wrote: QUERY WARNING: select length(results) from runs order by id desc limit 1 returned 1396.000000
If you want more information, you would need to write a plugin that contains the detailed information.