Estou tentando configurar o MRTG no Ubuntu, só que só acho material sobre o Debian
Estou até com esse tutorial, http://www.marcoshenrique.com/linux_monitoramento_mrtg.php
Ele funciona para gerenciar máquinas Windows porém na hora de mandar gerar a página para máquinas Linux Ubuntu dá a seguinte mensagem Use of uninitialized value $first in hash element at /usr/bin/indexmaker line 353
Alguém sabe o que posso fazer?
Obrigado
Eu não estou rodando a partir do mrtg.cfg
Eu crio um arquivo de configuração pelo cfgmaker --output /etc/mrtg/xxx.cfg comunidade@ip_dispositivo
Quando crio, para o Windows ele retorna uma série de consultas com dados sobre tráfego da rede
Para o linux ou ele não retorna nada, ou as consultas comentadas, porém quando descomento ela não dá resultado nenhum.
# Created by
# /usr/bin/cfgmaker --output /etc/mrtg/teste.cfg public@192.168.1.101
### Global Config Options
# for UNIX
# WorkDir: /home/http/mrtg
# for Debian
WorkDir: /var/www/mrtg/teste
# or for NT
# WorkDir: c:\mrtgdata
### Global Defaults
# to get bits instead of bytes and graphs growing to the right
Options[_]: growright, bits
EnableIPv6: no
######################################################################
# System: Thiago
# Description: Linux Thiago 2.6.35-31-generic #62-Ubuntu SMP Tue Nov 8 14:00:30 UTC 2011 i686
# Contact: Me <me@example.org>
# Location: Sitting on the Dock of the Bay
######################################################################
### Interface 1 >> Descr: 'lo' | Name: 'lo' | Ip: '127.0.0.1' | Eth: '' ###
### The following interface is commented out because:
### * it is a Software Loopback interface
#
# Target[192.168.1.101_lo]: #lo:public@192.168.1.101:
# SetEnv[192.168.1.101_lo]: MRTG_INT_IP="127.0.0.1" MRTG_INT_DESCR="lo"
# MaxBytes[192.168.1.101_lo]: 1250000
# Title[192.168.1.101_lo]: Traffic Analysis for lo -- Thiago
# PageTop[192.168.1.101_lo]: <h1>Traffic Analysis for lo -- Thiago</h1>
# <div id="sysdetails">
# <table>
# <tr>
# <td>System:</td>
# <td>Thiago in Sitting on the Dock of the Bay</td>
# </tr>
# <tr>
# <td>Maintainer:</td>
# <td>Me <me@example.org></td>
# </tr>
# <tr>
# <td>Description:</td>
# <td>lo </td>
# </tr>
# <tr>
# <td>ifType:</td>
# <td>softwareLoopback (24)</td>
# </tr>
# <tr>
# <td>ifName:</td>
# <td>lo</td>
# </tr>
# <tr>
# <td>Max Speed:</td>
# <td>1250.0 kBytes/s</td>
# </tr>
# <tr>
# <td>Ip:</td>
# <td>127.0.0.1 (localhost.localdomain)</td>
# </tr>
# </table>
# </div>
### Interface 2 >> Descr: 'eth0' | Name: 'eth0' | Ip: '192.168.1.101' | Eth: '30-78-30-38-30-30-32-37-34-64-32-66-35-32' ###
### The following interface is commented out because:
### * has a speed of 0 which makes no sense
#
# Target[192.168.1.101_eth0]: #eth0:public@192.168.1.101:
# SetEnv[192.168.1.101_eth0]: MRTG_INT_IP="192.168.1.101" MRTG_INT_DESCR="eth0"
# MaxBytes[192.168.1.101_eth0]: 0
# Title[192.168.1.101_eth0]: Traffic Analysis for eth0 -- Thiago
# PageTop[192.168.1.101_eth0]: <h1>Traffic Analysis for eth0 -- Thiago</h1>
# <div id="sysdetails">
# <table>
# <tr>
# <td>System:</td>
# <td>Thiago in Sitting on the Dock of the Bay</td>
# </tr>
# <tr>
# <td>Maintainer:</td>
# <td>Me <me@example.org></td>
# </tr>
# <tr>
# <td>Description:</td>
# <td>eth0 </td>
# </tr>
# <tr>
# <td>ifType:</td>
# <td>ethernetCsmacd (6)</td>
# </tr>
# <tr>
# <td>ifName:</td>
# <td>eth0</td>
# </tr>
# <tr>
# <td>Max Speed:</td>
# <td>0.0 Bytes/s</td>
# </tr>
# <tr>
# <td>Ip:</td>
# <td>192.168.1.101 (Thiago)</td>
# </tr>
# </table>
# </div>
mrtg /etc/mrtg/teste.cfg
-----------------------------------------------------------------------
ERROR: Mrtg will most likely not work properly when the environment
variable LANG is set to UTF-8. Please run mrtg in an environment
where this is not the case. Try the following command to start:
env LANG=C /usr/bin/mrtg /etc/mrtg/teste.cfg
-----------------------------------------------------------------------
Na pasta quando rodo o env LANG=C mrtg /etc/mrtg/xxx.cfg ele cria o arquivo html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<TITLE>MRTG Index Page</TITLE>
<!-- Command line is easier to read using "View Page Properties" of your browser -->
<!-- But not all browsers show that information. :-( -->
<meta http-equiv="content-type" content="text/html; charset=iso-8859-15" >
<META NAME="Command-Line" CONTENT="/usr/bin/indexmaker --output=/var/www/mrtg/teste/index.html /etc/mrtg/teste.cfg" >
<META HTTP-EQUIV="Refresh" CONTENT="300" >
<META HTTP-EQUIV="Cache-Control" content="no-cache" >
<META HTTP-EQUIV="Pragma" CONTENT="no-cache" >
<META HTTP-EQUIV="Expires" CONTENT="Mon, 21 Nov 2011 13:24:43 GMT" >
<LINK HREF="favicon.ico" rel="shortcut icon" >
<style type="text/css">
/* commandline was: /usr/bin/indexmaker --output=/var/www/mrtg/teste/index.html /etc/mrtg/teste.cfg */
/* sorry, no style, just abusing this to place the commandline and pass validation */
</style>
</HEAD>
o export LANG=C é para depois não ter que escrever no env
LANG=C não é?
Mas o que achei estranho foi o fato dele não gerar a consulta por padrão para os pcs com Linux, quando dá o cfgmaker.
Meu /etc/snmp/snmpd.conf tá com essa configuração
###############################################################################
#
# EXAMPLE.conf:
# An example configuration file for configuring the Net-SNMP agent ('snmpd')
# See the 'snmpd.conf(5)' man page for details
#
# Some entries are deliberately commented out, and will need to be explicitly activated
#
###############################################################################
#
# AGENT BEHAVIOUR
#
# Listen for connections from the local system only
#agentAddress udp:127.0.0.1:161
# Listen for connections on all interfaces (both IPv4 *and* IPv6)
agentAddress udp:161,udp6:[::1]:161
###############################################################################
#
# SNMPv3 AUTHENTICATION
#
# Note that these particular settings don't actually belong here.
# They should be copied to the file /var/lib/snmp/snmpd.conf
# and the passwords changed, before being uncommented in that file *only*.
# Then restart the agent
# createUser authOnlyUser MD5 "remember to change this password"
# createUser authPrivUser SHA "remember to change this one too" DES
# createUser internalUser MD5 "this is only ever used internally, but still change the password"
# If you also change the usernames (which might be sensible),
# then remember to update the other occurances in this example config file to match.
###############################################################################
#
# ACCESS CONTROL
#
# system + hrSystem groups only
view systemonly included .1.3.6.1.2.1.1
view systemonly included .1.3.6.1.2.1.25.1
# Full access from the local host
rocommunity public localhost
rocommunity public
# Default access to basic system info
rocommunity public default -V systemonly
# Full access from an example network
# Adjust this network address to match your local
# settings, change the community string,
# and check the 'agentAddress' setting above
#rocommunity secret 10.0.0.0/16
# Full read-only access for SNMPv3
rouser authOnlyUser
# Full write access for encrypted requests
# Remember to activate the 'createUser' lines above
#rwuser authPrivUser priv
# It's no longer typically necessary to use the full 'com2sec/group/access' configuration
# r[ou]user and r[ow]community, together with suitable views, should cover most requirements
###############################################################################
#
# SYSTEM INFORMATION
#
# Note that setting these values here, results in the corresponding MIB objects being 'read-only'
# See snmpd.conf(5) for more details
sysLocation Sitting on the Dock of the Bay
sysContact Me <me@example.org>
# Application + End-to-End layers
sysServices 72
#
# Process Monitoring
#
# At least one 'mountd' process
proc mountd
# No more than 4 'ntalkd' processes - 0 is OK
proc ntalkd 4
# At least one 'sendmail' process, but no more than 10
proc sendmail 10 1
# Walk the UCD-SNMP-MIB::prTable to see the resulting output
# Note that this table will be empty if there are no "proc" entries in the snmpd.conf file
#
# Disk Monitoring
#
# 10MBs required on root disk, 5% free on /var, 10% free on all other disks
disk / 10000
disk /var 5%
includeAllDisks 10%
# Walk the UCD-SNMP-MIB::dskTable to see the resulting output
# Note that this table will be empty if there are no "disk" entries in the snmpd.conf file
#
# System Load
#
# Unacceptable 1-, 5-, and 15-minute load averages
load 12 10 5
# Walk the UCD-SNMP-MIB::laTable to see the resulting output
# Note that this table *will* be populated, even without a "load" entry in the snmpd.conf file
###############################################################################
#
# ACTIVE MONITORING
#
# send SNMPv1 traps
trapsink localhost public
# send SNMPv2c traps
trap2sink localhost public
# send SNMPv2c INFORMs
informsink localhost public
# Note that you typically only want *one* of these three lines
# Uncommenting two (or all three) will result in multiple copies of each notification.
#
# Event MIB - automatically generate alerts
#
# Remember to activate the 'createUser' lines above
iquerySecName internalUser
rouser internalUser
# generate traps on UCD error conditions
defaultMonitors yes
# generate traps on linkUp/Down
linkUpDownNotifications yes
###############################################################################
#
# EXTENDING THE AGENT
#
# Note that this last entry requires the script '/tmp/shtest' to be created first,
# containing the same three shell commands, before the line is uncommented
# Walk the NET-SNMP-EXTEND-MIB tables (nsExtendConfigTable, nsExtendOutput1Table
# and nsExtendOutput2Table) to see the resulting output
# Note that the "extend" directive supercedes the previous "exec" and "sh" directives
# However, walking the UCD-SNMP-MIB::extTable should still returns the same output,
# as well as the fuller results in the above tables.
# Note that this requires one of the two 'passtest' scripts to be installed first,
# before the appropriate line is uncommented.
# These scripts can be found in the 'local' directory of the source distribution,
# and are not installed automatically.
# Walk the NET-SNMP-PASS-MIB::netSnmpPassExamples subtree to see the resulting output
#
# AgentX Sub-agents
#
# Run as an AgentX master agent
master agentx
# Listen for network connections (from localhost)
# rather than the default named socket /var/agentx/master
#agentXSocket tcp:localhost:705
Será que tem algo errado?
Obrigado
6. Re: Como configurar o MRTG no Ubuntu.
th2milusa Ubuntu
Post recolhido
Enviado em 21/11/2011 - 23:35h
Consegui rodar
Antes de executar o cfgmaker tenho que reiniciar o serviço do snmpd da máquina agente (não sei porque ainda), mas funcionou.
Se por acaso souber
Obrigado
Usamos cookies essenciais para manter o site funcionando e Google Analytics para métricas de audiência. Cookies de anúncios só serão carregados se você permitir.