Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mrtg cfgmaker $target_name

Status
Not open for further replies.

selcuks2001

IS-IT--Management
Dec 8, 2001
50
TR
Hello all,
Is there a way to change the $target_name parameter of the *.cfg file by using the cfgmaker command.
It can be changed easily by entering the *.cfg file and edit it. I don't want it doing like that. I wanna do this with the cfgmaker command in single line. i.e. #cfgmaker <bla bla bla> > abc.cfg
Is there a way to do this? I am going nuts!!!
Greetings...
SSS
 
There are options to the cfgmaker command.

The one you are interested in (I think) is:

cfgmaker --output <mrtg config directory>/<filename>.cfg <hostname>

e.g:
cfgmaker --output /usr/local/mrtg-2/bin/ABC.cfg ROUTERNAME

if thats not what your looking for let me know.


If everything is coming your way then you're in the wrong lane.
 
Hello fynx...
With the command you have typed a *.cfg file is created. That's alright. But what I wanna do is different.
Well you have created a file with the name ABC.cfg. The inside of the ABC.cfg file is as follows:
Options[_]: bits, nopercent
RunAsDaemon: yes
EnableIPv6: no
WorkDir: /var/XSize[ROUTERNAME]: 500
YSize[ROUTERNAME]: 200
Background[ROUTERNAME]: #a0a0a0a

### Port 50 >> Descr: 'Summit48si-Port-50' | Name: '1/1' | Ip: '' | Eth: '' ###

Target[ROUTERNAME]: 5:public@192.168.4.10:
SetEnv[ROUTERNAME]: MRTG_INT_IP="" MRTG_INT_DESCR="Cisco xxx"
MaxBytes[ROUTERNAME]: 1250000
Title[ROUTERNAME]: Traffic Analysis for -- XXX
PageTop[ROUTERNAME]: <H1>Traffic Analysis for -- XXX</H1>
<TABLE>
<TR><TD>System:</TD> <TD>xxx</TD></TR>
<TR><TD>Maintainer:</TD> <TD>Cisco xxx</TD></TR>
<TR><TD>Description:</TD><TD>Cisco port 5</TD></TR>
<TR><TD>ifType:</TD> <TD>FE</TD></TR>
<TR><TD>ifName:</TD> <TD>5</TD></TR>
<TR><TD>Max Speed:</TD> <TD>100 Mbit/s</TD></TR>
</TABLE>

Well so far everything's ok. I want to change the parameter inside the brackets (here [ROUTENAME]). But I wanna do this with the cfgmaker command. Otherwise it is not hard to edit the ABC.cfg file and change the parameters inside the brackets ([ROUTERNAME])
Hopefully I could explain what is my problem.
 
You can parse the file and replace each instance of one word with another...

e.g.

cat config.cfg 's/ROUTERNAME/NEWNAME/' > newconfig.cfg

If everything is coming your way then you're in the wrong lane.
 
sorry, didn't type that correctly... should read:-

cat config.cfg | sed 's/ROUTERNAME/NEWNAME/' > newconfig.cfg

If everything is coming your way then you're in the wrong lane.
 
Hi fynx..
Thanks for your replies. As you showed me one of the ways it is not hard to edit the ABC.cfg file and change the parameters.
But I want that the "cfgmaker" command does it not me by editing the *.cfg file. I mean cfgmaker <bla bla bla> will change the parameter I have mentioned above [ROUTENAME].
I think that I couldn't explain my problem.
Anyways thanks for your replies again.
SSS
 
Hi,

cfgmaker is a PERL script which creates the [ROUTERNAME] using the hostname of the device and the interface name. If you pick your way through the script you can change the way cfgmaker creates the name to the way you want it.

What is it you are trying to achieve? there may be a much simpler way of doing it. cfgmaker has many options, which might do what you want.

If everything is coming your way then you're in the wrong lane.
 
Well I think that I have solved the problem without using cfgmaker command. But with cfgmaker I couldn't.
What I wanted to do was to write a script where the user enters his/her data to create the *.cfg files. But anyways. cfgmaker is over for me.
Greetings
SSS
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top