BB Unix Network Monitor - Message

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

Re: {bb} bbgen and DOCURL and bb-csvinfo.cgi



In <9B3C0C86BE46BF499B7B8E10E397F6C014BEDC@s2h3118r> <U.Kirbach@enbw.com> writes:

>your new bbgen 2.16 is very useful.
>Especially for internal documentation the bb-csvinfo suite.
>Thank you very much for that.

You're welcome - it was so easy to do, so I am glad that it
is useful.

> is it possible to enhance the docurl feature for bbgen to have also
>host specific docurls beside the standard docurl via command line?
>for example in BBHOME/etc/bb-hosts

>10.10.192.1 host1 # DOCURL="$CGIBINURL/bb-csvinfo.sh?db=hostinfo.csv&key=%s"
># no DOCURL - using standard docurl from command line
>10.10.192.2 host2 #

I would prefer to keep this in the CGI script, rather then building it
into bbgen. The current setup is simple and flexible - I prefer to
keep it that way.

And you already have tools that can do pretty much what you want.

Instead of putting the database-name in the URL, just make the doc-
link go to a CGI script which gets only the hostname as parameter, e.g
run bbgen with "--docurl=$CGIBINURL/myinfoscript.sh?%s" 

If you then put a "DOCDB=file1.csv" tag in the bb-hosts file, you
can pickup that tag from your "myinfoscript.sh" script and pass it
off to the bb-csvinfo.cgi script yourself. Like this:

#!/bin/bash

# Pick up the BB environment
BBHOME=/usr/local/bb
export BBHOME
. $BBHOME/etc/bbdef.sh

# CGI provides $QUERY_STRING, which is the hostname
HOSTNAME="$QUERY_STRING"

# Pick a database to use from the DOCDB=filename tag
# in the bb-hosts file.
# bbhostgrep picks all the host with a DOCDB tag,
# so we can just grep for our host and the DOCDB
# tag will be item 4.
#
DOCDB=`$BBHOME/bin/bbhostgrep --noextras "DOCDB=*" | \
    grep "$HOSTNAME" | awk '{print $4}' | sed 's/DOCDB=//'`

# Now use the bb-csvinfo to generate the HTML page.
# bb-csvinfo.cgi is normally run via CGI, but you
# can run it just fine as long as you setup the
# QUERY_STRING environment with the parameters it needs.
# Below, if $DOCDB is not set (because the host didnt
# have a DOCDB tag), default to the "defaultdb.csv" file.
#
QUERY_STRING="key=$HOSTNAME&db=${DOCDB:-defaultdb.csv}"
export QUERY_STRING
exec $BBHOME/bin/bb-csvinfo.cgi

--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=
To unsubscribe from this list, or to subscribe to the bb-digest list
send e-mail to mailto:majordomo@bb4.com with unsubscribe bb -and/or-
subscribe bb-digest in the BODY of the message.


Home | Main Index | Thread Index