Welcome,
Guest
. Please
login
or
register
.
03-21-2010, 20:56:55
TorrentFlux Home
|
TorrentFlux Hosting
TorrentFlux Forums
Code Hacks and Tools
TorrentFlux 2.1 Hacks
MRTG-Graph-hack
« previous
next »
Pages:
1
[
2
]
3
4
5
Author
Topic: MRTG-Graph-hack (Read 17843 times)
b4rt
Hero Member
Offline
TF Base: Linux 2.x
Posts: 543
Re: MRTG-Graph-hack [Update: Another Example for an additional Graph]
«
Reply #15 on:
05-02-2006, 18:54:34 »
from what i know/see from your problem (graph with 0-line) my first ideas :
(i assume there is everything "ok" with mrtg/rateup-logs as this would have been noticed on setup (eg mrtg not able to update his logs))
ensure there is really traffic atm
ensure enough time (some runs) passed
ensure cron-job is invoked every 5 mins (wo errors)
ensure fluxpoller.pl does things right (try a '
/usr/local/bin/fluxpoller.pl traffic /usr/local/torrent mrtg
' and check output)
double-check
mrtg.flux.conf
for errors/typos (multiplier wrong or whatever)
regards,
b4rt
Logged
torrentflux-b4rt svn-trunk
Linux 2.4.34.1, Apache 2.0.59, PHP 4.4.5, Perl 5.8.8, Python 2.5, MySQL 4.1.22
kanchke
Newbie
Offline
Posts: 24
Re: MRTG-Graph-hack [Update: Another Example for an additional Graph]
«
Reply #16 on:
05-03-2006, 11:17:55 »
b4rt,
sorry for the late reply, xbox had me hooked for a couple of days
anyway, your command
Code:
netstat -e -n 2> /dev/null | grep -v root | grep -v 127.0.0.1
gave no results, instead I used
Code:
sudo netstat -a -n 2> /dev/null | grep <my.eth.ip.address>
And I cleanly obtain my torrent connections ... what's next ?
Or can I simply disable the connections-polling ? As previously mentioned the traffic is most important to me.
thanx,
k.
Logged
P3 733 | FreeBSD6.0 | 128MB RAM
Lighttpd 1.4.11 | PHP 5.1.2 (cgi-fcgi) | Postgres8.1 | Python 2.3.4
TF 2.1 w/ AJAX on indexpage| MRTG statistics
b4rt
Hero Member
Offline
TF Base: Linux 2.x
Posts: 543
Re: MRTG-Graph-hack [Update: Another Example for an additional Graph]
«
Reply #17 on:
05-03-2006, 18:43:52 »
Quote from: kanchke on 05-03-2006, 11:17:55
anyway, your command
Code:
netstat -e -n 2> /dev/null | grep -v root | grep -v 127.0.0.1
gave no results,
no results means ?
error finding netstat ? bad netstat-params ? or just not the expected result : the connection-lines.
Quote from: kanchke on 05-03-2006, 11:17:55
instead I used
Code:
sudo netstat -a -n 2> /dev/null | grep <my.eth.ip.address>
And I cleanly obtain my torrent connections ... what's next ?
because tornados and
fluxpoller.pl
where started by the user running your webserver sudo shouldnt be needed.
i see you used the
-a
switch in this and no
-e
switch.
because the "parser" (lol) in
fluxpoller.pl
expects a extended netstat-output (with
-e
switch) this sure wont work.
to debug this further i need output of a netstat-call.
Quote from: kanchke on 05-03-2006, 11:17:55
Or can I simply disable the connections-polling ? As previously mentioned the traffic is most important to me.
of course. you can have 1 to n Graphs. its up to you how many graphs you have defined in your mrtg-config-file
mrtg.flux.cfg
.
so if you dont want the connections-graph (-> no more connections-polling) just delete/comment all the lines belonging to the connections-target. (the second, below traffic-target)
note: if Graphs of a target where already made you should delete the output (the .inc-file and the pngs) in the mrtg-dir (that below your docroot) or my
mrtg.php
will still show you these "old Graphs" even after you have deleted the targets from
mrtg.flux.cfg
.
regards,
b4rt
Logged
torrentflux-b4rt svn-trunk
Linux 2.4.34.1, Apache 2.0.59, PHP 4.4.5, Perl 5.8.8, Python 2.5, MySQL 4.1.22
kanchke
Newbie
Offline
Posts: 24
Re: MRTG-Graph-hack [Update: Another Example for an additional Graph]
«
Reply #18 on:
05-04-2006, 05:40:12 »
Code:
netstat -e -n 2> /dev/null | grep -v root | grep -v 127.0.0.1
just displays no results at all
I used -a because -e apparently is a illegal option on my system
Code:
netstat -e
netstat: illegal option -- e
usage: netstat [-AaLnSW] [-f protocol_family | -p protocol]
[-M core] [-N system]
netstat -i | -I interface [-abdhnt] [-f address_family]
[-M core] [-N system]
netstat -w wait [-I interface] [-d] [-M core] [-N system]
netstat -s [-s] [-z] [-f protocol_family | -p protocol] [-M core]
netstat -i | -I interface -s [-f protocol_family | -p protocol]
[-M core] [-N system]
netstat -m [-M core] [-N system]
netstat -r [-AenW] [-f address_family] [-M core] [-N system]
netstat -rs [-s] [-M core] [-N system]
netstat -g [-W] [-f address_family] [-M core] [-N system]
netstat -gs [-s] [-f address_family] [-M core] [-N system]
Never mind, I'm happy with the Traffic stats, with your help I commented out the connections polling in mrtg.flux.cfg so I got what I need
Thanx !
k.
Logged
P3 733 | FreeBSD6.0 | 128MB RAM
Lighttpd 1.4.11 | PHP 5.1.2 (cgi-fcgi) | Postgres8.1 | Python 2.3.4
TF 2.1 w/ AJAX on indexpage| MRTG statistics
b4rt
Hero Member
Offline
TF Base: Linux 2.x
Posts: 543
Re: MRTG-Graph-hack [Update: Another Example for an additional Graph]
«
Reply #19 on:
05-04-2006, 07:45:38 »
Quote from: kanchke on 05-04-2006, 05:40:12
I used -a because -e apparently is a illegal option on my system
Code:
netstat -e
netstat: illegal option -- e
hmm, your (bsd)-netstat is different
Quote from: kanchke on 05-04-2006, 05:40:12
Never mind, I'm happy with the Traffic stats, with your help I commented out the connections polling in mrtg.flux.cfg so I got what I need
Thanx !
k.
ok, happy to hear that. (no need to write something special for your netstat ~)
regards,
b4rt
Logged
torrentflux-b4rt svn-trunk
Linux 2.4.34.1, Apache 2.0.59, PHP 4.4.5, Perl 5.8.8, Python 2.5, MySQL 4.1.22
lord_nor
Full Member
Offline
TF Base: Linux 2.x
Posts: 173
Re: MRTG-Graph-hack [Update: Another Example for an additional Graph]
«
Reply #20 on:
05-08-2006, 14:35:59 »
Here's the changes to make fluxpoller.pl work with freebsd.
(probably already done this)
find
Code:
my $BIN_GREP = "/bin/grep";
replace with
Code:
my $BIN_GREP = "/usr/bin/grep";
find
Code:
my $BIN_AWK = "/usr/bin/awk";
add below that
Code:
my $BIN_FSTAT = "/usr/bin/fstat";
find
Code:
$cons = `$BIN_NETSTAT -e -p --tcp -n 2> /dev/null | $BIN_GREP -v root | $BIN_GREP -v 127.0.0.1 | $BIN_GREP -c python`;
replace with
Code:
$cons = `$BIN_FSTAT -u www | $BIN_GREP python | grep -c tcp`;
Ta-da!
«
Last Edit: 05-08-2006, 14:51:40 by lord_nor
»
Logged
If they give you lined paper, write the other way.
Freebsd 6.1 | PHP 5.1.4 | MySql 5.1.9-beta | Apache 1.3.36
b4rt
Hero Member
Offline
TF Base: Linux 2.x
Posts: 543
Re: MRTG-Graph-hack [Update: Another Example for an additional Graph]
«
Reply #21 on:
05-08-2006, 14:48:36 »
Quote from: lord_nor on 05-08-2006, 14:35:59
Here's a patchfile that will fix fluxpoller.pl to work on a freebsd machine. There's really only two lines changed, but I'm too lazy to type the find and replace... lol
thank you lord_nor for providing that
Logged
torrentflux-b4rt svn-trunk
Linux 2.4.34.1, Apache 2.0.59, PHP 4.4.5, Perl 5.8.8, Python 2.5, MySQL 4.1.22
lord_nor
Full Member
Offline
TF Base: Linux 2.x
Posts: 173
Re: MRTG-Graph-hack [Update: Another Example for an additional Graph]
«
Reply #22 on:
05-09-2006, 14:23:13 »
I'm getting the following error whenever cron runs this hack.
Code:
ERROR: It looks as if you are running two copies of mrtg in parallel on
the same config file. There is a lockfile (/usr/local/etc/mrtg/mrtg.flux.cfg_l) and it is
is only 0 seconds old ... Check your crontab.
(/etc/crontab and /var/spool/cron/root)
Here's my entire crontab file
Code:
# /etc/crontab - root's crontab for FreeBSD
#
# $FreeBSD: src/etc/crontab,v 1.32 2002/11/22 16:13:39 tom Exp $
#
SHELL=/bin/sh
PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin
HOME=/var/log
#
#minute hour mday month wday who command
#
*/5 * * * * root /usr/libexec/atrun
*/5 * * * * www /usr/local/bin/flux-mrtg-update.sh /usr/local/etc/mrtg/flux-mrtg.conf &> /dev/null
#
# Save some entropy so that /dev/random can re-seed on boot.
*/11 * * * * operator /usr/libexec/save-entropy
#
# Rotate log files every hour, if necessary.
0 * * * * root newsyslog
5 * * * * root /root/maillogs
#
# Perform daily/weekly/monthly maintenance.
1 3 * * * root periodic daily
15 4 * * 6 root periodic weekly
30 5 1 * * root periodic monthly
#
# Adjust the time zone if the CMOS clock keeps local time, as opposed to
# UTC time. See adjkerntz(8) for details.
1,31 0-5 * * * root adjkerntz -a
so it's not running mrtg twice, clearly. Any ideas? I've never used mrtg before, so I don't really know where this could be coming from.
Logged
If they give you lined paper, write the other way.
Freebsd 6.1 | PHP 5.1.4 | MySql 5.1.9-beta | Apache 1.3.36
b4rt
Hero Member
Offline
TF Base: Linux 2.x
Posts: 543
Re: MRTG-Graph-hack [Update: Another Example for an additional Graph]
«
Reply #23 on:
05-09-2006, 14:51:23 »
not really, the first time i read this error-message.
maybe you have really a double crontab-entry ?
try
Code:
crontab -e
depending on your system what you see there might not be what is in /etc/crontab
Logged
torrentflux-b4rt svn-trunk
Linux 2.4.34.1, Apache 2.0.59, PHP 4.4.5, Perl 5.8.8, Python 2.5, MySQL 4.1.22
lord_nor
Full Member
Offline
TF Base: Linux 2.x
Posts: 173
Re: MRTG-Graph-hack [Update: Another Example for an additional Graph]
«
Reply #24 on:
05-10-2006, 20:08:16 »
doh! apparently it was in www's crontab, and also in the system crontab. I feel like an idiot now.
Logged
If they give you lined paper, write the other way.
Freebsd 6.1 | PHP 5.1.4 | MySql 5.1.9-beta | Apache 1.3.36
xoriath
Newbie
Offline
Posts: 17
Re: MRTG-Graph-hack
«
Reply #25 on:
05-20-2006, 09:19:45 »
When I run
Code:
/usr/local/bin/flux-mrtg-update.sh /etc/mrtg/flux-mrtg.conf
it prints
Code:
-----------------------------------------------------------------------
ERROR: Mrtg will most likely not work properly when the environment
variable LANG is set to UTF-8. Please run mrtg in an environment
where this is not the case. Try the following command to start:
env LANG=C /usr/bin/mrtg /etc/mrtg/mrtg.flux.cfg
-----------------------------------------------------------------------
When i run
Code:
env LANG=C /usr/bin/mrtg /etc/mrtg/mrtg.flux.cfg
I get no answer, but the graph php in TF doesn't show anything.
My mrtg.flux.cfg
Code:
# $RCSfile: mrtg.flux.cfg,v $ $Revision: 1.3 $ $Date: 2006/04/26 14:21:06 $
# set all lines after "CHANGEME" (get a list with : "grep -A 1 CHANGEME this")
# ------------------------------------------------------------------------------
# paths
# ------------------------------------------------------------------------------
# you _must_ set all 3 directory-paths. watch for permissions (!).
# CHANGEME
Logdir: /home/shared/torrent/.mrtg/
# CHANGEME
HtmlDir: /var/www/mrtg/
# CHANGEME
Imagedir: /var/www/mrtg/
And my flux-mrtg.conf
Code:
# $RCSfile: flux-mrtg.conf,v $ $Revision: 1.2 $ $Date: 2006/04/26 09:46:26 $
# set all lines after "CHANGEME" (get a list with: "grep -A 1 CHANGEME this")
# flux-path (aka "Path" in flux-settings)
# CHANGEME
FLUXPATH="/home/shared/torrent"
# path to mrtg-conf-file.
# wherever this is, ensure directory is writeable for the user running this
# script (-> user running mrtg) (mrtg creates a lockfile at its conf-file(s))
# CHANGEME
CONFFILE="/etc/mrtg/mrtg.flux.cfg"
# where is mrtg
# CHANGEME
BIN_MRTG="/usr/bin/mrtg"
I'm running TorrentFlux 2.1-b4rt-7 on a CC box
Logged
b4rt
Hero Member
Offline
TF Base: Linux 2.x
Posts: 543
Re: MRTG-Graph-hack
«
Reply #26 on:
05-20-2006, 10:12:01 »
Quote from: xoriath on 05-20-2006, 09:19:45
ERROR: Mrtg will most likely not work properly when the environment
variable LANG is set to UTF-8. Please run mrtg in an environment
where this is not the case. Try the following command to start:
env LANG=C /usr/bin/mrtg /etc/mrtg/mrtg.flux.cfg
gringo had the same error but i must admit i dont have the exact snip now how he solved it ^^
afair he did set the LANG to C in the shell-script flux-mrtg-update.sh.
so this might work, if it doesnt pls pm gringo for exact solution.
find this in flux-mrtg-update.sh:
Code:
# invoke mrtg for flux
$BIN_MRTG $CONFFILE | tee -a $FLUXPATH/.mrtg/mrtg.log
change to this:
Code:
# invoke mrtg for flux
env LANG=C $BIN_MRTG $CONFFILE | tee -a $FLUXPATH/.mrtg/mrtg.log
regards,
b4rt
Logged
torrentflux-b4rt svn-trunk
Linux 2.4.34.1, Apache 2.0.59, PHP 4.4.5, Perl 5.8.8, Python 2.5, MySQL 4.1.22
xoriath
Newbie
Offline
Posts: 17
Re: MRTG-Graph-hack
«
Reply #27 on:
05-22-2006, 09:42:49 »
Ok
Now it doesn't complain about the language, but the graph doesn't build.
In the graph page, no image is forming, like in normal mrtg (i'm running one already on another page)
Logged
b4rt
Hero Member
Offline
TF Base: Linux 2.x
Posts: 543
Re: MRTG-Graph-hack
«
Reply #28 on:
05-22-2006, 09:58:13 »
Quote from: xoriath on 05-22-2006, 09:42:49
Ok
Now it doesn't complain about the language, but the graph doesn't build.
In the graph page, no image is forming, like in normal mrtg (i'm running one already on another page)
same happened to gringo
after he fixed the lang-complain he had empty graphs.
afair it was path-related on his setup.
pls ensure you have all CHANGEME-parts setup correct.
easy to print all affected lines with:
Code:
grep -A 1 CHANGEME flux-mrtg.conf
Code:
grep -A 1 CHANGEME mrtg.flux.cfg
also please give mrtg some time.
it may be you dont see anything in 5 mins. give it at least 3 cycles (15 mins) time to startup things.
(this is no must but sometimes it may be)
regards,
b4rt
Logged
torrentflux-b4rt svn-trunk
Linux 2.4.34.1, Apache 2.0.59, PHP 4.4.5, Perl 5.8.8, Python 2.5, MySQL 4.1.22
xoriath
Newbie
Offline
Posts: 17
Re: MRTG-Graph-hack
«
Reply #29 on:
05-22-2006, 13:57:31 »
Ok.
Now there are pictures forming in the mrtg girectory, but they won't show in mrtg.php
Logged
Pages:
1
[
2
]
3
4
5
« previous
next »
Jump to:
Please select a destination:
-----------------------------
TorrentFlux
-----------------------------
=> TorrentFlux News
=> TorrentFlux Search Engine Modules and Updates
=> Forum/Website Problems
-----------------------------
TorrentFlux Support
-----------------------------
=> Linux Installations Support
=> Windows Installations (Limited Support)
=> International Support
-----------------------------
Bugs, Fixes, and Feature Requests
-----------------------------
=> Linux Bugs
=> Windows Bugs
=> Feature Requests
-----------------------------
Code Hacks and Tools
-----------------------------
=> TorrentFlux Tools
=> TorrentFlux 2.3 Hacks
=> TorrentFlux 2.1 Hacks
=> TorrentFlux 2.0 Hacks
=> TorrentFlux 1.x Hacks
=> TorrentFlux Themes (skins)
-----------------------------
Off The Wall
-----------------------------
=> Off Topic Discussion
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Powered by SMF 1.1.1
|
SMF © 2006, Simple Machines LLC