# MRTG and setup

## nightcanton

I emerged snmp and MRTG to monitor traffic on my server...

mrtgconfig.conf:

```
WorkDir: /home/httpd/htdocs/mrtg

 Target[r1]: 2:public@lukesteiner.com

 MaxBytes[r1]: 8000

 Title[r1]: Traffic Analysis ISDN

 PageTop[r1]: <H1>Stats for our ISDN Line</H1>
```

This is the basic setup from their site.  I tried making one with CFGMAKER...but it always had an error if I tried to start mrtg.

I haven't received a graph or webpage yet from the service....

I started the service with:

```
root# mrtg /etc/mrtgconfig.conf
```

I waited 15 minutes...which should have made at least 1 graph....

SNMP is started as well...

any ideas?

----------

## internet_pixie

mrtg is used to collect the data to generate the graph(s). You will need something like RRDTool to generate the graphs you want to see.

At least that is always how I have used MRTG

Cheers

internet_pixie

----------

## nightcanton

```
 # mrtg /etc/mrtgconfig.conf

SNMP Error:

no response received

SNMPv1_Session (remote host: "127.0.0.1" [127.0.0.1].161)

                  community: "public"

                 request ID: 1882886554

                PDU bufsize: 8000 bytes

                    timeout: 2s

                    retries: 5

                    backoff: 1)

 at /usr/bin/../lib/mrtg2/SNMP_util.pm line 458

SNMPGET Problem for ifInOctets.2 ifOutOctets.2 on public@127.0.0.1

 at /usr/bin/mrtg line 1678

WARNING: skipping because at least the query for ifInOctets.2 on  127.0.0.1 did not succeed

WARNING: no data for ifInOctets&ifOutOctets:public@127.0.0.1. Skipping further queries for Host 127.0.0.1 in this round.

ERROR: Target[name-of-machine][_IN_] ' $$target[0]{$mode} ' did not eval into defined data

ERROR: Target[name-of-machine][_OUT_] ' $$target[0]{$mode} ' did not eval into defined data

```

This is what I get when I run MRTG.  SNMP is Running.

Here is my SNMP.conf:

```
## /etc/snmpd.conf:

## location of the config files:

party.conf:   /etc/party.conf

acl.conf:     /etc/acl.conf

view.conf:    /etc/view.conf

context.conf: /etc/context.conf

## public- and private-community string (for SNMP V1):

## default is "public" and "private"

public:       newpublic

private:      newprivate

## the entry of system.sysContact and system.sysLocation:

system contact:  sysadmin

system location: systemlocation

## system.sysName is per default determined from the hostname:

system name:     systemname

## trap sink ipaddress (trap destination) and community string.

## authentraps contains the value of snmpEnableAuthenTraps;

## (default is `no'' == disabled).

trap sink:       tcp_ip

trap community:  public

authentraps:     no

```

My MRTG.cfg is:

```
# Global configuration

WorkDir: /var/log/mrtg

WriteExpires: Yes

Logformat: rrdtool

#For every machine

Target[name-of-machine]: 2:public@127.0.0.1

MaxBytes[name-of-machine]: 12500000

Title[name-of-machine]:

PageTop[name-of-machine]:

```

Any Ideas?

----------

## kashani

See if you can snmpwalk your localhost. That's usually a good test. Something like the following is good basic test.

snmpwalk -Os -c public -v 1 localhost system

If that doesn't work then you know it's your snmp server and not MRTG. You may want to to check out some docs I wrote on installing and running MRTG on Gentoo as well.

http://www.badapple.net/mrtg/index.html

kashani

----------

## nightcanton

That didn't work...should I send anything here to help figure out what is going on?

----------

## kashani

If an snmpwalk did not work I'd start troubleshooting your snmp daemon vs looking at MRTG. Start by making sure the daemon is actually running and then reading the threads on snmpd. Nothing jumped out at me in your config, but you might want to check the contents of your acl.conf to make sure you are allowing queries from you IP's and localhost.

kashani

----------

## nightcanton

I don't even have an acl.conf.... :Smile: 

Any Ideas?

Do I need that file?

----------

## nightcanton

I don't even have an acl.conf.... :Smile: 

Any Ideas?

Do I need that file?

----------

## nightcanton

if I do an snmpwalk....

I get 

 *Quote:*   

> timeout: no response from localhost

 

Any ideas?

----------

## think4urs11

start snmpd on localhost   :Rolling Eyes: 

----------

## nightcanton

It is started....

Any Ideas?

----------

## Vergo

 *nightcanton wrote:*   

> It is started....
> 
> Any Ideas?

 

I think the 'problem' is in your snmp.conf since it says that the public community will be renamed to newpublic. So instead of trying

```
snmpwalk -Os -c public -v 1 localhost system
```

you should try

```
snmpwalk -Os -c newpublic -v 1 localhost system
```

If that works then use newpublic also in mrtg.conf

BTW, if you don't need a webpage displaying graphs about traffic then you could try vnStat. It's console-based and doesn't need an snmpd running. See the webpage for few 'screenshots'.

----------

## nightcanton

```
snmp # snmpwalk -Os -c newpublic -v 1 localhost system

Timeout: No Response from localhost

root@lukesteiner snmp # /etc/init.d/snmpd start

 * WARNING:  "snmpd" has already been started.

root@lukesteiner snmp # snmpwalk -Os -c newpublic -v 1 localhost system

Timeout: No Response from localhost

root@lukesteiner snmp # snmpwalk -Os -c public -v 1 localhost system

Timeout: No Response from localhost

root@lukesteiner snmp # nano snmpd.conf

root@lukesteiner snmp # /etc/init.d/snmpd stop 

 * Stopping net-snmpd...                                                  [ ok ]

root@lukesteiner snmp # /etc/init.d/snmpd start

 * Starting net-snmpd...                                                  [ ok ]

root@lukesteiner snmp # snmpwalk -Os -c public -v 1 localhost system

Timeout: No Response from localhost

root@lukesteiner snmp # snmpwalk -Os -c private -v 1 localhost system

Timeout: No Response from localhost

```

I tried what you told me to Vergo....then I changed the config to read "public"insead of "newpublic"...

Still same results.

----------

## nightcanton

```
htdocs # mrtg mrtg.cfg

SNMP Error:

no response received

SNMPv1_Session (remote host: "127.0.0.1" [127.0.0.1].161)

                  community: "public"

                 request ID: 1881147161

                PDU bufsize: 8000 bytes

                    timeout: 2s

                    retries: 5

                    backoff: 1)

 at /usr/bin/../lib/mrtg2/SNMP_util.pm line 458

SNMPGET Problem for ifInOctets.1 ifOutOctets.1 sysUptime sysName on public@127.0.0.1

 at /usr/bin/mrtg line 1678

WARNING: skipping because at least the query for ifInOctets.1 on  127.0.0.1 did not succeed

WARNING: no data for ifInOctets&ifOutOctets:public@127.0.0.1. Skipping further queries for Host 127.0.0.1 in this round.

ERROR: Target[lukesteiner.com][_IN_] ' $$target[0]{$mode} ' did not eval into defined data

ERROR: Target[lukesteiner.com][_OUT_] ' $$target[0]{$mode} ' did not eval into defined data

WARNING: Skipping Update of lukesteiner.com, inlast is not defined

WARNING: Skipping Update of lukesteiner.com, outlast is not defined

```

This is what I get.

----------

## nightcanton

Do I need SNMP to make MRTG work?  Or is there a way to leave it out....

I don't beleive so, but it is worth a shot.  In the MAN and the HOW-TO files for MRTG, the documentation doesn't say anything about SNMP...

----------

## cato`

You could try to use  HotSaNIC instead of MRTG ... Does the same thing as MRTG  (only HotSaNIC is easy to set up)

----------

## kashani

MRTG queries snmp to get its data. If there is no snmp daemon there is no data. This goes for hotsanic, cricket,  and most of the other graphing programs as well.

Rather then assume the init.d startup scripts worked, what does a

ps -ef | grep snmp

show? I highly doubt your snmp daemon is ACTUALLY RUNNING. You'll need to look at you logs and check the other snmpd threads in this forum to troubleshoot it. If it is running it might not be allowing access so you'll need to look at how the access control is setup. 

kashani

----------

