how to echo system.sysDescr.0 in the output html

4 messages Options
Embed this post
Permalink
veer () how to echo system.sysDescr.0 in the output html
Reply Threaded More More options
Print post
Permalink
Hello,

I want to echo the current value for system.sysDescr.0 into the html output file but cannot get it to work.
In fact i don't know how to get it done :)

if i do snmpget -v 2c -c secret myhost system.sysDescr.0 | cut -c34-120
i get a lovely line with the exact string i want to be echoed in the html page.

Has anyone done this or something similar and can give me a pointer what i should be doing to make this work?

Thanks a lot for any input,
Jeroen
S Shipway () Re: how to echo system.sysDescr.0 in the output html
Reply Threaded More More options
Print post
Permalink
> I want to echo the current value for system.sysDescr.0 into the html
> output
> file but cannot get it to work.
> In fact i don't know how to get it done :)

You could set up code to extract this value and put it into the PageTop or PageFoot and put this into a host template that you use with cfgmaker when you create the .cfg file for MRTG.  

There's no way to get it to be polled and output in addition to the data.

There are new features in v2.21beta2 of the Routers2 frontend to allow generic OIDs or output from external scripts to be added as symbols in headers and footers, which would achieve what you want, but this is not yet in production.

Steve

_______________________________________________
mrtg mailing list
[hidden email]
https://lists.oetiker.ch/cgi-bin/listinfo/mrtg
veer () Re: how to echo system.sysDescr.0 in the output html
Reply Threaded More More options
Print post
Permalink

S Shipway wrote:
> I want to echo the current value for system.sysDescr.0 into the html
> output
> file but cannot get it to work.
> In fact i don't know how to get it done :)

You could set up code to extract this value and put it into the PageTop or PageFoot and put this into a host template that you use with cfgmaker when you create the .cfg file for MRTG.  

There's no way to get it to be polled and output in addition to the data.
I'll be happy to echo something into the PageTop, will serve my needs for now.
Could you elaborate on what code i would need to put where to accomplish that?

I have tried various stuff including calling scripts from the PageTop directly, but it will just echo whatever i put in there. I can only imagine i need to put a var in there, but how do i get it to be read by the host template?

Thanks for your input,

Jeroen
S Shipway () Re: how to echo system.sysDescr.0 in the output html
Reply Threaded More More options
Print post
Permalink
> >> I want to echo the current value for system.sysDescr.0 into the html
> >> output
> >> file but cannot get it to work.
> >> In fact i don't know how to get it done :)
> >
> > You could set up code to extract this value and put it into the PageTop
> or
> > PageFoot and put this into a host template that you use with cfgmaker
> when
> > you create the .cfg file for MRTG.
>
> I'll be happy to echo something into the PageTop, will serve my needs for
> now.
> Could you elaborate on what code i would need to put where to accomplish
> that?

You'll need to put Perl code in the cfgmaker interface template.   Read up on the cfgmaker documentation for this... and of course you'll need to be adequately good at perl coding.  I don't have the itme to write the whole thing for you though!  Take a look at the sample templates in the template library at http://www.steveshipway.org/cfgmaker

> I have tried various stuff including calling scripts from the PageTop
> directly, but it will just echo whatever i put in there. I can only
> imagine
> i need to put a var in there, but how do i get it to be read by the host
> template?

If you are using MRTG/RRD with Routers2 then you can put vars in the Pagetop, and later versions of routers2 let you put in Includes and even external execs which would achieve this by a long route.  The difference is if you want this value to be re-polled each time you look, or if it is sufficient to just poll it once when you initially set up the MRTG configuration file (IE by using cfgmaker templates)

Steve

_______________________________________________
mrtg mailing list
[hidden email]
https://lists.oetiker.ch/cgi-bin/listinfo/mrtg