[TriLUG] Unix RPC question ( maybe the OpenNMS people might know this one).

H Brett Bolen brettb at trilug.org
Wed Feb 4 10:57:44 EST 2004


summary:

Does anybody know how to limit the amount of time that linux
RPC's clnt_create() takes to detect that a host is not
running?


explanation:

I need to monitor a remote unix computer that we cannot control
( ie we can't put our software on this box).  Unix rup/rstat was
suggested, which uses Unix RPC ( and I know the dreaded portmapper).

I have code that is works, but I'm getting a long delay when calling
clnt_create().  You can see this by doing the following:


    time rup -h RUP_COMPUTER
    time rup -h NORUP_COMPUTER
    time rup -h NO_COMPUTER

where RUP_COMPUTER is a computer running rstatd ( rup server)
       NORUP_COMPUTER is a computer not running rstatd
       NO_COMPUTER is a computer on that is off.

       '-h' is due to a redhat rup bug ( in rh9 bugzilla)

here are my results

host with rstatd running, 2 ms.

> [brettb at orca stresslinux]$ time rup -h orca
> collecting responses...
> orca                     up   1 day,   2:53,    load average: 1.46 0.69 0.62
> 
> real    0m0.002s
> user    0m0.000s
> sys     0m0.000s

host with portmapper, but not rstatd, 3 ms.
> [brettb at orca stresslinux]$ time rup -h hare
> collecting responses...rup: hare: RPC: Program not registered
> 
> real    0m0.003s
> user    0m0.000s
> sys     0m0.010s

host that is turned off - 3001ms.
> [brettb at orca stresslinux]$ time rup -h pingo
> collecting responses...rup: pingo: RPC: Port mapper failure - RPC: Unable to receive
> 
> real    0m3.001s
> user    0m0.000s
> sys     0m0.000s
> [brettb at orca stresslinux]$

The delay is in clnt_create().  I have found no way to control how to set
this timeout.  There are some manpages for a client_create_timed(), but
this is not linux supported.  also there is a timeout in clntudp_create(),
but this is a timeout for the clnt_call(), not for the create.

The delay is always near 3.0 seconds.  I would like to reduce this
wait, so I can monitor more computers with less time.

Does anybody know how to limit the amount of time that clnt_create() takes
to detect that a host is not running?  This is not restricted to rstat,
any RPC program would have this issue.

interestingly:

> [brettb at orca stresslinux]$ telnet pingo 111
> Trying 192.168.9.107...
> telnet: Unable to connect to remote host: No route to host
> [brettb at orca stresslinux]$ time telnet pingo 111
> Trying 192.168.9.107...
> telnet: Unable to connect to remote host: No route to host
> 
> real    0m3.003s
> user    0m0.000s
> sys     0m0.000s
> [brettb at orca stresslinux]$

This is the same 3.0 second wait.


The code, in case anybody is interested,  can be found on the redhat
cd or rpmfind.net:

   rusers-0.17-25.i386.src.rpm

but you will need the server portion to test it.

   rusers-server




thanks.
  b²





-- 
b²

-----------------------
-- H Brett Bolen
-- TCNi
-- Phone: 919 550-0828
-- eFax : 443 535-8531






More information about the TriLUG mailing list