MRTG (mrtg.conf)
MRTG com gráficos de eth0, eth1, HD, mem e CPU
Categoria: Miscelânea
Software: MRTG
[ Hits: 10.197 ]
Por: William Maggi Pardalz
Esta cfg configura o MRTG para exibir gráficos sobre o uso das interfaces de rede, HD, memória, CPU. Antes de colocar para rodar crie dentro da pasta /etc/mrtg o arquivo cpu1.sh com os seguintes comandos:
#!/bin/sh
#este script concorda com os termos da gpl
#(!c) Cesar Augusto Fresqui - boyhammer@yahoo.com
#copie para /etc/mrtg/mrtg-cpu.sh
#chmod +x /etc/mrtg/mrtg-cpu.sh
unset LANG
mem=$(/usr/bin/free|grep ^-)
load=$(cat /proc/loadavg)
awk -v load="$load" -v mem="$mem" '
BEGIN {
split(load,loadstats)
print int(100*loadstats[2])
split(mem,memstats);
print int(100*memstats[3]/(memstats[3]+\
memstats[4]));
}'
######################################################################
# Multi Router Traffic Grapher -- Sample Configuration File
######################################################################
# This file is for use with mrtg-2.5.4c
# Global configuration
WorkDir: /var/www/mrtg
Htmldir: /var/www/mrtg
icondir: images/
Refresh: 300
Interval: 5
Language: portuguese
RunAsDaemon: yes
WriteExpires: Yes
Title[^]: Traffic Analysis for
# 128K leased line
# ----------------
#Title[leased]: a 128K leased line
#PageTop[leased]: <H1>Our 128K link to the outside world</H1>
#Target[leased]: 1:public@router.localnet
#MaxBytes[leased]: 16000
##
# ETH0
##
Target[eth0]: `cat /proc/net/dev |grep eth0 |awk -F':' '{print $2}' |awk '{print $1}'; cat /proc/net/dev |grep eth0 | awk -F':' '{print $2}' |awk '{print $9}'; uptime |awk -F':' '{print $3}' |awk '{print $3}'; echo Server`
MaxBytes[eth0]: 1250000
Title[eth0]: eth0 - Utilizacao eth0
PageTop[eth0]: <H1>Estatisticas das interfaces<BR>Utilizacao interface interna (eth0)</H1>
Options[eth0]: growright
#
# ETH1
#
Target[eth1]: `cat /proc/net/dev |grep eth1 |awk -F':' '{print $2}' |awk '{print $1}'; cat /proc/net/dev |grep eth1 | awk -F':' '{print $2}' |awk '{print $9}'; uptime |awk -F':' '{print $3}' |awk '{print $3}'; echo Server`
MaxBytes[eth1]: 1250000
Title[eth1]: eth1 - Utilizacao eth1
PageTop[eth1]: <H1>Estatisticas das interfaces<BR>Utilizacao interface Externa (eth1)</H1>
Options[eth1]: growright
#
# HD
#
Target[hd]: `df -h | grep sda1 | awk '{ print $3 }' | cut -c 1-2; df -h | grep sda1 | awk '{ print $2 }' | cut -c 1-3; uptime |awk -F':' '{print $3}' |awk '{print $3}'; echo Server`
MaxBytes[hd]: 160
#HTML output settings
Title[hd]: DISK Usage
PageTop[hd]: <H1> HD <BR> Utilizacao do Disco Rigido</H1>
#Suppress[hd]: ym
#Graph output settings
Options[hd]: growright, gauge
PNGTitle[hd]: Marispan
kMG[hd]: G
YLegend[hd]: GBytes
Legend1[hd]: GBytes Usados
Legend2[hd]: Total
Legend3[hd]: Dias Ligado
Legend4[hd]: Server Name:
#LegendI[hd]: sda1:
#
#Memoria Will
#
Target[memo]: `cat /proc/meminfo |grep Active: |awk -F':' '{print $2}' |awk '{print $1}'; cat /proc/meminfo |grep MemTotal: |awk -F':' '{print $2}' |awk '{print $1}'; uptime |awk -F':' '{print $3}' |awk '{print $3}'; echo Server`
MaxBytes[memo]: 4000000
#HTML output settings
Title[memo]: Uso da Memoria
PageTop[memo]: <H1>Memoria <BR> Utilizacao da Memoria</H1>
#Suppress[memo]: ym
#Graph output settings
Options[memo]: growright, gauge
PNGTitle[memo]: Marispan
YLegend[memo]: Memoria
#ShortLegend[memo]: KBytes
kMG[memo]: k,M,G,T
Legend1[memo]: KBytes Usados
Legend2[memo]: Total
Legend3[memo]: Max bytes load
Legend4[memo]: Max Users
LegendI[memo]: Usado:
LegendO[memo]: Total:
#
# Processador
#
#Target[proc]: `cat /proc/loadavg | awk -F':' '{print $1}' |awk '{print $1}'; cat /proc/loadavg | awk -F':' '{print $1}' |awk '{print $2}'; uptime |awk -F':' '{print $3}' |awk '{print $3}'; echo Server`
Target[proc]: `/etc/mrtg/cpu1.sh`
MaxBytes[proc]: 100
#HTML output settings
Title[proc]: Processador
PageTop[proc]: <H1>Processador <BR> Utilizacao do Processamento</H1>
#Suppress[proc]: ym
#Graph output settings
Options[proc]: growright, gauge, noinfo
PNGTitle[proc]: Marispan
YLegend[proc]: Processador
ShortLegend[proc]: %
Legend1[proc]: Carga CPU
Legend2[proc]: Uso da Memoria real
LegendI[proc]: Carga:
LegendO[proc]: Memoria:
Target[usr]: `uptime |awk -F':' '{print $4}' |awk '{print $2}'; uptime |awk -F':' '{print $3}' |awk '{print $3}'; uptime |awk -F':' '{print $3}' |awk '{print $3}'; echo Server`
MaxBytes[usr]: 500
#HTML output settings
Title[usr]: Usuarios
PageTop[usr]: <H1>Uptime <BR> Usuarios e Uptime</H1>
#Suppress[usr]: ym
#Graph output settings
Options[usr]: growright, gauge
PNGTitle[usr]: Marispan
YLegend[usr]: Usuarios
#ShortLegend[usr]: Usuarios
Legend1[usr]: Usuarios
Legend2[usr]: Uptime
LegendI[usr]: Users:
LegendO[usr]: Uptime:
Cirurgia para acelerar o openSUSE em HD externo via USB
Void Server como Domain Control
Modo Simples de Baixar e Usar o bash-completion
Monitorando o Preço do Bitcoin ou sua Cripto Favorita em Tempo Real com um Widget Flutuante
Opções secretas em tema do Cinnamon
Como mapear unidade de rede no Linux
Como quebrar senha usando john the ripper
Alguém pode me indicar um designer freelancer? [RESOLVIDO] (1)
Alguém já testou o novo COSMIC Desktop? O que achou? (4)
Não consigo instalar distro antiga no virtualbox nem direto no hd (29)
queria saber como posso alterar a frequencia do meu ryzen 2300u pro (3)









