Script question

Meshuggah

22-04-2004 11:46:04

Hello,

I'm using scripts to know if some services are up or down. So I want to obtain a graph (aera) where the only states are 0 and 1.

So I did 2 scripts one for DNS service and another one for POP service. Both scripts are writen in perl and each script call another program to check the state of these services.
If the service is up the perl script returns 1 (print "1\n";) and if it's down it returns 0.

When I execute netmrg-gatherer -sm, it tells me that the value return by the script is 1 (because my service is up). But when I let netmrg checking that alone, it tells me that it's 0.

Why ? Is there any reason for that ? Did I need to change a parameter ? does the script take too much time ?

balleman

22-04-2004 17:35:46

That doesn't sound good... we'll work on reproducing it.

Could you post the relevant lines from the gatherer output?

Meshuggah

23-04-2004 03:17:08

Here it is

[code1df3a0a305c]

[Dev: 0002] [Sub: 0006] Starting Subdevice.
[Dev: 0002] [Sub: 0006] [Mon: 0044] Starting Monitor.
[Dev: 0002] [Sub: 0006] [Mon: 0044] Sending '/usr/local/libexec/netmrg/testDNS.pl xxx.xxx.xxx.xxx' to shell.
[Dev: 0002] [Sub: 0006] [Mon: 0044] Value: 1

[Dev: 0002] [Sub: 0008] Starting Subdevice.
[Dev: 0002] [Sub: 0008] [Mon: 0045] Starting Monitor.
[Dev: 0002] [Sub: 0008] [Mon: 0045] Sending '/usr/local/libexec/netmrg/testPop.pl xxx.xxx.xxx.xxx community' to shell.
[Dev: 0002] [Sub: 0008] [Mon: 0045] Value: 1

[Dev: 0002] [Sub: 0009] Starting Subdevice.
[Dev: 0002] [Sub: 0009] [Mon: 0041] Starting Monitor.
[Dev: 0002] [Sub: 0009] [Mon: 0041] Sending '/usr/local/libexec/netmrg/dispInt.pl xxx.xxx.xxx.xxx community 2' to shell.
[Dev: 0002] [Sub: 0009] [Mon: 0041] Value: 1

[/code1df3a0a305c]

Thanx to try to help me.

Meshuggah

23-04-2004 05:46:08

The previous lines are when I execute manually the netmrg-gatherer

here are the lines when netmrg does it alone

[code18c266632a9]

[Dev: 0002] [Sub: 0006] Starting Subdevice.
[Dev: 0002] [Sub: 0006] [Mon: 0044] Starting Monitor.
[Dev: 0002] [Sub: 0006] [Mon: 0044] Sending '/usr/local/libexec/netmrg/testDNS.pl xxx.xxx.xxx.xxx' to shell.
[Dev: 0002] [Sub: 0006] [Mon: 0044] Value: 0

[Dev: 0002] [Sub: 0008] Starting Subdevice.
[Dev: 0002] [Sub: 0008] [Mon: 0045] Starting Monitor.
[Dev: 0002] [Sub: 0008] [Mon: 0045] Sending '/usr/local/libexec/netmrg/testPop.pl xxx.xxx.xxx.xxx community' to shell.
[Dev: 0002] [Sub: 0008] [Mon: 0045] Value: 0

[Dev: 0002] [Sub: 0009] Starting Subdevice.
[Dev: 0002] [Sub: 0009] [Mon: 0041] Starting Monitor.
[Dev: 0002] [Sub: 0009] [Mon: 0041] Sending '/usr/local/libexec/netmrg/dispInt.pl xxx.xxx.xxx.xxx community 2' to shell.
[Dev: 0002] [Sub: 0009] [Mon: 0041] Value: 1

[/code18c266632a9]

silfreed

23-04-2004 10:55:30

What are the permissions on your scripts? What about your perl interpreter? Does the netmrg user have permission to execute them?

If all this is good, could you email your scripts to us (our emails are on the contact page here http//www.netmrg.net/contact.php) - after cleaning up anything sensitive, of course.

-Doug

silfreed

24-04-2004 13:30:49

> $cmdoutput = `./check_dns -H $host 2> /dev/null`;

This may be your problem; when netmrg runs from cron, it's root is probably either '/', or whatever it's homedir is. Try to put the full path to the command you're calling in and see if that helps.

-Doug