Hi Corey, partly right ;-) I would like to pass that variable through cfgmaker to the template. In the template I would like to do (in pseudocode):
if CPU=1 then target target[CPU] ... (1 Line in the Graph for CPU 1) if CPU=2 then target target[CPU] ... (2 Lines in the Graph for CPU 1 and 2) if CPU=4 then target target[CPU] ... (1 Line for all CPUs) The Docu says that a template is a Perl program - so I need a way to access $CPU from within this Perl program. Thanks for your help Thomas -----Ursprüngliche Nachricht----- Von: Fruitman, Corey [mailto:[EMAIL PROTECTED] Gesendet: Mittwoch, 17. März 2004 21:48 An: Rupp Thomas; [EMAIL PROTECTED] Betreff: RE: [mrtg] Accessing Shell Variables in Template You have a shell script that assigns a value to the variable "CPU" then you want to pass the value of that variable to cfgmaker, right? Just put a dollar sign ($) before your variable name in the script and the shell will substitute it with the value. This doesn't have anything to do with Perl (or MRTG). Let's assume you want to use bash as your shell. Try this: #!/bin/bash CPU=4 /path/to/cfgmaker --host-template=$CPU.tmpl [...] Your template will have to be named "4.tmpl" and be located in the same directory as where you're executing cfgmaker. Should do the trick. Hope that helps, Corey. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of [EMAIL PROTECTED] Sent: March 17, 2004 2:47 PM To: [EMAIL PROTECTED] Subject: [mrtg] Accessing Shell Variables in Template Hi MRTG-gurus, I try to create different config files using --host-template depending on the number of CPUs a server has. I have the following shell script CPU = 4 cfgmaker --host-template=... What do I have to do to access the Variable CPU in the template? I know absolutely nothing about Perl so would be very grateful for any help Thanks in advance Thomas Rupp -- Unsubscribe mailto:[EMAIL PROTECTED] Archive http://www.ee.ethz.ch/~slist/mrtg FAQ http://faq.mrtg.org Homepage http://www.mrtg.org WebAdmin http://www.ee.ethz.ch/~slist/lsg2.cgi -- Unsubscribe mailto:[EMAIL PROTECTED] Archive http://www.ee.ethz.ch/~slist/mrtg FAQ http://faq.mrtg.org Homepage http://www.mrtg.org WebAdmin http://www.ee.ethz.ch/~slist/lsg2.cgi
