Hi again,

Sorry for the delay - work, you know...

The ordinary check_mysql is in my environment configured at host level using 
variables:

vars.mysql_database = "mysql"
vars.mysql_username = "nagios"
vars.mysql_password = "xxxxxxxx"
vars.mysql_port = 3306

But I don't define my own check command as you do. I use the predefined one in 
the template library which follows Icinga 2 
(https://github.com/Icinga/icinga2/blob/master/doc/10-icinga-template-library.md).
 And it seems to work fine.

The Percona plugins on the other hand are much, much easier to set up using the 
file /etc/nagios/mysql.cnf which you create on the host that performs the check:

[client]
user = nagios
password = xxxxxxxx

Hope this helps you a bit further...

Regards,
Kasper

-----Oprindelig meddelelse-----
Fra: ST [mailto:smn...@gmail.com] 
Sendt: 18. maj 2017 11:09
Til: Icinga User's Corner <icinga-users@lists.icinga.org>
Cc: Kasper Løvschall <k...@aub.aau.dk>
Emne: Re: [icinga-users] Mysql replication monitoring

Hi Kasper,

how do you provide username/password to the pmp-check-mysql-replication-running 
? It is not obvious from your setup...

Thank you!


On Wed, 2017-05-17 at 07:02 +0000, Kasper Løvschall wrote:
> Hi ST!
> 
> I can recommend a different approach using the Percona Monitoring Plugins 
> (available for free at 
> https://www.percona.com/software/database-tools/percona-monitoring-plugins).
> 
> It has (among others) two check commands: pmp-check-mysql-replication-running 
> and pmp-check-mysql-replication-delay which should do the trick.
> 
> My configuration is the following - and will probably needs some tweaking in 
> your environment:
> 
> object CheckCommand "pmp-check-mysql-replication-running" {
>   import "plugin-check-command"
> 
>   command = [
>     PluginDir + "/pmp-check-mysql-replication-running"
>   ]
> }
> 
> object CheckCommand "pmp-check-mysql-replication-delay" {
>   import "plugin-check-command"
> 
>   command = [
>     PluginDir + "/pmp-check-mysql-replication-delay"
>   ]
> }
> 
> And apply service:
> 
> apply Service "pmp-check-mysql-replication-running" {
>   import "generic-service"
>   check_command = "pmp-check-mysql-replication-running"
>   display_name = "MySQL replication running"
> 
>   // Run the service on remote client if needed
>   if ( host.vars.remote_client ) {
>     command_endpoint = host.vars.remote_client
>   }
> 
>   assign where host.vars.percona_standard_checks }
> 
> apply Service "pmp-check-mysql-replication-delay" {
>   import "generic-service"
>   check_command = "pmp-check-mysql-replication-delay"
>   display_name = "MySQL replication delay"
> 
>   // Run the service on remote client if needed
>   if ( host.vars.remote_client ) {
>     command_endpoint = host.vars.remote_client
>   }
> 
>   assign where host.vars.percona_standard_checks }
> 
> And the host has got the following assignment:
> 
> vars.percona_standard_checks = true
> 
> 
> Regards,
> 
> Kasper Løvschall
> Senior Adviser  | The University Library
> 
> Phone: (+45) 99 40 73 03  |  Mobile: (+45) 28 95 91 29  |  Email: 
> k...@aub.aau.dk  |  Web: http://www.en.aub.aau.dk Aalborg University 
> Library  |  Langagervej 2  |  9220 Aalborg Ø  |  Denmark
> 
> 
> 
> 
> 
> -----Oprindelig meddelelse-----
> Fra: icinga-users [mailto:icinga-users-boun...@lists.icinga.org] På 
> vegne af ST
> Sendt: 17. maj 2017 07:44
> Til: icinga-users@lists.icinga.org
> Emne: [icinga-users] Mysql replication monitoring
> 
> Hello,
> 
> I'm new to Incinga2 and try to setup mysql replication monitoring on the 
> slave machine. My OS is Debian/Wheezy with Incinga2 Version: r2.1.1-1 from 
> wheezy-backports.
> 
> While learning docs I created following
> file: /etc/icinga2/conf.d/hosts/localhost/mysql-slave.conf (see bellow).
> 
> However if I stop slave manually - I get no notifications from icinga2.
> Only if I change vars.mysql_user to something non-existent - only then icinga 
> complains and notifies me. This doesn't happen even if I change 
> mysql_password to something wrong...
> If I run the check manually from command line:
> 
> /usr/lib/nagios/plugins/check_mysql -u repl --password='my_password'
> --check-slave
> 
> I get proper message on the CLI in both cases when replication runs (OK) and 
> when it doesn't (Failure)...
> 
> 1. What is wrong with my configuration?
> 2. Is there a better/standard way to monitor mysql replication?
> 
> Thank you!
> 
> ---------------------------------
> 
> // custom mysql replication check
> object CheckCommand "my-mysql" {
>   import "plugin-check-command"
>   command = [ PluginDir + "/check_mysql" ] //constants.conf -> const PluginDir
>   arguments = {
>     "-H" = "$mysql_host$"
>     "-u" = {
>       required = true
>       value = "$mysql_user$"
>     }
>     "-p" = "$mysql_password$"
>     "-P" = "$mysql_port$"
>     "-s" = "$mysql_socket$"
>     "-a" = "$mysql_cert$"
>     "-d" = "$mysql_database$"
>     "-k" = "$mysql_key$"
>     "-C" = "$mysql_ca_cert$"
>     "-D" = "$mysql_ca_dir$"
>     "-L" = "$mysql_ciphers$"
>     "-f" = "$mysql_optfile$"
>     "-g" = "$mysql_group$"
>     "-S" = {
>       set_if = "$mysql_check_slave$"
>       description = "Check if the slave thread is running properly."
>     }
>     "-l" = {
>       set_if = "$mysql_ssl$"
>       description = "Use ssl encryption"
>     }
>   }
>   vars.mysql_check_slave = true
>   vars.mysql_ssl = false
>   vars.mysql_host = "$address$"
> }
> apply Service "mysql-replication-health" {
>   import "generic-service"
>   check_command = "my-mysql"
>   vars.mysql_user = "repl"
>   vars.  = "my_password"
> //  vars.mysql_database = "icinga"
> //  vars.mysql_host = "192.168.33.11"
>   vars.mysql_host = "localhost"
>   vars.mysql_check_slave = true
>   vars.sla = "24x7"
> //  assign where match("icinga2*", host.name)
>   assign where true
> //  ignore where host.vars.no_health_check == true }
> 
> ---------------------------------
> 
> _______________________________________________
> icinga-users mailing list
> icinga-users@lists.icinga.org
> https://lists.icinga.org/mailman/listinfo/icinga-users
> _______________________________________________
> icinga-users mailing list
> icinga-users@lists.icinga.org
> https://lists.icinga.org/mailman/listinfo/icinga-users

_______________________________________________
icinga-users mailing list
icinga-users@lists.icinga.org
https://lists.icinga.org/mailman/listinfo/icinga-users

Reply via email to