Notícia publicada por brain em janeiro  8, 2004 11:36 AM
| TrackBack
 
"Ontem navegando no freshmeat.net encontrei informações sobre o bwbar, que é uma alternativa bem interessante para administradores". A contribuição vem de Anderson Leite (anderson@jequie.ba.gov.br).
Um exemplo de uso do bwbar é site www.kernel.org - reparem na barra medindo o uso de banda, na página inicial.
Se alguém postasse como se configura ficaria grato.
não achei nada sobre o assunto.
valeu.
Retirado do README do bwbar 1.2.2:
To set it up, create a script that contains the following commands:
	#!/bin/sh -
	cd /home/httpd/html/ubar
	bwbar eth0 1.5 &
... assuming you are connected to the Internet via the interface
"eth0", you are on a 1.5 Mbit/s link, and you want the output files in
the directory /home/httpd/html/ubar.
This will create two files named "ubar.txt", a text fragment, and a
PNG graphic named "ubar.png".  These can be included in an SHTML web
page using the following commands (or something like it):
In a PHP web page, you would instead do:
Some aspects of the bwbar command can be customized with options.  The
bwbar command has the following full usage description:
Usage: bwbar [options] interface max_mbps
Options: (defaults in parenthesis)
   --input               -i   Measure input bandwidth
   --output              -o   Measure output bandwidth (default)
   --text-file     -f   The name of the text output file (ubar.txt)
   --png-file      -p   The name of the graphical bar file (ubar.png)
   --interval   -t   The poll interval in seconds (15)
   --width       -x   Width of the graphical bar (600)
   --height      -y   Height of the graphical bar (4)
   --border      -b   Border width of the graphical bar (1)
   --kbps                -k   Bandwidth is measured in kbit/s
   --Mbps                -M   Bandwidth is measured in Mbit/s (default)
   --Gbps                -G   Bandwidth is measured in Gbit/s
   --help                -h   Display this text
Facilimo de por para rodar, o README explica tudo.
Tive problema para compilar a versão 1.2.2, parece que o Makefile não esta colocando as opções de lib corretas. Quem tiver o mesmo problema, muda a linha do Makefile 
LIBS    = -lz
para
LIBS    = -lz -lpng -lm
Alguem poderia explicar direitinho como fazer funcionar, e como gerar o html e alguns testes
Obrigado.
Esse BwBar e tão simples de por para funcionar.
Vamos la uma rapida instalação
$ wget http://www.kernel.org/pub/software/web/bwbar/bwbar-1.2.2.tar.bz2
$ tar jxf bwbar-1.2.2.tar.bz2
cd bwbar-1.2.2
$ ./configure
$ make
( caso ocorra um erro assim:
ccf2mzjS.o(.text+0x254):/tmp/bwbar-1.2.2/bwbar.c:143: undefined reference to `png_destroy_write_struct'
collect2: ld returned 1 exit status
make: *** [bwbar] Error 1
edit o Makefile e procure pela linha
LIBS = -lz
e inclua -lpng -lm
ficando assim:
LIBS = -lx -lpng -lm
save, e rode o make novamente)
sera gerado o execultavel bwbar
copie ele para algum lugar que esteja no path, como o /usr/local/bin
Va ao diretório raiz do ser servidor http e crie o diretório ubar, mude para esse diretório,
rode o bwbar assim, como por aqui inda estamos nos kbps:
$ bwbar -l eth0 256 &
após ums 15s sera criado os arquivos ubar.png e ubar.txt
O apache ou outro httpd precisa ter suporte a ssi ou php para poder mostrar a barra na página.
usando php seria algo assim:
<html>
<head>
 <title>bwbar< /title>
</head>
<body> 
 <div align="center">
   <h1>bwbar< /h1>
   <?  
     readfile("ubar.txt");
   ?>
   <br>
   <img src="/ubar/ubar.png" border="0">< br>
 </div>
</body> 
O README que acompanha o programa explica mais detalhadamente os procedimentos para incluir o bwbar na sua página.
ex:
http://enigma.nobel.com.br/ubar/
Para quem quiser tem essa versão modificada, muito legal....
http://www.mythica.org/bandwidth/
Comentários desativados: Esta discussão é antiga e foi arquivada, não é mais possível enviar comentários adicionais.