[icinga-users] problem with the mysql check

Gerald Vogt vogt at spamcop.net
Wed Jan 18 07:06:22 CET 2017


On 17/01/2017 22:10, Mathieu Arnold wrote:
> Le 17/01/2017 à 21:36, Lee Clemens a écrit :
>> I may have copied the wrong config, which specific check command are you using?
>>
>> Did you try setting the socket?
>>
>>         "-s" = "$mysql_socket$"
>
> Your quote may have been wrong, but my answer still applies, using the
> mysql check provided by icinga, the -H $mysql_hostname$ is *always* set,
> and to use -s, -H must not be set.

For a start it would be extremely helpful if you posted the distribution 
you use and the exact version of the check_mysql plugin.

For check_mysql v2.1.4 on CentOS 7 it seems to be enough to set the 
hostname to "localhost" as long as the unix socket is in the default 
location:

$ /usr/lib64/nagios/plugins/check_mysql -H localhost -u icinga -p password
Uptime: 904  Threads: 2  Questions...

I have skip_networking=ON, verified with network -lt that's not 
listening on a tcp socket. strace also shows it connects to the unix socket.

Thus set vars.mysql_hostname = "localhost" in your service definition...

-Gerald

>
>> Lee Clemens
>>
>> -----Original Message-----
>> From: icinga-users [mailto:icinga-users-bounces at lists.icinga.org] On Behalf Of Mathieu Arnold
>> Sent: Tuesday, January 17, 2017 3:19 PM
>> To: Icinga User's Corner <icinga-users at lists.icinga.org>
>> Subject: Re: [icinga-users] problem with the mysql check
>>
>> Le 17/01/2017 à 21:05, Lee Clemens a écrit :
>>> Depending on your my.cnf you can use the host as "localhost".
>> Like I said, it is not listening on any network interface :-)
>>
>>> Or define the socket's location:
>>>         "--socket" = {
>>>             value = "$mysql_health_socket$"
>>>             description = "the database's unix socket"
>>>         }
>> That would be great and all, *but* it would still set the -H $mysql_hostname$ and:
>>
>>  -s, --socket=STRING
>>     Use the specified socket (has no effect if -H is used)
>>
>>
>>> Lee Clemens
>>>
>>> -----Original Message-----
>>> From: icinga-users [mailto:icinga-users-bounces at lists.icinga.org] On
>>> Behalf Of Mathieu Arnold
>>> Sent: Tuesday, January 17, 2017 2:28 PM
>>> To: icinga-users at lists.icinga.org
>>> Subject: [icinga-users] problem with the mysql check
>>>
>>> Hi,
>>>
>>>
>>> I've been fighting with the mysql check for some time, the problem I have is that mysql is not listening on any INET{,6} socket, only on /tmp/mysql.sock and I don't seem to be able to be able to get the command to *not* pass the -H argument.
>>>
>>>
>>> If I don't supply an argument, icinga ends up adding -H $host.address$, if I set mysql_hostname to "" or null, it ends up passing -H "".
>>>
>>>
>>> So, is there a way to set mysql_hostname to something, that will make it not be there at all ?
>>>
>>>
>>> I think the mysql (and mysql_query) check commands should not set the mysql_hostname by default, or provide a way to not set it.
>>>
>>>
>>> -- Mathieu Arnold



More information about the icinga-users mailing list