[mrtg] Re: mrtg and remote scripts for linux.....

Bjorn Nordbo bn at nextra.com
Tue Sep 12 15:36:32 MEST 2000


Jelle Beusen wrote:
> I am stuck now as I have no rsh or what ever anybody ideas on how
> to get this to work maybe someone has it and wants to share the script....
> 
> at this time I get the stats for the local linux box where mrtg is
> running on by ding netstat -i | awk etc etc etc....
> 
> I have this for my target and I know I would need a script of some form
> to get this to go on remote systems but for my life I can not figure out
> how ....

You can get remote data from a server by simply starting a script
that gives 4 lines of MRTG data on standard out from inetd. Ie.

mrtg stream tcp nowait nobody /local/sbin/tcpd /local/mrtg/bin/load

and a line like this in /etc/services:

mrtg 1020/tcp

and a script like this in /local/mrtg/bin/load:

---8<---
#!/local/bin/perl -w

use strict;

my $uptime_command = '/local/gnu/bin/uptime';
my $r = `$uptime_command` or die "Can't execute $uptime_command: $!\n";

my ($l5, $l15) = ($r =~ /load average:\s+\d+\.\d+,\s+(\d+\.\d+),\s+(\d+\.\d+)/);
print "$l5\n$l15\n0\n0\n";
---8<---

This would solve your problems, if I understood you right.

BTW, your message is difficult to read. Please limit your line length
to around 72 characters.

-- 
Bjørn Nordbø  -  IP Development  -  Nextra Norway

--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
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



More information about the mrtg mailing list