Beste Tweakers,
Ik ben bezig met het meten van bandbreedte vanuit een apache logfile.
Ik heb een php scriptje gemaakt wat 4 waardes terug geeft.
Dit zijn de waardes wat hij op de command prompt terug geeft:
Dit is het php scriptje:
Dit is mijn mrtg.cfg file
Kan iemand mij vertellen waarom hij geen waardes in mrtg plaatst.
Hier de url met war hij nu weergeeft
http://www.formulaforce.net/mrtg/nfss.html
Ik ben bezig met het meten van bandbreedte vanuit een apache logfile.
Ik heb een php scriptje gemaakt wat 4 waardes terug geeft.
Dit zijn de waardes wat hij op de command prompt terug geeft:
code:
1
2
3
4
| bandbreedte (148.9) het zijn mb's een null waarde (0) tijd (12:48:12) website naam (www.nftt.tk) |
Dit is het php scriptje:
PHP:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
| <? $todaylog = "/var/log/httpd/nfss.tk-access_log"; $time=(date ("H:i:s")); error_reporting(1); $fd = fopen("$todaylog","r"); while ($y = fgets($fd,1024)) { $linecount++; } $y = NULL; fclose($fd); $fd = fopen("$todaylog","r"); while ($x = fgets($fd,1024)) { if($count == 0) { # get the first timestamp list( , , , $date) = explode(" ", $x); $date = str_replace("[", "", $date); list($day, $month, $year) = explode("/", $date, 3); list($year, $hour, $minute, $second) = explode(":", $year, 4); $formdate = "$day $month $year $hour:$minute:$second"; $starttime = strtotime("$formdate"); } if($count == ($linecount - 1)) { # get the last timestamp list( , , , $date) = explode(" ", $x); $edate = str_replace("[", "", $date); list($day, $month, $year) = explode("/", $edate, 3); list($year, $hour, $minute, $second) = explode(":", $year, 4); $eformdate = "$day $month $year $hour:$minute:$second"; $endtime = strtotime("$eformdate"); } list( , , , , , , , , , $size) = explode(" ", $x, 10); if($size != "-") { $total = ($total + $size); } $count++; } fclose($fd); $fd = fopen("$yesterdaylog","r"); while ($x = fgets($fd,1024)) { list( , , , , , , , , , $size) = explode(" ", $x, 10); if($size != "-") { $ytotal = ($ytotal + $size); } } fclose($fd); $change = (($change * 100) - 100); $logduration = ($endtime - $starttime); $totalsecs = 86400; # total seconds in a day $change = round($change, 1); $actualchange = round($actualchange, 1); if($change > 0) { $change = "+$change"; } $total = ($total / 1024 / 1024); $total = round($total, 1); print "$total\n"; print "0\n"; print "$time\n"; print "www.nfss.tk\n"; |
Dit is mijn mrtg.cfg file
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
| # BANDWITDH FOR NFSS.TK WorkDir: /var/www/html/mrtg Title[NFSS]: NFSS Web usage MaxBytes[NFSS]: 12500 Options[NFSS]: gauge, growright, nopercent Target[NFSS]: `php -q /var/www/html/users/nfss/calcband.php` PageTop[NFSS]: <H1>www.nfss.tk Web Traffic</H1> YLegend[NFSS]: K of bandwidth/Hits ShortLegend[NFSS]: K/s Legend1[NFSS]: Kilobytes per second of web traffic Legend3[NFSS]: Maximal K/s of web traffic LegendI[NFSS]: Bandwidth: WithPeak[NFSS]: ymwd |
Kan iemand mij vertellen waarom hij geen waardes in mrtg plaatst.
Hier de url met war hij nu weergeeft
http://www.formulaforce.net/mrtg/nfss.html
Model 3 LR AWD Solid Black / Black / Aero / Trekhaak - Bestelling 2-10 Leaseplan, 4-10 Tesla, RN 22-09, Nieuwe RN 25-11, VIN Yes, leverdatum: ?/?/19(?)