Subject: How to do a "command" service

From: John Buttery <[email-masked]>
Date: Wed, 15 Aug 2007 16:22:23 -0500

I was wondering if anybody could elaborate on the ability of Argus to 
alert based on the exitstatus of a command.  I have this block:

Service Prog {
  ## Monitor MySQL replication slave
  label: repslave
  info: MySQL replication slave
  uname: repslave
  command: /usr/local/bin/checkslave -m 0 db_machine
  ## Can use expect, but the script already exits nonzero
  ## if the slave is too far behind or down, so let's
  ## just use that and keep it simple
  ## OK, maybe not, looks like exitstatus doesn't work
  expect: ^SC is 0$
}

  This config works, but I thought it'd be a little simpler to just act 
on the exitstatus.  Unfortunately, it's not working the way I expected.  
If I comment out the "expect" line, the service never 
goes "down"...even when I forcibly make the script exit "1".
  What's the correct syntax for a block that basically says "run this 
command, and alert if the exitstatus is nonzero"?

-- 
John Buttery <[email-masked]>
System Administrator

---

From: Jeff Weisberg <[email-masked]>
Date: Wed, 29 Aug 2007 21:26:20 -0400 (EDT)

|   I was wondering if anybody could elaborate on the ability of Argus to 
| alert based on the exitstatus of a command.  I have this block:
| 
| Service Prog {
|   ## Monitor MySQL replication slave
|   label: repslave
|   info: MySQL replication slave
|   uname: repslave
|   command: /usr/local/bin/checkslave -m 0 db_machine
|   ## Can use expect, but the script already exits nonzero
|   ## if the slave is too far behind or down, so let's
|   ## just use that and keep it simple
|   ## OK, maybe not, looks like exitstatus doesn't work
|   expect: ^SC is 0$
| }
| 
|   This config works, but I thought it'd be a little simpler to just act 
| on the exitstatus.  Unfortunately, it's not working the way I expected.  
| If I comment out the "expect" line, the service never 
| goes "down"...even when I forcibly make the script exit "1".
|   What's the correct syntax for a block that basically says "run this 
| command, and alert if the exitstatus is nonzero"?

you are correct. if you remove the 'expect', it will act based
on the exit status.

you can click on the 'debugging' page, and look at 'prog::exit'
for the actual value that the program exited with to confirm