Re: Spam:******, Re: Fwd: Re: Fwd: Re: Fwd: Re: getting mon to execute shell command

2010-04-30 Thread Brandon S. Allbery KF8NH

On Apr 29, 2010, at 10:35 , Chris Hoogendyk wrote:
And, perl is built in too. I don't think there is a Linux or Unix  
that comes without it. Been that way for years.


FreeBSD dropped Perl from the base some time back.

--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8nh.com
system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu
electrical and computer engineering, carnegie mellon universityKF8NH




PGP.sig
Description: This is a digitally signed message part
___
mon mailing list
mon@linux.kernel.org
http://linux.kernel.org/mailman/listinfo/mon


Re: Fwd: Spam:******, Re: Fwd: Re: Fwd: Re: Fwd: Re: getting mon to execute shell command

2010-04-28 Thread Noel Butler
The point is mon is perl based, and there already exists a perfectly
working sms.alert script, so why re-invent the wheel.
Since you are using a debian based system and they are well known for
screwing things to their own liking I suggest you investigate your
init.d mon script which it is pretty clear where the problem is.




On Wed, 2010-04-28 at 17:30 +0200, ad...@jack-clan.nl wrote:

 well, why use perl to do something, when it should work with bash, the
 built-in way to do things in linux?
 And mind it works, when i start mon -f it executes, but not when i run
 /etc/init.d/mon start.
 
 
 
 
 
 
 
  Why don't you just use the perl sms.alert script?
  whats the fascination with bash?
  
  
  On Tue, 2010-04-27 at 16:28 +0200, ad...@jack-clan.nl wrote:
  
  No still ain't workin'
  Pffft ,has anybody used a shell script as an alert before ( in
  daemon-mode
  ) ?
  Otherwise i ll start mon as a program, not as a daemon, or are there
  reasons not to do so?
  
  thanks
  
  
  sms.alert:
  
  
  #!/bin/bash
  
  export
 
 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
  
  /bin/echo servers down test | /usr/bin/gammu --sendsms TEXT
 0653638072
  
  
  
  Jim Trocki :
  
  
  if it works when you do -d -f then from that shell do
  
  echo $PATH
  
  and put that path at the top of your bash script, e.g.
  
  #!/usr/bin/bash
  
  export PATH=/bin:/usr/bin:whatever
  
  
  
  ___
  mon mailing list
  mon@linux.kernel.org
  http://linux.kernel.org/mailman/listinfo/mon
___
mon mailing list
mon@linux.kernel.org
http://linux.kernel.org/mailman/listinfo/mon


Fwd: Spam:******, Re: Fwd: Re: Fwd: Re: Fwd: Re: getting mon to execute shell command

2010-04-27 Thread admin
No still ain't workin'
Pffft ,has anybody used a shell script as an alert before ( in daemon-mode
) ?
Otherwise i ll start mon as a program, not as a daemon, or are there
reasons not to do so?

thanks


sms.alert:


#!/bin/bash

export
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

/bin/echo servers down test | /usr/bin/gammu --sendsms TEXT 0653638072



Jim Trocki :


if it works when you do -d -f then from that shell do

echo $PATH

and put that path at the top of your bash script, e.g.

#!/usr/bin/bash

export PATH=/bin:/usr/bin:whatever



___
mon mailing list
mon@linux.kernel.org
http://linux.kernel.org/mailman/listinfo/mon


Re: Fwd: Spam:******, Re: Fwd: Re: Fwd: Re: Fwd: Re: getting mon to execute shell command

2010-04-27 Thread Noel Butler
Why don't you just use the perl sms.alert script?
whats the fascination with bash?


On Tue, 2010-04-27 at 16:28 +0200, ad...@jack-clan.nl wrote:

 No still ain't workin'
 Pffft ,has anybody used a shell script as an alert before ( in daemon-mode
 ) ?
 Otherwise i ll start mon as a program, not as a daemon, or are there
 reasons not to do so?
 
 thanks
 
 
 sms.alert:
 
 
 #!/bin/bash
 
 export
 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
 
 /bin/echo servers down test | /usr/bin/gammu --sendsms TEXT 0653638072
 
 
 
 Jim Trocki :
 
 
 if it works when you do -d -f then from that shell do
 
 echo $PATH
 
 and put that path at the top of your bash script, e.g.
 
 #!/usr/bin/bash
 
 export PATH=/bin:/usr/bin:whatever
 
 
 
 ___
 mon mailing list
 mon@linux.kernel.org
 http://linux.kernel.org/mailman/listinfo/mon
___
mon mailing list
mon@linux.kernel.org
http://linux.kernel.org/mailman/listinfo/mon


Fwd: Re: Fwd: Re: getting mon to execute shell command

2010-04-26 Thread admin


yes, now it works,

but if i start mon as daemon ,eg /etc/init.d/mon start
it doesn't work


start mon with the debug flag -d, without -f, and watch the output
after it notices the first failure.

___
mon mailing list
mon@linux.kernel.org
http://linux.kernel.org/mailman/listinfo/mon


Re: Fwd: Re: Fwd: Re: getting mon to execute shell command

2010-04-26 Thread Jim Trocki

On Mon, 26 Apr 2010, ad...@jack-clan.nl wrote:




yes, now it works,

but if i start mon as daemon ,eg /etc/init.d/mon start
it doesn't work


it's probably your environment. be more explicit with the paths to the
programs you call from your alert script by either setting a path at
the top of the script or by specifying the full path to each.

___
mon mailing list
mon@linux.kernel.org
http://linux.kernel.org/mailman/listinfo/mon


Fwd: Re: Fwd: Re: Fwd: Re: getting mon to execute shell command

2010-04-26 Thread admin
ok, i read a lot about setting paths in your bash profile but that isn't
what you mean i think,
a daemon is already active without a user logged in?

but when i look at my script i specify the path to gammu in the second
line :
that should be enough or am i thinking the wrong way? 


#!/usr/bin/bash

echo servers down test | /usr/bin/gammu --sendsms TEXT 12345678






 yes, now it works,

 but if i start mon as daemon ,eg /etc/init.d/mon start
 it doesn't work




it's probably your environment. be more explicit with the paths to the
programs you call from your alert script by either setting a path at
the top of the script or by specifying the full path to each.

___
mon mailing list
mon@linux.kernel.org
http://linux.kernel.org/mailman/listinfo/mon


Re: Fwd: Re: Fwd: Re: Fwd: Re: getting mon to execute shell command

2010-04-26 Thread Jim Trocki

On Mon, 26 Apr 2010, ad...@jack-clan.nl wrote:


ok, i read a lot about setting paths in your bash profile but that isn't
what you mean i think,
a daemon is already active without a user logged in?

but when i look at my script i specify the path to gammu in the second
line :
that should be enough or am i thinking the wrong way?


#!/usr/bin/bash

echo servers down test | /usr/bin/gammu --sendsms TEXT 12345678


if it works when you do -d -f then from that shell do

echo $PATH

and put that path at the top of your bash script, e.g.

#!/usr/bin/bash

export PATH=/bin:/usr/bin:whatever


___
mon mailing list
mon@linux.kernel.org
http://linux.kernel.org/mailman/listinfo/mon


Fwd: Re: getting mon to execute shell command

2010-04-25 Thread admin


 Original Message 
Subject: Re: getting mon to execute shell command
Date: Sun, 25 Apr 2010 20:06:22 +0200
From: ad...@jack-clan.nl
To: Mahlon E. Smith mah...@martini.nu

Pffft nope still not working,

i tested the script by executing ./sms.alert, and that works ok

sms.alert:


#!/bin/sh

echo servers down test | /usr/bin/gammu --sendsms TEXT 0612345678

mon.cf:

alertdir   = /usr/lib/mon/alert.d
mondir = /usr/lib/mon/mon.d
logdir = /var/log/mon
histlength = 100


dtlogging   = yes
dtlogfile   = dtlog

hostgroup domain
domain.org

watch domain
service tcp
interval 1m
monitor tcp.monitor -p 16001
period
numalerts 2
alert sms.alert
upalert sms.alert






On Sun, 25 Apr 2010 10:38:00 -0700, Mahlon E. Smith mah...@martini.nu
wrote:
 On Sun, Apr 25, 2010, ad...@jack-clan.nl wrote:
 
 I changed the test.alert script so it reads this:
 
  #!/usr/bin/sh
 
 echo servers down test | gammu --sendsms TEXT 0653638072
 
 But it doesn't work
 
 
 Have you tried running that script yourself?  (Not the contents, but the
 script itself.)
 
 I don't know of any OS that stores sh in /usr/bin.  My bet is on
 /bin/sh.  :)
 
 --
 Mahlon E. Smith  
 http://www.martini.nu/contact.html

___
mon mailing list
mon@linux.kernel.org
http://linux.kernel.org/mailman/listinfo/mon


Re: Fwd: Re: getting mon to execute shell command

2010-04-25 Thread Jim Trocki

On Sun, 25 Apr 2010, ad...@jack-clan.nl wrote:


hostgroup domain
   domain.org

watch domain
   service tcp
   interval 1m
   monitor tcp.monitor -p 16001
   period
   numalerts 2
   alert sms.alert
   upalert sms.alert


you need to specify a period, such as wd {Sun-Sat}


period wd {Sun-Sat}
numalerts 2
alert sms.alert
upalert sms.alert

___
mon mailing list
mon@linux.kernel.org
http://linux.kernel.org/mailman/listinfo/mon


Fwd: Re: Fwd: Re: getting mon to execute shell command

2010-04-25 Thread admin
I changed it but still it ain't working.
When i use monshow  --showall it lists the fail and the alerts (2)
so that part i think is correct, is there any other log except
/var/log/mon where i can look for a clue?



 hostgroup domain
domain.org

 watch domain
service tcp
interval 1m
monitor tcp.monitor -p 16001
period hr {0-23}
numalerts 2
alert sms.alert
upalert sms.alert





___
mon mailing list
mon@linux.kernel.org
http://linux.kernel.org/mailman/listinfo/mon