informatica:linux:generar_graficos
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
informatica:linux:generar_graficos [2010/12/04 14:13] – 127.0.0.1 | informatica:linux:generar_graficos [2015/04/13 20:19] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== RRDTOOL ====== | ====== RRDTOOL ====== | ||
- | http:// | + | Referencia: |
+ | ===== Crear la Base de datos ===== | ||
+ | Por ejemplo queremos hacer una gráfica de tiempo de respuesta de una servicio | ||
+ | Los datos serían estos: | ||
+ | |||
+ | Día: 26/11/2010 | ||
+ | |||
+ | ^^Hora^^msecs^^ | ||
+ | ||0800||1245|| | ||
+ | ||0830||807|| | ||
+ | ||0900||1876|| | ||
+ | ||0930||572|| | ||
+ | ||1000||549|| | ||
+ | ||1030||590|| | ||
+ | ||1100||410|| | ||
+ | ||1130||611|| | ||
+ | ||1200||0|| | ||
+ | ||1230||788|| | ||
+ | ||1300||349|| | ||
+ | ||1330||542|| | ||
+ | ||1400||576|| | ||
+ | ||1430||661|| | ||
+ | ||1500||659|| | ||
+ | |||
+ | La fecha tiene que estar en UNIX time, que son los segundos que han pasado desde el 1 enero de 1970, para convertir una fecha a unixtime usamos: | ||
+ | # date +%s -d" | ||
+ | 1290754800 | ||
+ | |||
+ | Para crear la Base de Datos seguimos el siguiente formato: | ||
+ | rrdtool create < | ||
+ | |||
+ | * tiempo_inicio= tiempo de la primera medición en UNIX TIME | ||
+ | * tiempo_medicion= cada cuanto tiempo se toma una muestra en segundos. Si se omite esta opción, son 300 (5 minutos) | ||
+ | * nombre_variable= nombre del campo en la base de datos | ||
+ | * DST= puede ser COUNTER, DERIVE, ABSOLUTE, GAUGE | ||
+ | * heartbeat= cada cuanto se fuerza la medida. Si por ejemplo son 300 segundos y el heartbeat es de 600, esperarà 600 segundos y sinó pondrá un UNKNOWN | ||
+ | * min y max: si no se sabe se pone U y lo cálcula | ||
+ | |||
+ | Falta traducir y resumir de http:// | ||
+ | |||
+ | RRA: | ||
+ | |||
+ | Lets have a look at the example above. For the first RRA, 12 (steps) PDPs (DS variables) are AVERAGEed (CF) to form one CDP. 24 (rows) of theses CDPs are archived. Each PDP occurs at 300 seconds. 12 PDPs represent 12 times 300 seconds which is 1 hour. It means 1 CDP (which is equal to 12 PDPs) represents data worth 1 hour. 24 such CDPs represent 1 day (1 hour times 24 CDPs). This means, this RRA is an archive for one day. After 24 CDPs, CDP number 25 will replace the 1st CDP. The second RRA saves 31 CDPs; each CPD represents an AVERAGE value for a day (288 PDPs, each covering 300 seconds = 24 hours). Therefore this RRA is an archive for one month. A single database can have many RRAs. If there are multiple DSs, each individual RRA will save data for all the DSs in the database. For example, if a database has 3 DSs and daily, weekly, monthly, and yearly RRAs are declared, then each RRA will hold data from all 3 data sources. | ||
+ | |||
+ | * CF= AVERAGE, MINIMUM, MAXIMUM, and LAST | ||
+ | |||
+ | Ponemos que empieza 30 minutos antes que la primera medición: | ||
+ | |||
+ | rrdtool create tiempo_respuesta.rrd --start 1290753000 --step=1800 DS: | ||
+ | |||
+ | ===== Introduciendo los datos ===== | ||
+ | Cambiamos las fechas a UNIX Time, queda tal que así: | ||
+ | Con lo que los datos nos quedarían: | ||
+ | ^^Hora^^msecs^^ | ||
+ | ||1290754800||1245|| | ||
+ | ||1290756600||807|| | ||
+ | ||1290758400||1876|| | ||
+ | ||etc...|| | ||
+ | |||
+ | rrdtool update tiempo_respuesta.rrd 1290754800: | ||
+ | |||
+ | ===== Crear el gráfico ===== | ||
+ | rrdtool graph tiempo_respuesta.png --start 1290754800 --end 1290780000 DEF: | ||
+ | |||
+ | {{informatica: | ||
+ | |||
+ | ===== Ejemplos ===== | ||
+ | ==== Max, min y media ==== | ||
+ | < | ||
+ | rrdtool create min.rrd --start 1290753000 --step=1800 DS: | ||
+ | rrdtool create max.rrd --start 1290753000 --step=1800 DS: | ||
+ | rrdtool create avg.rrd --start 1290753000 --step=1800 DS: | ||
+ | |||
+ | rrdtool update min.rrd 1290754800: | ||
+ | |||
+ | rrdtool update avg.rrd 1290754800: | ||
+ | |||
+ | rrdtool update max.rrd 1290754800: | ||
+ | |||
+ | rdtool graph tiempo_respuesta.png --start 1290754800 --end 1290780000 DEF: | ||
+ | </ | ||
+ | {{informatica: | ||
====== XGRAPH ====== | ====== XGRAPH ====== | ||
Se instala la aplicación xgraph | Se instala la aplicación xgraph | ||
- | ===== Ejemplo 1 ===== | + | ===== Salida por las X ===== |
Genera una gráfica en entorno gráfico.\\ | Genera una gráfica en entorno gráfico.\\ | ||
Se crea un fichero.txt con estos datos: | Se crea un fichero.txt con estos datos: | ||
Line 29: | Line 110: | ||
Y se ejecuta: | Y se ejecuta: | ||
- | | + | |
+ | |||
+ | {{informatica: | ||
+ | |||
+ | ===== Salida en un fichero ===== | ||
+ | Hay que bajarse la versión de la web http:// | ||
+ | # xgraph -pdf fichero.txt -out_file fichero.pdf | ||
+ | |||
+ | Da error con la versión de repositorios: | ||
+ | # xgraph -device ps -o prueba.ps pruebaxgraph.txt | ||
+ | Fallo de segmentación | ||
informatica/linux/generar_graficos.txt · Last modified: 2015/04/13 20:19 by 127.0.0.1