[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [hobbit] can we monitor radius services using hobbit ???



On Wed, Mar 29, 2006 at 03:00:31PM +0530, cisco wrote:
> 
> Well I am using hobbit for large scale around hundreds of routers and
> more than other devices...it is working pretty fine...and really
> amazing...I can feel POWER of Open Source...
> I have one query that " Do we monitor radius services ? " like
> Freeradius and any professional radius sever  which is listening on
> 1812 & 1813 Port ...

For a simple "is it listening on port 1812", you can configure a
simple port check in the bb-services file, e.g.

   [radius1]
   	port 1812

   [radius2]
   	port 1813

and then just use "radius1" and "radius2" in the bb-hosts file.


A better solution would be to write an extension script to perform
a simple Radius query. Looking at the Freeradius man-pages, it
would seem that you could use the "radclient" utility included in
Freeradius to do simple queries - see
   http://linuxcommand.org/man_pages/radclient1.html
where there's an example of querying a server. You could easily
wrap this into an extension script, e.g.

  #!/bin/sh

  COLOR=green
  COLUMN=radius
  RADIUSUSER=fnord
  RADIUSSECRET=s3cr3t
  TIMEOUT=10

  bbhostgrep radius |
  while read L
  do
     set $L
     IP="$1"
     HOSTNAME="$2"

     radclient -t $TIMEOUT $IP 12 $RADIUSSECRET >$BBTMP/radius <<EOF
User-Name = $RADIUSUSER
EOF

     if test $? -ne 0
     then
        COLOR=red
	MSG="Radius query failed"
     else
        COLOR=green
	MSG="Radius query succeeded

`cat $BBTMP/radius.out`
"
     fi

     $BB $BBDISP "status $HOSTNAME.$COLUMN $COLOR `date`

     $MSG"
  done

  exit 0

(this is untested, since I dont have a radius server at hand.
But all of this except the "radclient" command is completely
standard Hobbit scripting).

Save this script to ~hobbit/server/ext/radiustest.sh, then
add a new section to hobbitlaunch.cfg to run this script every
5 minutes. To trigger it, you add a "radius" tag to the relevant
hosts in the bb-hosts file.

To test it, you can run the script by hand with
   bbcmd ~hobbit/server/ext/radiustest.sh
or with shell tracing enabled
   bbcmd sh -x ~hobbit/server/ext/radiustest.sh


Henrik