[mrtg] Help with script into config file
McDonald, Dan
Dan.McDonald at austinenergy.com
Thu Mar 26 13:52:44 CET 2009
On Thu, 2009-03-26 at 08:33 -0400, Frank Misak wrote:
> Hi Dan,
> I'm not sure how to use your template.
cfgmaker --host-template=ups.template hermes at ups.ip.addr
> Also, I will try to adjust my
> script to produce the 3 power legs and the total (giving me 4
> variables),
not 4 variables, 4 lines. Per the mrtg-reference doc:
External Monitoring Scripts
If you want to monitor something which does not provide
data via snmp you can use some external program to do
the data gathering.
The external command must return 4 lines of output:
Line 1
current state of the first variable, normally 'incoming
bytes count'
Line 2
current state of the second variable, normally 'outgoing
bytes count'
Line 3
string (in any human readable format), telling the
uptime of the target.
Line 4
string, telling the name of the target.
> but what would my cfg file look like (what would make
> sense)? Thanks for your help,
See below how I hacked up your script...
>
> Frank
>
>
>
> -----Original Message-----
> From: mrtg-bounces at lists.oetiker.ch
> [mailto:mrtg-bounces at lists.oetiker.ch] On Behalf Of McDonald, Dan
> Sent: Wednesday, March 25, 2009 9:12 AM
> To: mrtg at lists.oetiker.ch
> Subject: Re: [mrtg] Help with script into config file
>
> On Wed, 2009-03-25 at 08:51 -0400, Frank Misak wrote:
> > Hi all,
> >
> >
> >
> > I am polling some Liebert UPS units and have created a script to poll
> > the 3 necessary OID's then produce a total (total AMP draw) however I
> > cannot figure out how to make the MRTG .cfg file work.
>
> I have a template that does pretty well with most Lieberts... It's
> posted at
> http://www.steveshipway.org/forum/viewforum.php?f=34&st=0&sk=t&sd=d&star
> t=0
>
>
> > I keep getting a *.cfg_l file but not sure what the problem is. Can
> > someone assist?
> You need to return 4 values from your script. You are currently
> returning one.
>
>
> > ##Script##
> > #!/bin/ksh
> >
> > IPS="10.10.180.45 10.10.180.46"
> > OIDS="1.3.6.1.4.1.476.1.42.3.5.2.3.1.6.3.1 \
> > 1.3.6.1.4.1.476.1.42.3.5.2.3.1.6.3.2 \
> > 1.3.6.1.4.1.476.1.42.3.5.2.3.1.6.3.3"
> >
> > TOTAL=0
> >
> > for IP in $IPS; do
> > for OID in $OIDS; do
> > OUT=`snmpwalk -v1 -c hermes $IP .$OID`
> > INC=`echo $OUT |awk '{FS=":"}{print $4}'`
> > TOTAL=`expr $TOTAL + $INC`
> > done
> > done
> >
> > echo $TOTAL
> echo $TOTAL
> echo `date`
> echo '';
>
> >
> > ##Here is the MRTG config file which doesn't work##
> > Target[mo22_lieberts]: `/usr/local/mrtg-2/bin/mo22_lieberts.sh`
> > MaxBytes[mo22_lieberts]: 3000
> > Options[mo22_lieberts]: growright, gauge, perminute, nobanner,
> > withzeroes, nolegend
> add noo to the list of options.
>
>
> >
> --
> Daniel J McDonald, CCIE #2495, CISSP #78281, CNX Austin Energy
> http://www.austinenergy.com
>
> >
>
> This communication, including attachments, is for the exclusive use of addressee and
> may contain proprietary, confidential and/or privileged information. If you are not
> the intended recipient, any use, copying, disclosure, dissemination or distribution
> is strictly prohibited. If you are not the intended recipient, please notify the sender
> immediately by return e-mail, delete this communication and destroy all copies.
>
--
Daniel J McDonald, CCIE #2495, CISSP #78281, CNX
Austin Energy
http://www.austinenergy.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : http://lists.oetiker.ch/pipermail/mrtg/attachments/20090326/dfba7d68/attachment-0001.bin
More information about the mrtg
mailing list