Andrei Cristian Niculae wrote:
> Hi all,
> 
> Damian Krzeminski wrote:
>> http://track.sipfoundry.org/browse/XCF-2348
>> I was thinking we could get even better though:
>>
>> - as Scott suggested in his e-mail 
>> (http://thread.gmane.org/gmane.comp.voip.sipx.devel/8351/focus=8661) 
>> the wrapper script should not be started by sipXconfig but by our 
>> process manager. You can probably check what he has done for 
>> callresolver-agent integration (all it requires is a that 
>> sipxconfig-mrtg RPM installs a proecess descriptor in 
>> /etc/sipxpbx/process.d there are many examples there. I think if you 
>> do that, the init script might be much simpler (or not needed at all) 
>> since it would not have to do everything that watchdog is doing 
>> already (for example dealing with PID files).
>>   
> I have a problem doing what Damian described here. I tried following the 
> examples at /etc/sipxpbx/process.d to create a new process descriptor,
> but I can't seem to get it right.
> 
> Here's what I've done:
> First I tried to run mrtg without a wrapper script, but this didn't seem 
> to works, since mrtg didn't want to start in a normal environment (it 
> needs env LANG=C) and if
> I provide env LANG=C to the watchdog command, it doesn't work.
> Then, I created a real simple wrapper script (attached to this mail, 
> sipxbridge.sh was my source of inspiration),
> and the watchdog starts mrtg successfully, but I get failure e-mails and 
> errors in sipxsupervisor.log
> 
> Mrtg is up and running:
> ps aux | grep mrtg
> andrei   21079  0.0  0.9  12588 10088 ?        Ss   16:51   0:00 
> /usr/bin/perl -w /usr/bin/mrtg --user andrei --group andrei 
> /home/andrei/work/git-work/git-BUILD/../git-installed-sipx/etc/sipxpbx/mrtg/mrtg.cfg
>  
> --lock-file 
> /home/andrei/work/git-work/git-BUILD/../git-installed-sipx/etc/sipxpbx/mrtg/mrtg.cfg.l
>  
> --confcache-file 
> /home/andrei/work/git-work/git-BUILD/../git-installed-sipx/etc/sipxpbx/mrtg/mrtg.cfg.ok
>  
> --pid-file 
> /home/andrei/work/git-work/git-BUILD/../git-installed-sipx/var/run/sipxpbx/sipx-mrtg.pid
>  
> 
> 
> the pid file is ok:
> cat ./var/run/sipxpbx/sipx-mrtg.pid
> 21079
> 
> and  ./etc/init.d/sipxpbx status returns:
> Checking sipx-mrtg:                                        [  OK  ]
> 
> I keep getting this in sipxsupervisor.log:
> "2008-06-12T14:11:45.997825Z":36:PROCESSMGR:ERR:andrein.itcnetworks.ro::B740DB90:WatchDog:"OsProcessMgr::getAliasState
>  
> 'Mrtg' DOES NOT HAVE a valid PID"
> "2008-06-12T14:11:45.998002Z":37:WATCHDOG:WARNING:andrein.itcnetworks.ro::B740DB90:WatchDog:"Process
>  
> Mrtg found in non-running state. (Waiting for it to start)."
> "2008-06-12T14:11:50.998267Z":38:WATCHDOG:WARNING:andrein.itcnetworks.ro::B740DB90:WatchDog:"Process
>  
> Mrtg found in non-running state (it was in STARTING state for more than 
> 5 seconds)."
> "2008-06-12T14:11:50.999495Z":39:WATCHDOG:NOTICE:andrein.itcnetworks.ro::B740DB90:WatchDog:"Process
>  
> Mrtg [started]"
> 
> and after some time, I get this:
> "2008-06-12T12:32:48.946567Z":45:PROCESSMGR:ERR:andrein.itcnetworks.ro:HttpConnection-5:B7237B90:WatchDog:"OsProcessMgr::getProcessByAlias
>  
> non-integer pid 'FAILED' for alias 'Mrtg'"
> and lost os these:
> "2008-06-12T11:52:49.232576Z":81:PROCESSMGR:ERR:andrein.itcnetworks.ro::B7429B90:WatchDog:"OsProcessMgr::getProcessByAlias
>  
> non-integer pid 'FAILED' for alias 'Mrtg'"
> 
> I'm guessing the second and third is because sipXconfig asks 
> sipXsupervisor to stop Mrtg (that's the way I made it).
> I think that when sipxsupervisor tries to restart mrtg, mrtg does not 
> start because 2 mrtg processes cannot use the same cfg file, so the 
> second one does not start.
> 
> 
> Anyway, afterwards, when I do ./etc/init.d/sipxpbx stop, i get:
> sudo ./etc/init.d/sipxpbx stop
> Stopping apache:
> Stopping sipXpbx:
> [...]
>  Stopping: sipxcallresolver-agent (Not started)
>  Stopping: sipxcallresolver
>  Stopping: sipxconfig
>  Stopping: sipx-mrtg
> [...]
>  Confirm Stop: sipxcallresolver-agent (Not started)       [  OK  ]
>  Confirm Stop: sipxcallresolver                           [  OK  ]
>  Confirm Stop: sipxconfig                                 [  OK  ]
>  Confirm Stop: sipx-mrtg (Not started)                    [  OK  ]
> 
> And it actually stops mrtg. (no more mrtg process)
> 
> You can find attached the start-up script and the process.xml file, both 
> in .in form.
> @MRTG_BINARY@ should point to /usr/bin/mrtg
> 
> So ... what am I doing wrong? Is there anything else I should do?
> 
> Thanks in advance,
> Andrei
> 
> p.s. there's something else that's strange. After mrtg starts running, 
> it appears that two processes are starting up:
> [EMAIL PROTECTED] git-installed-sipx]$ cat ./var/run/sipxpbx/sipx-mrtg.pid
> cat: ./var/run/sipxpbx/sipx-mrtg.pid: No such file or directory
> 
[...]

Not sure if I can help much here, but it looks like all this problems are 
related to the fact that pid file either does contain the mrtg pid. 
Specifically 
does not contain the pid that can be used to stop MRTG or verify if it's 
running.

One thing that I noticed is that you start MRTG like that:

MRTG_BIN --user $SIPXPBXUSER --group $SIPXPBXGROUP $MRTG_CONFIG_FILE 
--lock-file 
$MRTG_CONFIG_FILE.l --confcache-file $MRTG_CONFIG_FILE.ok --pid-file 
$MRTG_PID_FILE

but mrtg manual page suggests that --pid-file option is only relevant if MRTG 
runs in a daemon mode (--daemon).

D.



_______________________________________________
sipx-dev mailing list
[email protected]
List Archive: http://list.sipfoundry.org/archive/sipx-dev
Unsubscribe: http://list.sipfoundry.org/mailman/listinfo/sipx-dev

Reply via email to