Date: Fri, 29 Oct 2004 17:50:28 +0800 From: "Spades" <spades@galaxynet.org> To: <gerard@gedads.com> Cc: freebsd-questions@freebsd.org Subject: Re: MRTG monitoring specific ports Message-ID: <024801c4bd9c$b91a1a60$0300a8c0@astral>
next in thread | raw e-mail | index | archive | help
I have pasted the Error: # /usr/local/mrtg-2/bin/mrtg /home/www/mojito.purplecards.com/mrtg/cfg/mrtg.cfg 3: not found WARNING: Problem with External get '/usr/local/etc/mrtg/ipfwmrtg.php 2 3': Expected a Number for 'in' but got '' 5: not found WARNING: Problem with External get '/usr/local/etc/mrtg/ipfwmrtg.php 4 5': Expected a Number for 'in' but got '' 7: not found WARNING: Problem with External get '/usr/local/etc/mrtg/ipfwmrtg.php 6 7': Expected a Number for 'in' but got '' 9: not found WARNING: Problem with External get '/usr/local/etc/mrtg/ipfwmrtg.php 8 9': Expected a Number for 'in' but got '' ERROR: Target[smtp][_IN_] ' $target->[1]{$mode} ' did not eval into defined data ERROR: Target[pop3][_IN_] ' $target->[2]{$mode} ' did not eval into defined data ERROR: Target[http][_IN_] ' $target->[3]{$mode} ' did not eval into defined data ERROR: Target[dns][_IN_] ' $target->[4]{$mode} ' did not eval into defined data ----- Original Message ----- From: "Spades" <spades@galaxynet.org> To: <gerard@gedads.com> Cc: <freebsd-questions@freebsd.org> Sent: Friday, October 29, 2004 5:46 PM Subject: Re: MRTG monitoring specific ports > Thanks, i think its well done, but i couldn't get it to work. > I have refreshed the mrtg page but doesn't seem to have the lines. > > See http://mojito.purplecards.com/mrtg > > http://mojito.purplecards.com/ipfwmrtg.php (you told me to create) > > # cat mrtg.cfg | grep gerard@gedads.com > > # ipfw -at list > 00002 0 0 count tcp from me 25 to any > 00003 0 0 count tcp from any to me 25 > 00004 0 0 count tcp from me 110 to > any > 00005 0 0 count tcp from any to me > 110 > 00006 0 0 count tcp from me 80 to any > 00007 0 0 count tcp from any to me 80 > 00008 0 0 count udp from me 53 to any > 00009 0 0 count udp from any to me 53 > 65535 138410 17490211 Fri Oct 29 17:44:31 2004 allow ip from any to any > > I have php.4.39 installed, please advise, thanks. > > Spades > > ----- Original Message ----- > From: "Gerard D." <gedads@gmail.com> > To: "Spades" <spades@galaxynet.org> > Sent: Thursday, October 28, 2004 2:50 PM > Subject: Re: MRTG monitoring specific ports > > >> I'm sure theres something better out there.. but heres a little script >> I threw togethor a long long long time ago for use on my webservers.. >> I know its nasty and could easily be done in a better language but i'm >> lazy as hell.. anyway it assumes you have ipfw support enabled and the >> command line version of php installed. >> >> /******************* start ipfwmrtg.php *********/ >> #!/usr/local/bin/php >> <?php >> $ipfw_out = shell_exec("ipfw show ".$_SERVER['argv'][1]." >> ".$_SERVER['argv'][2]); >> $regexp = "/([\d]+)[\s]+([\d]+)[\s]+([\d]+)[\s]+.+/"; >> $ipfw = split("\n", $ipfw_out); >> >> foreach($ipfw as $pp) { >> preg_match($regexp, $pp, $out); >> $tmp[] = $out[3]; >> } >> //print_r($tmp); >> //echo "fdc-bw 1 $tmp[1] $tmp[0] 0 0"; >> echo $tmp[1]."\n"; >> echo $tmp[0]."\n"; >> echo "1"."\n"; >> echo "name"."\n"; >> /************** end ipfwmrtg.php ***************/ >> >> /////////////////// code that goes in your mrtg.cfg >> Title[smtp]: smtp total stats >> Target[smtp]: `/usr/local/etc/mrtg/ipfwmrtg.php 2 3` >> MaxBytes[smtp]: 15000000 >> PageTop[smtp]: <h1>smtp</h1> >> >> Title[pop3]: pop3 total stats >> Target[pop3]: `/usr/local/etc/mrtg/ipfwmrtg.php 4 5` >> MaxBytes[pop3]: 15000000 >> PageTop[pop3]: <h1>pop3</h1> >> >> Title[http]: http total stats >> Target[http]: `/usr/local/etc/mrtg/ipfwmrtg.php 6 7` >> MaxBytes[http]: 15000000 >> PageTop[http]: <h1>http</h1> >> >> Title[dns]: dns total stats >> Target[dns]: `/usr/local/etc/mrtg/ipfwmrtg.php 8 9` >> MaxBytes[dns]: 15000000 >> PageTop[dns]: <h1>dns</h1> >> ////////////////// end code for mrtg.cfg >> >> so anyway now that you have the code you'll need to add a couple ipfw >> rules.. >> >> something like >> >> ipfw add 2 count tcp from me 25 to any >> ipfw add 3 count tcp from any to me 25 >> >> ipfw add 4 count tcp from me 110 to any >> ipfw add 5 count tcp from any to me 110 >> >> ipfw add 6 count tcp from me 80 to any >> ipfw add 7 count tcp from any to me 80 >> >> ipfw add 8 count udp from me 53 to any >> ipfw add 9 count udp from any to me 53 >> >> would count all traffic going out of your server on port 25 and the >> second line would count all inbound traffic to your server on port >> 25.. >> You can add as many rules as you'd like just change the numbers for >> each new rule.. You will also need to update the #'s for the new rules >> in the Target[]: line that goes into mrtg.conf >> Okay Well i'm not good at explaining things.. I hope this can help >> you. good luck >> -Gerard >> >> >> >> On Thu, 28 Oct 2004 02:15:09 +0800, Spades <spades@galaxynet.org> wrote: >>> Hi, >>> >>> Is there anyway for us to trace the server bandwidth based on >>> specific ports on a MRTG graph? >>> >>> Such as smtp bandwidth? port 25 >>> pop3 bandwidth? port 110 >>> web bandwidth? port 80 >>> dns bandwidth? port 53 >>> >>> Is there any program or can MRTG do, please advise, thanks. >>> >>> -- >>> Spades >>> >>> _______________________________________________ >>> freebsd-questions@freebsd.org mailing list >>> http://lists.freebsd.org/mailman/listinfo/freebsd-questions >>> To unsubscribe, send any mail to >>> "freebsd-questions-unsubscribe@freebsd.org" >>> >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?024801c4bd9c$b91a1a60$0300a8c0>