<DIV><includetail>My mrtg.cfg:</DIV>
<DIV>
<DIV style="COLOR: #000">
<DIV> </DIV>
<DIV>########<BR>HtmlDir: /var/www/mrtg<BR>ImageDir: /var/www/mrtg<BR>LogDir: /var/lib/mrtg<BR>ThreshDir: /var/lib/mrtg<BR>Options[_]: growright, bits<BR>#WorkDir: /var/lib/mrtg</DIV>
<DIV> </DIV>
<DIV>Target[switch]: 10101:public@192.168.1.1<BR>MaxBytes[switch]: 12500000<BR>Title[switch]: 3750G Gi1/0/1 Traffic Analysis<BR>PageTop[switch]: <H1>Stats for Gi1/0/1 of 3750G</H1></DIV>
<DIV>#########</DIV>
<DIV> </DIV>
<DIV>[switch] means log file name is switch.log, and it will be created in LogDir. </DIV>
<DIV>10101 is the interface-number that I want to monitor. Use "snmpwalk -v2c -c community-string HOST 1.3.6.1.2.1.31.1.1.1.1" you'll get lines like this: "IF-MIB::ifName.x = STRING: Gi1/0/1" and x is the interface-number.</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>and my switch.cfg:</DIV>
<DIV>#######</DIV>
<DIV>define service{<BR>        use                     generic-service </DIV>
<DIV>        host_name               3750G<BR>        service_description     Gi 1/0/1 Traffic<BR>        check_command           check_local_mrtgtraf!/var/lib/mrtg/switch.log!AVG!500000,1000000!1500000,2000000!10<BR>        }</DIV>
<DIV>#######</DIV>
<DIV> </DIV>
<DIV>The first ARG "/var/lib/mrtg/switch.log" shows where the mrtg log file is. Make sure it's consistent with the settings in your mrtg.cfg.</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>------------------</DIV>
<DIV>
<DIV style="FONT-FAMILY: Verdana; COLOR: #000; FONT-SIZE: 14px">
<DIV>AJay</DIV></DIV></DIV>
<DIV></DIV>
<DIV></DIV>
<DIV> </DIV>
<DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV style="COLOR: #000">
<DIV style="PADDING-BOTTOM: 2px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; FONT-FAMILY: Arial Narrow; FONT-SIZE: 12px; PADDING-TOP: 2px">------------------ Original ------------------</DIV>
<DIV style="FONT-SIZE: 12px">
<DIV id=menu_sender><B>From: </B> "xmanhosting"<anthony@xmanhosting.com.au>;</DIV>
<DIV><B>Date: </B> Mon, Nov 16, 2009 08:00 PM</DIV>
<DIV><B>To: </B> "'AJay'"<ajay@wxsec.com>; </DIV>
<DIV></DIV>
<DIV><B>Subject: </B> RE: [Nagios-users] Final stage of getting MRTG working with Nagios v2</DIV></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN class=468385811-16112009><FONT size=2>Hello Ajay,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=468385811-16112009><FONT size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=468385811-16112009><FONT size=2>Thanks for the reply - however I have no idea what I am looking for in these files as I am new to all of this.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=468385811-16112009><FONT size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=468385811-16112009><FONT size=2>Would you be able to point me in the right direction?</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV align=left><FONT face=Arial><FONT face="Times New Roman"><FONT color=#000080 face=Arial><FONT size=2><FONT size=3><FONT color=#000000 size=2 face="Times New Roman">Kind regards,<BR>Anthony.<BR><BR><BR></FONT></DIV></FONT></FONT></FONT></FONT></FONT>
<DIV> </DIV><BR>
<DIV dir=ltr lang=en-us class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>From:</B> xjtuzmj@qq.com [mailto:xjtuzmj@qq.com] <B>On Behalf Of </B>AJay<BR><B>Sent:</B> Monday, 16 November 2009 11:24 AM<BR><B>To:</B> xmanhosting; nagios-users<BR><B>Subject:</B> Re:[Nagios-users] Final stage of getting MRTG working with Nagios v2<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV>Your mrtg is probably not working correctly, check you <FONT size=2>mrtg.cfg and /var/spool/mail/root to see what's going on with mrtg.</FONT></DIV>
<DIV> </DIV>
<DIV>
<DIV style="FONT-FAMILY: Arial Narrow; COLOR: #909090; FONT-SIZE: 12px">------------------</DIV>
<DIV style="FONT-FAMILY: Verdana; COLOR: #000; FONT-SIZE: 14px">
<DIV>AJay</DIV></DIV></DIV>
<DIV></DIV>
<DIV></DIV>
<DIV> </DIV>
<DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV style="COLOR: #000">
<DIV style="PADDING-BOTTOM: 2px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; FONT-FAMILY: Arial Narrow; FONT-SIZE: 12px; PADDING-TOP: 2px">------------------ Original ------------------</DIV>
<DIV style="FONT-SIZE: 12px">
<DIV id=menu_sender><B>From: </B> "xmanhosting"<anthony@xmanhosting.com.au>;</DIV>
<DIV><B>Date: </B> Sat, Nov 14, 2009 12:27 PM</DIV>
<DIV><B>To: </B> "nagios-users"<nagios-users@lists.sourceforge.net>; </DIV>
<DIV></DIV>
<DIV><B>Subject: </B> [Nagios-users] Final stage of getting MRTG working with Nagios v2</DIV></DIV>
<DIV> </DIV>
<DIV><SPAN class=140001104-14112009><SPAN class=593432404-14112009><FONT size=2>Hello,</FONT></SPAN></SPAN></DIV>
<DIV><SPAN class=140001104-14112009><SPAN class=593432404-14112009><FONT size=2></FONT></SPAN></SPAN> </DIV>
<DIV><SPAN class=140001104-14112009><FONT size=2>I have been fluffing around with Nagios for a couple of weeks, and have nearly finally nailed it.</FONT></SPAN></DIV>
<DIV><SPAN class=140001104-14112009><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=140001104-14112009><FONT size=2>I just have one thing to go.</FONT></SPAN></DIV>
<DIV><SPAN class=140001104-14112009><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=140001104-14112009><FONT size=2>I am trying to get MRTG to work with Nagios.</FONT></SPAN></DIV>
<DIV><SPAN class=140001104-14112009><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=140001104-14112009><FONT size=2>I have got MRGT working locally on my machine<SPAN class=593432404-14112009> , and can see it working by</SPAN> going to these 2 sites <SPAN class=593432404-14112009> (locally) </SPAN>in a browser:</FONT></SPAN></DIV>
<DIV><SPAN class=140001104-14112009><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=140001104-14112009><FONT size=2><A href="http://m33.mail.qq.com/cgi-bin/frame_html?sid=6AuAxsNrmrW1bmsg&r=31ef6d4e0997510a3066d059ab83e370#">file:///usr/local/mrtg-2/share/mrtg2/icons/index.html</A> and </FONT></SPAN></DIV>
<DIV><SPAN class=140001104-14112009><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=140001104-14112009><FONT size=2><A href="http://m33.mail.qq.com/cgi-bin/frame_html?sid=6AuAxsNrmrW1bmsg&r=31ef6d4e0997510a3066d059ab83e370#">file:///usr/local/mrtg-2/share/mrtg2/icons/localhost_2.html</A></FONT></SPAN></DIV>
<DIV><SPAN class=140001104-14112009><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=140001104-14112009><FONT size=2>I followed the tutorial below to set up my router with Nagios:</FONT></SPAN></DIV>
<DIV><SPAN class=140001104-14112009><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=140001104-14112009><FONT size=2><A href="http://www.thegeekstuff.com/2008/11/how-to-monitor-network-switch-and-ports-using-nagios/">http://www.thegeekstuff.com/2008/11/how-to-monitor-network-switch-and-ports-using-nagios/</A></FONT></SPAN></DIV>
<DIV><SPAN class=140001104-14112009><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=140001104-14112009><FONT size=2>however I am yet to get MRTG working with Nagios:</FONT></SPAN></DIV>
<DIV><SPAN class=140001104-14112009><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=140001104-14112009><FONT color=#ff0000 size=2>PING OK 11-14-2009 13:13:56 21d 16h 10m 13s 1/3 PING OK - Packet loss = 0%, RTA = 1.38 ms  </FONT></SPAN></DIV>
<DIV><SPAN class=140001104-14112009><FONT color=#ff0000 size=2>Port 1 Bandwidth Usage UNKNOWN 11-14-2009 13:09:49 21d 16h 8m 43s 3/3 <STRONG><FONT color=#000000>check_mrtgtraf: Unable to open MRTG log file</FONT></STRONG>  </FONT></SPAN></DIV>
<DIV><SPAN class=140001104-14112009><FONT color=#ff0000 size=2>Port 1 Link Status OK 11-14-2009 13:11:29 12d 22h 37m 5s 1/3 SNMP OK - up(1)  </FONT></SPAN></DIV>
<DIV><SPAN class=140001104-14112009><FONT color=#ff0000 size=2>Uptime OK 11-14-2009 13:10:29 12d 22h 27m 57s 1/3 SNMP OK - Timeticks: (152738042) 17 days, 16:16:20.42</FONT></SPAN></DIV>
<DIV><SPAN class=140001104-14112009><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=140001104-14112009><FONT size=2>My switch.cfg currently has the following:</FONT></SPAN></DIV>
<DIV><SPAN class=140001104-14112009><SPAN lang=EN-AU><FONT size=2></FONT></SPAN></SPAN> </DIV>
<DIV><SPAN class=140001104-14112009><SPAN lang=EN-AU><FONT color=#ff0000 size=2># Monitor bandwidth via MRTG logs</FONT></SPAN></SPAN></DIV>
<DIV><SPAN class=140001104-14112009><SPAN lang=EN-AU><FONT size=2><FONT color=#ff0000>define service{<BR>use     generic-service ; Inherit values from a template<BR>host_name    Billion<BR>service_description   Port 1 Bandwidth Usage<BR>check_command   </FONT><FONT color=#000000><STRONG>check_local_mrtgtraf!/usr/local/mrtg-2/share/mrtg2/icons/localhost2.log!AVG!1000000,1000000!5000000,5000000!10</STRONG></FONT></FONT></SPAN></SPAN></DIV>
<DIV><SPAN class=140001104-14112009><SPAN lang=EN-AU><FONT color=#ff0000 size=2>}</FONT></DIV></SPAN></SPAN>
<DIV><SPAN class=140001104-14112009><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=140001104-14112009><TR><TD class=statusEven></TD></TR></SPAN><SPAN class=140001104-14112009><FONT size=2>My localhost2.log is at the location above: <STRONG>/usr/local/mrtg-2/share/mrtg2/icons/localhost2.log</STRONG> ,however I still must have something wrong for it to not work.</FONT></SPAN></DIV>
<DIV><SPAN class=140001104-14112009><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=140001104-14112009><FONT size=2>When I run: /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg , it says: "<STRONG>Things look okay - No serious problems were detected during the pre-flight check</STRONG>"</FONT></SPAN></DIV>
<DIV><SPAN class=140001104-14112009><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=140001104-14112009><FONT size=2>When I run: /usr/local/mrtg-2/bin/mrtg /home/mrtg/cfg/mrtg.cfg , it says: </FONT></SPAN></DIV>
<DIV><SPAN class=140001104-14112009><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=140001104-14112009><FONT size=2>-----------------------------------------------------------------------<BR>ERROR: Mrtg will most likely not work properly when the environment<BR>       variable LANG is set to UTF-8. Please run mrtg in an environment<BR>       where this is not the case. Try the following command to start:</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=140001104-14112009><FONT size=2>       env LANG=C /usr/local/mrtg-2/bin/mrtg /home/mrtg/cfg/mrtg.cfg <BR>-----------------------------------------------------------------------<SPAN class=593432404-14112009> </SPAN></FONT></SPAN></DIV>
<DIV><SPAN class=140001104-14112009><FONT size=2><SPAN class=593432404-14112009></SPAN></FONT></SPAN> </DIV>
<DIV><SPAN class=140001104-14112009><FONT size=2><SPAN class=593432404-14112009>When I run: env LANG=C /usr/local/mrtg-2/bin/mrtg /home/mrtg/cfg/mrtg.cfg  , there are no errors. </SPAN><BR><SPAN class=593432404-14112009> </SPAN></FONT></SPAN></DIV>
<DIV><SPAN class=140001104-14112009><FONT size=2><SPAN class=593432404-14112009>Does anyone know what I am still doing wrong</SPAN></FONT></SPAN></DIV>
<DIV><SPAN class=140001104-14112009><FONT size=2><SPAN class=593432404-14112009></SPAN></FONT></SPAN> </DIV>
<DIV><SPAN class=140001104-14112009><FONT size=2><SPAN class=593432404-14112009>Thanks for any help,</SPAN></FONT></SPAN></DIV>
<DIV><SPAN class=140001104-14112009><FONT size=2><SPAN class=593432404-14112009></SPAN></FONT></SPAN> </DIV>
<DIV><SPAN class=140001104-14112009><FONT size=2><SPAN class=593432404-14112009>Kind regards,</SPAN></FONT></SPAN></DIV>
<DIV><SPAN class=140001104-14112009><FONT size=2><SPAN class=593432404-14112009>Anthony </SPAN></FONT></DIV></SPAN></DIV></DIV></DIV></DIV></DIV></includetail></DIV>