Fwd: Re: getting mon to execute shell command

2010-04-26 Thread admin
well, i copied the script to the test.alert file, but there is no log
created in /tmp.
showmon gives 2 fails and 2 alerts..
I changed the owner from root to mon (alert scripts) and chmod 777 on them

Still no luck...
I don't know if could have something to do with ubuntu? (i tried it with
8.04 and 9.10 server) both the same problem!





 Original Message 
Subject: Re: getting mon to execute shell command
Date: Mon, 26 Apr 2010 07:36:24 +0200
From: Beat Jucker 
To: mon@linux.kernel.org

> > 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

To trace your problem I would enhance the monitor script and
check the log. Maybe there is something wrong in MON PATH
(not finding gammu)?

#!/usr/bin/sh

exec 2>> /tmp/smsmonitor.log
echo "MON: $0 $* @ `date`" >&2

echo "servers down test" | gammu --sendsms TEXT 0653638072

> 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.  :)

wrong assumption - e.g. real unix ;-) like solaris:

$ type sh
sh is a tracked alias for /usr/bin/sh
$ ls -ld /bin /usr/bin
lrwxrwxrwx   1 root root   9 Apr 28  2004 /bin -> ./usr/bin
drwxr-xr-x   4 root bin13824 Jul  7  2008 /usr/bin


Regards
-- Beat

___
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-26 Thread Kastus Shchuka
On Mon, Apr 26, 2010 at 06:14:06PM +0200, ad...@jack-clan.nl wrote:
> well, i copied the script to the test.alert file, but there is no log
> created in /tmp.
> showmon gives 2 fails and 2 alerts..
> I changed the owner from root to mon (alert scripts) and chmod 777 on them
> 
> Still no luck...
> I don't know if could have something to do with ubuntu? (i tried it with
> 8.04 and 9.10 server) both the same problem!


Have you tried adding some standard alert to your watch, like mail.alert
alongside with your sms.alert? I would start with standard alert to see if 
it is executed at time of service failure.

___
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-26 Thread Jim Trocki

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


well, i copied the script to the test.alert file, but there is no log
created in /tmp.
showmon gives 2 fails and 2 alerts..
I changed the owner from root to mon (alert scripts) and chmod 777 on them

Still no luck...


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


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


getting mon to execute shell command

2010-04-26 Thread admin

ok, let me google that,

thanks everybody for brainstorming

 
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


getting mon to execute shell command

2010-04-26 Thread admin
nope still not working,

tested it with mon -d, then it works, not with daemon.


#!/bin/bash

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






___
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