Thank you very much for your response!

I did read about the Percona Monitoring Plugin, but thought that using
standard plugins, available as Debian package should be better,
especially if I plan to use Ansible in future to configure my Icinga
setup...

I'll definitely use your suggestion if I don't get it working with the
standard check_mysql. Just any ideas why it doesn't work? Can you test
your replication with this command, to see whether it is working
correctly?

/usr/lib/nagios/plugins/check_mysql -u repl --password='my_password'
--check-slave

And if yes - why doesn't it work through Icinga?

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