Fw: expect parameter

Jeremy Kister argus-01 at jeremykister.com
Fri Oct 15 22:28:07 EDT 2004

On Fri, 15 Oct 2004 10:22:45 -0400, Jason 'XenoPhage' Frisvold wrote:

> expression?  I'm trying to monitor the replication status on my MySQL
> server and I want to ensure that Slave_IO_Running and Slave_SQL_Running
> are both Yes.  I believe I can do this by checking for the string "|
> Yes        | Yes" in the return of "show slave status;" ...  I just need

I dont know of a version of Mysql that shows "|Yes    | Yes"; this may be
some interpretation of some softare trying to show you columns.

the best way I've found for argus to directly monitor MySQL slave status is:
Service DB {
  dsn:	DBI:mysql:host=hostname
  user:         username
   pass:        password
   sql: show slave status
   expect:	Yes Yes
   label:	slave_status
   uname:	Status

this could, possibly, yield false positives, though.  To be realy _really_
sure, run some perl:


use strict;
use DBI;

my $hostname = shift || die "specify hostname\n";
my $dbun = 'user';
my $dbpw = 'pass';

my $dsn = "DBI:mysql:host=${hostname}";
my $dbh = DBI->connect($dsn, $dbun, $dbpw, {RaiseError =>1});
my $sql = 'SHOW SLAVE STATUS';
my $sth = $dbh->prepare($sql);
my $row = $sth->fetchrow_hashref;
my $io = $row->{Slave_IO_Running};
my $sql = $row->{Slave_SQL_Running};

if(($io eq 'Yes') && ($sql eq 'Yes')){
        print "OK\n"
        print "ERROR\n";

and then in your argus config, just put:
 Service Prog {
   command: /usr/local/script/sqltest.pl host.example.com
   expect: ^OK
   label: SQL_SLAVE


Jeremy Kister

More information about the Arguslist mailing list