Nie jesteś zalogowany.
Jeśli nie posiadasz konta, zarejestruj je już teraz! Pozwoli Ci ono w pełni korzystać z naszego serwisu. Spamerom dziękujemy!
Prosimy o pomoc dla małej Julki — przekaż 1% podatku na Fundacji Dzieciom zdazyć z Pomocą.
Więcej informacji na dug.net.pl/pomagamy/.
Witam,
Mam problem z wykresami generowanymi przy pomocy rrdtool'a. Pod tym adresem jest przykładowy wykres --> http://marduk.rootnode.pl/p2p_d.png .Nie wiem skąd biorą się takie skoki na tych grafikach. Wykresy generuję w następujący sposób:
tworzenie bazy danych:
rrdtool create -s 300 /etc/rrd/databases/p2p_d.rrd DS:marduk:COUNTER:600:0:U DS:lukasz:COUNTER:600:0:U DS:serek:COUNTER:600:0:U DS:sandman:COUNTER:600:0:U DS:maciek:COUNTER:600:0:U DS:yojin:COUNTER:600:0:U DS:leon:COUNTER:600:0:U DS:chaos:COUNTER:600:0:U DS:chaos_l:COUNTER:600:0:U DS:eman:COUNTER:600:0:U DS:w00x:COUNTER:600:0:U DS:w00x_l:COUNTER:600:0:U RRA:AVERAGE:0.5:1:1200 RRA:AVERAGE:0.5:12:2400
pobieranie danych do bazy:
#!/bin/bash
marduk=`iptables -t mangle -L MARK_P2P_D -x -v | grep marduk | awk '{print $2;}'`
lukasz=`iptables -t mangle -L MARK_P2P_D -x -v | grep lukasz | awk '{print $2;}'`
sandman=`iptables -t mangle -L MARK_P2P_D -x -v | grep sandman | awk '{print $2;}'`
maciek=`iptables -t mangle -L MARK_P2P_D -x -v | grep maciek | awk '{print $2;}'`
serek=`iptables -t mangle -L MARK_P2P_D -x -v | grep serek | awk '{print $2;}'`
yojin=`iptables -t mangle -L MARK_P2P_D -x -v | grep yojin | awk '{print $2;}'`
leon=`iptables -t mangle -L MARK_P2P_D -x -v | grep leon | awk '{print $2;}'`
chaos=`iptables -t mangle -L MARK_P2P_D -x -v | grep chaos | awk '{print $2;}' |head -1`
chaos_l=`iptables -t mangle -L MARK_P2P_D -x -v | grep chaos | awk '{print $2;}' |tail -1`
eman=`iptables -t mangle -L MARK_P2P_D -x -v | grep eman | awk '{print $2;}'`
w00x=`iptables -t mangle -L MARK_P2P_D -x -v | grep w00x | awk '{print $2;}' |head -1`
w00x_l=`iptables -t mangle -L MARK_P2P_D -x -v | grep w00x | awk '{print $2;}' |tail -1`
rrdtool update /etc/rrd/databases/p2p_d.rrd
N:$marduk:$lukasz:$serek:$sandman:$maciek:$yojin:$leon:$chaos:$chaos_l:$eman:$w00x:$w00x_l
[/quote]
generowanie wykresu:Kod:
#!/bin/bash rrdtool graph /var/webroot/home/lighttpd/rrd/p2p_d.png --title='Ruch p2p w sieci ASP2 - download' -w 650 -h 300 --start -86400 DEF:marduk=/etc/rrd/databases/p2p_d.rrd:marduk:AVERAGE DEF:lukasz=/etc/rrd/databases/p2p_d.rrd:lukasz:AVERAGE DEF:serek=/etc/rrd/databases/p2p_d.rrd:serek:AVERAGE DEF:maciek=/etc/rrd/databases/p2p_d.rrd:maciek:AVERAGE DEF:eman=/etc/rrd/databases/p2p_d.rrd:eman:AVERAGE DEF:sandman=/etc/rrd/databases/p2p_d.rrd:sandman:AVERAGE DEF:yojin=/etc/rrd/databases/p2p_d.rrd:yojin:AVERAGE DEF:leon=/etc/rrd/databases/p2p_d.rrd:leon:AVERAGE DEF:chaos=/etc/rrd/databases/p2p_d.rrd:chaos:AVERAGE DEF:chaos_l=/etc/rrd/databases/p2p_d.rrd:chaos_l:AVERAGE DEF:w00x=/etc/rrd/databases/p2p_d.rrd:w00x:AVERAGE DEF:w00x_l=/etc/rrd/databases/p2p_d.rrd:w00x_l:AVERAGE CDEF:mardukkb=marduk,1024,/ CDEF:lukaszkb=lukasz,1024,/ CDEF:serekkb=serek,1024,/ CDEF:maciekkb=maciek,1024,/ CDEF:emankb=eman,1024,/ CDEF:sandmankb=sandman,1024,/ CDEF:yojinkb=yojin,1024,/ CDEF:leonkb=leon,1024,/ CDEF:chaoskb=chaos,1024,/ CDEF:chaos_lkb=chaos_l,1024,/ CDEF:w00xkb=w00x,1024,/ CDEF:w00x_lkb=w00x_l,1024,/ COMMENT:" minimalnie średnio maksymalnie ostatnion" LINE2:marduk#000000:'marduk:' GPRINT:mardukkb:MIN:" %6.1lf KB/s" GPRINT:mardukkb:AVERAGE:" %8.1lf KB/s" GPRINT:mardukkb:MAX:" %7.1lf KB/s" GPRINT:mardukkb:LAST:" %9.1lf KB/sn" LINE2:lukasz#0000ff:'lukasz' GPRINT:lukaszkb:MIN:" %6.1lf KB/s" GPRINT:lukaszkb:AVERAGE:" %8.1lf KB/s" GPRINT:lukaszkb:MAX:" %7.1lf KB/s" GPRINT:lukaszkb:LAST:" %9.1lf KB/sn" LINE2:serek#ff0000:'serek' GPRINT:serekkb:MIN:" %7.1lf KB/s" GPRINT:serekkb:AVERAGE:" %8.1lf KB/s" GPRINT:serekkb:MAX:" %7.1lf KB/s" GPRINT:serekkb:LAST:" %9.1lf KB/sn" LINE2:sandman#47ffc9:'sandman' GPRINT:sandmankb:MIN:" %5.1lf KB/s" GPRINT:sandmankb:AVERAGE:" %8.1lf KB/s" GPRINT:sandmankb:MAX:" %7.1lf KB/s" GPRINT:sandmankb:LAST:" %9.1lf KB/sn" LINE2:maciek#888282:'maciek' GPRINT:maciekkb:MIN:" %6.1lf KB/s" GPRINT:maciekkb:AVERAGE:" %8.1lf KB/s" GPRINT:maciekkb:MAX:" %7.1lf KB/s" GPRINT:maciekkb:LAST:" %9.1lf KB/sn" LINE2:yojin#e4b366:'yojin' GPRINT:yojinkb:MIN:" %7.1lf KB/s" GPRINT:yojinkb:AVERAGE:" %8.1lf KB/s" GPRINT:yojinkb:MAX:" %7.1lf KB/s" GPRINT:yojinkb:LAST:" %9.1lf KB/sn" LINE2:leon#fcab92:'leon' GPRINT:leonkb:MIN:" %8.1lf KB/s" GPRINT:leonkb:AVERAGE:" %8.1lf KB/s" GPRINT:leonkb:MAX:" %7.1lf KB/s" GPRINT:leonkb:LAST:" %9.1lf KB/sn" LINE2:chaos#c549b5:'chaos' GPRINT:chaoskb:MIN:" %7.1lf KB/s" GPRINT:chaoskb:AVERAGE:" %8.1lf KB/s" GPRINT:chaoskb:MAX:" %7.1lf KB/s" GPRINT:chaoskb:LAST:" %9.1lf KB/sn" LINE2:chaos_l#ff9cf2:'chaos_l' GPRINT:chaos_lkb:MIN:" %5.1lf KB/s" GPRINT:chaos_lkb:AVERAGE:" %8.1lf KB/s" GPRINT:chaos_lkb:MAX:" %7.1lf KB/s" GPRINT:chaos_lkb:LAST:" %9.1lf KB/sn" LINE2:eman#fff000:'eman' GPRINT:emankb:MIN:" %8.1lf KB/s" GPRINT:emankb:AVERAGE:" %8.1lf KB/s" GPRINT:emankb:MAX:" %7.1lf KB/s" GPRINT:emankb:LAST:" %9.1lf KB/sn" LINE2:w00x#40a147:'w00x' GPRINT:w00xkb:MIN:" %8.1lf KB/s" GPRINT:w00xkb:AVERAGE:" %8.1lf KB/s" GPRINT:w00xkb:MAX:" %7.1lf KB/s" GPRINT:w00xkb:LAST:" %9.1lf KB/sn" LINE2:w00x_l#5df868:'w00x_l' GPRINT:w00x_lkb:MIN:" %6.1lf KB/s" GPRINT:w00x_lkb:AVERAGE:" %8.1lf KB/s" GPRINT:w00x_lkb:MAX:" %7.1lf KB/s" GPRINT:w00x_lkb:LAST:" %9.1lf KB/sn" --vertical-label 'bits/sek'i na koniec iptables:
Kod:
asp2:/etc/rrd# iptables -t mangle -L MARK_P2P_D -v Chain MARK_P2P_D (7 references) pkts bytes target prot opt in out source destination 1150K 1037M ACCEPT 0 -- any any anywhere marduk 204K 29M ACCEPT 0 -- any any anywhere lukasz 2323K 2227M ACCEPT 0 -- any any anywhere serek 0 0 ACCEPT 0 -- any any anywhere sandman 2428 218K ACCEPT 0 -- any any anywhere maciek 2632K 1869M ACCEPT 0 -- any any anywhere yojin 0 0 ACCEPT 0 -- any any anywhere leon 0 0 ACCEPT 0 -- any any anywhere chaos 0 0 ACCEPT 0 -- any any anywhere chaos-laptop 50 7700 ACCEPT 0 -- any any anywhere eman 127K 11M ACCEPT 0 -- any any anywhere w00x 0 0 ACCEPT 0 -- any any anywhere w00x-laptopZ góry dzięki za wszystkie podpowiedzi.
Offline
rozwiązałem ten problem w następujący sposób (może komuś się przyda):
zmieniłem typ z COUNTER na ABSOLUTE a w skryptach zliczających dane z iptables dodałem wpis zerujący liczniki iptables po każdym wywołaniu skryptu:
iptables -t mangle -L MARK_P2P_D -Z > /dev/null
i działa ;]
Offline
Time (s) | Query |
---|---|
0.00009 | SET CHARSET latin2 |
0.00004 | SET NAMES latin2 |
0.00119 | SELECT u.*, g.*, o.logged FROM punbb_users AS u INNER JOIN punbb_groups AS g ON u.group_id=g.g_id LEFT JOIN punbb_online AS o ON o.ident='13.58.34.132' WHERE u.id=1 |
0.00075 | REPLACE INTO punbb_online (user_id, ident, logged) VALUES(1, '13.58.34.132', 1732593466) |
0.00045 | SELECT * FROM punbb_online WHERE logged<1732593166 |
0.00054 | SELECT t.subject, t.closed, t.num_replies, t.sticky, f.id AS forum_id, f.forum_name, f.moderators, fp.post_replies, 0 FROM punbb_topics AS t INNER JOIN punbb_forums AS f ON f.id=t.forum_id LEFT JOIN punbb_forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=3) WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id=9605 AND t.moved_to IS NULL |
0.00005 | SELECT search_for, replace_with FROM punbb_censoring |
0.00073 | SELECT u.email, u.title, u.url, u.location, u.use_avatar, u.signature, u.email_setting, u.num_posts, u.registered, u.admin_note, p.id, p.poster AS username, p.poster_id, p.poster_ip, p.poster_email, p.message, p.hide_smilies, p.posted, p.edited, p.edited_by, g.g_id, g.g_user_title, o.user_id AS is_online FROM punbb_posts AS p INNER JOIN punbb_users AS u ON u.id=p.poster_id INNER JOIN punbb_groups AS g ON g.g_id=u.group_id LEFT JOIN punbb_online AS o ON (o.user_id=u.id AND o.user_id!=1 AND o.idle=0) WHERE p.topic_id=9605 ORDER BY p.id LIMIT 0,25 |
0.00095 | UPDATE punbb_topics SET num_views=num_views+1 WHERE id=9605 |
Total query time: 0.00479 s |