MRTG cfgmaker - generating cfg file correctly

Hi all,

Having an issue generating the cfg file for MRTG. I believe it's because I simply don't understand the community@router.abc.xyz command, among other things. This is for the purpose of monitoring routers through MRTG configuration files accessed by Nagios.

The routers to be monitored are connected through point 2 point VPN tunnels, as 192.168.1.1, 192.168.2.1, 192.168.3.1, etc. 14 different locations need to be added to the configuration file for monitoring. The Ubuntu server running Nagios and MRTG has VPN tunnels active for all locations. Here's what I currently have:

./cfgmaker --global 'WorkDir: /home/httpd/mrtg' --global 'Options[_]: bits,growright' --ifref=ip --output /home/mrtg/cfg/MCP1_Sonicwall.cfg community@192.168.1.1

In this example, I'm creating a cfg file for just the first router (location name is MCP1), but I understand that I can put every location in one file for Nagios to read from?

The errors I'm getting with the above example are:

WARNING: Skipping community@192.168.1.1: as no info could be retrieved
ERROR: creating /home/mrtg/cfg/MCP1_Sonicwall.cfg: No such file or directory


If anybody could help with the exact syntax that could get me up and running with this, that would be really helpfull. Or even explaining to me what the things I'm doing wrong mean and what -should- be there. I'd actually prefer an explanation so that I can understand further.

Thanks!
howejustinAsked:
Who is Participating?
 
giltjrCommented:
cfgmaker tries to gather information from the target device.

The warning message you recieved "Skipping community@192.168.1.1: as no info could be retrieved"  means that it got nothing back from that device using that community name.  So:

1) the commuity name is wrong.
2) the device is not running a snmp agent
3) the device has a firewall running on it and is not allowin inbound udp requestion to port 161 from the device you are running cfgmaker on
4) there is a firewall between the target device and your source computer blocking traffic.

I wil have to check, but I beleive the error is because cfgmaker could not get the snmp information.
0
 
howejustinAuthor Commented:
Thanks giltjr, that helps. Turns out the firewall is what was stopping it. I had created the UDP rule, but it was disabled for some reason.

Now, I don't get any error messages when doing that, but I do when testing MRTG. After entering this:

env LANG=C  /usr/local/mrtg-2/bin/mrtg /home/mrtg/cfg/mrtg.cfg
(I added the env LANG=C because without it, it said I needed that as the LANG was set to UTF-8)

I get this as the output:

ERROR: Creating templock /home/mrtg/cfg/mrtg.cfg_l_20539: Permission denied at /usr/local/mrtg-2/bin/mrtg line 1968.

What do you think could be the problem?

Thanks again for your help, it seems you're the only one here who knows this stuff :)
0
 
giltjrCommented:
Yo need to check the permissions on "/home/mrtg/cfg".  Whatever userid is running the mrtg command does not have write authority to it.

No, there are a LOT of people that know way more than I, its just I may be the only one that saw this.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
howejustinAuthor Commented:
That's what I meant by the only person here, as in this post.

I didn't think that was the problem earlier, as I even ran it as sudo, but changing all other access to read and write did fix that problem. Now, I'm getting this:

Use of uninitialized value $first in pattern match (m//) at /usr/local/mrtg-2/bin/../lib/mrtg2/MRTG_lib.pm line 631.
Use of uninitialized value $dir in concatenation (.) or string at /usr/local/mrtg-2/bin/mrtg line 2665.
Use of uninitialized value $dir in concatenation (.) or string at /usr/local/mrtg-2/bin/mrtg line 2683.
Use of uninitialized value $dir in concatenation (.) or string at /usr/local/mrtg-2/bin/mrtg line 2699.
ERROR: "WorkDir" not specified in mrtg config file
administrator@Justin-Ubuntu10:/usr/local/mrtg-2/bin$ sudo gedit /usr/local/mrtg-2/bin/mrtg

Funny thing is, the config file that the previous command at first created does specify the workdir as:

WorkDir: /home/httpd/mrtg

It's not commended out either.

If you want me to create a new topic for these new problems and award you the points for the initial reason, that's OK with me. Technically these are new problems and might be better suited for a broad topic of "Help with configuring MRTG" or something like that. Would you think that's best, or keep it here?
0
 
howejustinAuthor Commented:
FYI: the final line of my pasted script shows me opening the mrtg perl file, which I know is not the config file. That was just something I was looking up line numbers for to see if I could find the problems with uninitialized values.
0
 
giltjrCommented:
Typically the mrtg commands are run from crontab under root, so I am suprised that running it with sudo failed.

No need to open a new question.  We can deal with it here.

Can you verify that /home/httpd/mrtg does exists and check to see what the permissions are?
0
 
howejustinAuthor Commented:
There's the problem, it doesn't. The /home/mrtg/ directory didn't exist either, or wasn't created when I installed MRTG, so I actually manually created that one as well as the cfg subdir. Looks like something may have gone wrong with the installationt then, since both the /mrtg and /httpd directories weren't created.

What would you suggest I do at this point? I don't mind starting over, if that's the best thing. I just never got any errors up until what you've seen me post here, so I figured everything went OK.

On a side note, I haven't used Linux in over ten years, and it's definitely showing. Windows has corrupted my brain :p
0
 
giltjrCommented:
It is up to you.

It has been awhile since I last installed MRTG.  I use OpenSUSE and RedHat/Fedora and so I use RPM's.  I generally create the working directries where I want them instead of using what the RPM's use.

0
 
howejustinAuthor Commented:
Ok, thanks for the advice.

As far as the missing directories, do you see any harm in simply creating the files that it is not finding? I'm not sure if the program needs other files while it's running (that also aren't created automatically) that could stop it from working correctly.
0
 
howejustinAuthor Commented:
I ended up changing the working dir to a subdir in my nagios directory, and it worked. Now I can navigate to my nagios/mrtg folder through my URL and it views the graphs. Thanks for your help, it sparked the right direction for me to go.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.