Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
SNMP & MRTG made in easy
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2, 3, 4  
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
jkroon
Tux's lil' helper
Tux's lil' helper


Joined: 15 Oct 2003
Posts: 110
Location: South Africa

PostPosted: Fri Mar 23, 2007 10:06 pm    Post subject: Reply with quote

Hmm, I just had an epiphany. MRTG assumes the byte counter needs to always keep on incrementing right? What happens when it actually decreases? In ZA ppp connections for ADSL cannot last longer than 24 hours. So what happens if in a 24 hour session I download say 100MB, after which the byte counters resets ... either mrtg is going to assume something went wrong and graph zero, or it's going to "overflow" causing the result to be larger than maxbytes, and still plot zero. Does this make sense? Is there a way to work around this?

Whilst the above does make sense in a strange way, I'm still not convinced that it's an mrtg issue however, since I can run the following command:

watch -d -n 1 -- "snmpwalk -Os -c public -v 2c localhost | grep ^if.*\\\\.2\ "

And observe ethadsl actually showing changing byte counters that are in sync with those shown in ifconfig ethadsl. However, doing the same but for interface 5 shows that the byte counters are out of sync with ifconfig, both the RX and TX byte counters are much _higher_ in snmp than in ifconfig:

Code:
ppp0      Link encap:Point-to-Point Protocol
          inet addr:196.209.79.222  P-t-P:196.209.64.1  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1492  Metric:1
          RX packets:68815 errors:0 dropped:0 overruns:0 frame:0
          TX packets:63869 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3
          RX bytes:35760423 (34.1 Mb)  TX bytes:12684844 (12.0 Mb)


Code:
ifIndex.5 = INTEGER: 5
ifDescr.5 = STRING: ppp0
ifType.5 = INTEGER: ppp(23)
ifInOctets.5 = Counter32: 127945692
ifInUcastPkts.5 = Counter32: 215629
ifOutOctets.5 = Counter32: 48721733
ifOutUcastPkts.5 = Counter32: 212804
ifHCInOctets.5 = Counter64: 127945692
ifHCInUcastPkts.5 = Counter64: 215629
ifHCOutOctets.5 = Counter64: 48721733
ifHCOutUcastPkts.5 = Counter64: 212804


Bug in snmp?

Or perhaps take a look at this:

Code:
ifName.1 = STRING: lo
ifName.2 = STRING: ethadsl
ifName.3 = STRING: ethtt
ifName.4 = STRING: ethlan
ifName.15 = STRING: ppp0


Those numbers are NOT consecutive. This is directly after restarting snmpd, earlier I had this:

Code:
ifName.1 = STRING: lo
ifName.2 = STRING: ethadsl
ifName.3 = STRING: ethtt
ifName.4 = STRING: ethlan
ifName.5 = STRING: ppp0
ifName.6 = STRING: ppp0
ifName.7 = STRING: ppp0
ifName.8 = STRING: ppp0
ifName.9 = STRING: ppp0
ifName.10 = STRING: ppp0
ifName.11 = STRING: ppp0
ifName.12 = STRING: ppp0
ifName.13 = STRING: ppp0
ifName.14 = STRING: ppp0
ifName.15 = STRING: ppp0


Which to me indicates that one needs to locate the currently "up" ppp0 interface. However, why does snmp keep on adding more and more interfaces? Anyhow, the current numbers can be found with the following command it seems:

Code:
# ip link show | awk -F'[: ]+' '$1 != "" { print $1 " " $2 }'
1 lo
2 ethadsl
3 ethtt
4 ethlan
15 ppp0


Or by inspecting the ifAdminStatus or the ifOperStatus fields in snmp.

Right, I'll adjust my script to use the ip link show hack to determine the matchups with device numbers to device names and report back in a couple of days (just post if I forget - which I probably will). In the meantime, I reckon it's still a bug that snmpd doesn't purge dead devices from being exposed. It'll eventually lead to exhaustion of memory resources imho. Probably.
_________________
There are 10 kinds of people in the world,
those who understand binary and who don't
Back to top
View user's profile Send private message
LiquidRain
n00b
n00b


Joined: 15 Jun 2004
Posts: 29

PostPosted: Sat Mar 24, 2007 5:06 pm    Post subject: Reply with quote

Well, these little scripts seem to do the job for monitoring PPP devices.

/etc/mrtg/ppp0.pl :
Code:
#!/usr/bin/perl

open (TX, "/sbin/ifconfig ppp0 | /bin/grep 'RX bytes' |");
($garbage, $work, $work2) = split(":", <TX>);
($rx, $garbage) = split(" ", $work);
($tx, $garbage) = split(" ", $work2);
print "$rx\n$tx\n";
close (TX);

/etc/mrtg/ppp0.cfg :
Code:
EnableIPv6: no
WorkDir: /var/www/mrtg/
Options[_]: growright
Target[localhost_ppp0]: `/etc/mrtg/ppp0.pl`
MaxBytes[localhost_ppp0]: 1000000
Title[localhost_ppp0]: DSL Internet - ppp0
PageTop[localhost_ppp0]: <h1>DSL</h1>


It's fugly but it does the job for my PPP connection.
Back to top
View user's profile Send private message
jkroon
Tux's lil' helper
Tux's lil' helper


Joined: 15 Oct 2003
Posts: 110
Location: South Africa

PostPosted: Sat Mar 24, 2007 10:14 pm    Post subject: Reply with quote

Not remotely it doesn't :). But yes, it'll do the job if you don't have that need. For remote my ip link show trick also doesn't work and you need to use snmpwalk to find all the up interfaces, something like:

Code:
eval "$(snmpwalk -Os -c public -v 2c localhost ifName | awk -F'[.= ]+' '{ print "devname[" $2 "]=" $4 }')"
eval "$(snmpwalk -Os -c public -v 2c localhost ifOperStatus | awk -F'[. (]+' '$5=="up" { print "echo " $2 " ${devname[" $2 "]}" }')"


Which will output the following:

Quote:
1 lo
2 ethadsl
3 ethtt
4 ethlan
16 ppp0


Even though device 15 also maps to ppp0. Monitoring the appropriate device number seems to be working so far, but Monday will tell for sure when there is actually a bunch of traffic going over the particular line. So far the only strangeness I've seen was on the ppp reconnect where I've somehow managed to obtain 120Mbps over a 4Mbps ADSL line ... <sarcasm>sure</sarcasm>. I'm betting this is something to do with wrapping, and I recall there being some mrtg option to mitigate this effect I'm seeing.
_________________
There are 10 kinds of people in the world,
those who understand binary and who don't
Back to top
View user's profile Send private message
suprnaut
n00b
n00b


Joined: 14 Apr 2007
Posts: 5

PostPosted: Sun Apr 15, 2007 4:21 pm    Post subject: CPU utilization graph shows 0% Reply with quote

Hi. I have the same problem as Tuinslak; "(...) also my cpu is quite idle (nonstop 0%), this isn't correct as it should be at least have 10% load..." (I see now that he has figured it out, or atleast his CPU load is updating - as seen on his mrtg site; http://mrtg.rootspirit.com/ - I'll PM him).

I have a dual p3 CPU, running on a gentoo install with 2.6 kernel. Everything besides Active CPU load works great.

My /etc/mrtg/cpu.cfg is as follows;
Code:
WorkDir: /var/www/localhost/htdocs/mrtg
LoadMIBs: /usr/share/snmp/mibs/UCD-SNMP-MIB.txt
Target[localhost.cpu]:ssCpuRawUser.0&ssCpuRawUser.0:public@localhost + ssCpuRawSystem.0&ssCpuRawSystem.0:public@localhost + ssCpuRawNice.0&ssCpuRawNice.0:public@localhost
RouterUptime[localhost.cpu]: public@localhost
MaxBytes[localhost.cpu]: 100
Title[localhost.cpu]: CPU Load
PageTop[localhost.cpu]: <H1>Active CPU Load %</H1>
Unscaled[localhost.cpu]: ymwd
ShortLegend[localhost.cpu]: %
YLegend[localhost.cpu]: CPU Utilization
Legend1[localhost.cpu]: Active CPU in % (Load)
Legend2[localhost.cpu]:
Legend3[localhost.cpu]:
Legend4[localhost.cpu]:
LegendI[localhost.cpu]:  Active
LegendO[localhost.cpu]:
Options[localhost.cpu]: growright,nopercent,gauge,pngdate

Trying to run
Code:
while true; do echo -n " "; done

generates a steady 25-30% usage (seen in top), but nothing is generated on the MRTG cpu graph.

My cpu job is at
Code:
 #!/bin/sh
/usr/bin/mrtg /etc/mrtg/cpu.cfg

and I know it works, because pngdate is updating the image with the right date, but the load showing on the graph is at a steady 0%..

Any ideas how I can fix this? I have tried to use ssCpuRawUser.1&ssCpuRawUser.1: etc. instead of 0 (because I have multiple CPUs i thought maybe perhaps, though I don't know exactly what I was doing and I know it was a long shot, it would work, but it only returned error messages that SNMP could not find ssCpuRawUser.1 or something..)

Haven't seen any other one with this problem! I have looked in both mrtg threads in this forum and searched all over the place. Please reply.
Back to top
View user's profile Send private message
jkroon
Tux's lil' helper
Tux's lil' helper


Joined: 15 Oct 2003
Posts: 110
Location: South Africa

PostPosted: Mon Apr 16, 2007 6:38 am    Post subject: Reply with quote

dual p3.

That means MaxBytes needs to be 200.
_________________
There are 10 kinds of people in the world,
those who understand binary and who don't
Back to top
View user's profile Send private message
suprnaut
n00b
n00b


Joined: 14 Apr 2007
Posts: 5

PostPosted: Mon Apr 16, 2007 9:39 am    Post subject: MaxBytes Reply with quote

Well, I tried that as well. The only thing that happened was that the Y axis grew in height to 200. . But I haven't tried it with 200 in the *.cfg and running it over time. Thanks for the tip, but if that does not solve my problem?

There is absolutely no sign of MRTG capturing any work load on my CPUs, but I'll try with MaxBytes = 200 when I get home from school :P

UPDATE: changing MaxBytes to 200 had absolutely no impact. ..
Back to top
View user's profile Send private message
jkroon
Tux's lil' helper
Tux's lil' helper


Joined: 15 Oct 2003
Posts: 110
Location: South Africa

PostPosted: Mon Apr 16, 2007 4:44 pm    Post subject: Reply with quote

Drop the gauge option. My options are merely "nopercent" and it's working as intented.

Code:
$ snmpwalk -Os -c public -v 2c localhost ssCpuRawUser.0
ssCpuRawUser.0 = Counter32: 50216

_________________
There are 10 kinds of people in the world,
those who understand binary and who don't
Back to top
View user's profile Send private message
suprnaut
n00b
n00b


Joined: 14 Apr 2007
Posts: 5

PostPosted: Mon Apr 16, 2007 7:39 pm    Post subject: Reply with quote

Yeah, removing gauge fixed it.

Code:
Options[localhost.cpu]: growright,nopercent,pngdate


And it is working. Thank you for your help.
Back to top
View user's profile Send private message
anidabi
Tux's lil' helper
Tux's lil' helper


Joined: 05 Feb 2005
Posts: 102
Location: Finland

PostPosted: Sat Jul 21, 2007 7:15 pm    Post subject: Reply with quote

Need help, my MRTG is counting the traffic wrong!

I recently upgraded my network to 1Gbit and made the nessesary changes in mrtg.cfg file. For some reason it doesnt work and mrtg is counting the traffic wrong.

Here is my example of cfg file:
Code:

#------------eth2 Stats--------------
Colours[eth2]: GREEN#00c00c,BLUE#1000ff,DARK MAGENTA#007c79,MAGENTA#00d0cb
Options[eth2]: growright, nobanner, pngdate, noinfo, nopercent
Target[eth2]: \eth2:public@localhost:
SetEnv[eth2]: MRTG_INT_IP="192.168.0.1" MRTG_INT_DESCR="eth2"
MaxBytes[eth2]: 125000000
AbsMax[eth2]: 250000000
Title[eth2]: eth2 -- assrammers.org
PageTop[eth2]: <H1>eth2 -- assrammers.org</H1>
 <TABLE>
    <TR><TD>Maintainer:</TD> <TD>vader &lt;<a href="mailto:vader@gmail.com" target="_blank">vader@gmail.com</a>&gt;</TD></TR>
    <TR><TD>Description:</TD><TD>Intel Corporation 82541PI Gigabit Ethernet Controller</TD></TR>
    <TR><TD>Max Speed:</TD>  <TD>1 Gbits/s</TD></TR>
    <TR><TD>Ip:</TD>         <TD>192.168.0.1 (CRS-1.assrammers.org)</TD></TR>
 </TABLE>
YLegend[eth2]: Traffic eth2
ShortLegend[eth2]:
LegendI[eth2]: In:
LegendO[eth2]: Out:
Legend1[eth2]: Inbound traffic
Legend2[eth2]: Outbound traffic
Legend3[eth2]: Maximal Inbound traffic
Legend4[eth2]: Maximal Outbound traffic
WithPeak[eth2]: wmy
#Unscaled[eth2]: y
#------------End eth2 Stats----------

Okay, so this worket fine before with my 100mbit LAN connection. I only changed the MaxBytes[eth2]: 125000000, AbsMax[eth2]: 250000000 by adding one digit more and Target[eth2]: \eth2:public@localhost:, SetEnv[eth2]: MRTG_INT_IP="192.168.0.1" MRTG_INT_DESCR="eth2" to correspond the right nic.


The funny thing is that mrtg counts the traffic right for a breaf monemt when I manually update the graphs with this line:
Code:

/etc/cron.mrtg/mrtg.sh && /etc/cron.mrtg/mrtg.sh && /etc/cron.mrtg/mrtg.sh && /usr/bin/indexmaker --output=/var/www/localhost/htdocs/mrtg/index.html --title="<center>Carrier Routing System - CRS-1</center>" --subtitle="<center>" --sort=descr --enumerate /etc/mrtg/mrtg.cfg --nolegend --sort=descr  --pageend "</center><br><br><center><font face="arial" size="-1" color="#999999">MRTG stats powered by gentoo<br>Copyright 2007 by Vader</font></CENTER>"

Any ideas what's wrong?
_________________
How do you do the things you do...
Back to top
View user's profile Send private message
jkroon
Tux's lil' helper
Tux's lil' helper


Joined: 15 Oct 2003
Posts: 110
Location: South Africa

PostPosted: Sat Jul 21, 2007 7:22 pm    Post subject: Reply with quote

Shouldn't absmax be 125000000?
_________________
There are 10 kinds of people in the world,
those who understand binary and who don't
Back to top
View user's profile Send private message
anidabi
Tux's lil' helper
Tux's lil' helper


Joined: 05 Feb 2005
Posts: 102
Location: Finland

PostPosted: Sat Jul 21, 2007 9:11 pm    Post subject: Reply with quote

jkroon wrote:
Shouldn't absmax be 125000000?

Doesn't change anything, still reports speed around 8MB/s.
_________________
How do you do the things you do...
Back to top
View user's profile Send private message
jkroon
Tux's lil' helper
Tux's lil' helper


Joined: 15 Oct 2003
Posts: 110
Location: South Africa

PostPosted: Sat Jul 21, 2007 10:10 pm    Post subject: Reply with quote

Are you maxing the 1Gbps link out? Remember that the counters are 32-bit (byte counters, so 35-bit bit counters). So working in MB we can get to 125MB in exactly 1 second, 1GB in 8 seconds, and 4GB in 32 seconds. To be exact, you can wrap that counter around in 34.35 seconds. At 100Mbps this would take 343.5 seconds. The difference? At Gbps speeds this is less than the mrtg 5 min interval. So if you are running at anything faster than 14316557 bytes/s (14MB/s) you are going to be running into wrapping issues, and you need to use the higher-precision values, can't remember where exactly to obtain then from, but you can no longer accurately use the standard 32-bit counters.
_________________
There are 10 kinds of people in the world,
those who understand binary and who don't
Back to top
View user's profile Send private message
anidabi
Tux's lil' helper
Tux's lil' helper


Joined: 05 Feb 2005
Posts: 102
Location: Finland

PostPosted: Sun Jul 22, 2007 9:17 pm    Post subject: Reply with quote

Yes, you are right, it is because the 32bit counters aren't big enought. What changes I have to make to use the 64bit counters?
_________________
How do you do the things you do...
Back to top
View user's profile Send private message
jkroon
Tux's lil' helper
Tux's lil' helper


Joined: 15 Oct 2003
Posts: 110
Location: South Africa

PostPosted: Sun Jul 22, 2007 9:34 pm    Post subject: Reply with quote

I wish I knew ...
_________________
There are 10 kinds of people in the world,
those who understand binary and who don't
Back to top
View user's profile Send private message
anidabi
Tux's lil' helper
Tux's lil' helper


Joined: 05 Feb 2005
Posts: 102
Location: Finland

PostPosted: Tue Aug 14, 2007 10:57 am    Post subject: Reply with quote

Help! I can't get 64bit counters to work. :(
_________________
How do you do the things you do...
Back to top
View user's profile Send private message
anidabi
Tux's lil' helper
Tux's lil' helper


Joined: 05 Feb 2005
Posts: 102
Location: Finland

PostPosted: Tue Aug 14, 2007 12:36 pm    Post subject: Reply with quote

Arrgh... It couldn't be any simpler... good damn! :? :roll:

I changet

Code:
Target[eth2]: \eth2:public@localhost


to

Code:
Target[eth2]: \eth2:public@localhost:::::2


and now it works.
_________________
How do you do the things you do...
Back to top
View user's profile Send private message
Spinner_Kontrol
n00b
n00b


Joined: 16 Jan 2005
Posts: 6

PostPosted: Mon Dec 10, 2007 10:38 am    Post subject: Reply with quote

I too kept having problems with ppp counters stopping coz the ppp index would change in snmp and there would be multiple ppp0 entries, with only one of them being up.
I found that doing a restart on snmpd, all the ifname ppp0's that were down were flushed out leaving just the 1 ppp0 entry, the one that I want to monitor - i.e. Target[ppp0]: \ppp0:public@localhost::::2

Code:
cat /etc/cron.mrtg/traffic.sh
#!/bin/sh
if (( `snmpwalk -v2c -Os -c public localhost ifname | grep ppp | wc -l` != 1 )) ; then
 /etc/init.d/snmpd restart &>/dev/null
fi
/usr/bin/mrtg /etc/mrtg/traffic.cfg


obviously, this is really only any good if you're monitoring the local machine, but I'd say that's the case most of the time anyway. If anyone else has a better way to work around ppp IFs that keep changing their index and sneakily avoid monitoring, I'd be interested to see how it's done.

PS. if you have more than 1 ppp device, you might want to change the "!= 1" part of it to however many ppp devices you expect to be running
Back to top
View user's profile Send private message
rek2
Guru
Guru


Joined: 05 Jan 2003
Posts: 477
Location: Boston USA/Barcelona Spain

PostPosted: Tue Feb 05, 2008 5:18 pm    Post subject: Reply with quote

Hi I have mrtg installed working fine.. most of the servers I monitor have a cap bandwidth of 10M, the nic cards are 10/100,
so after talking with the ISP they put the cap at 20M now.. but the mrtg graphs have not changed and sometimes when it peeks it gets
to the max of the graphic an can't see were it really when to..
how can I increment the cap?
_________________
http://www.dailyradical.org
http://www.binaryfreedom.info
use jabber!!! sing on now, register an account:
http://jabber.binaryfreedom.info
Back to top
View user's profile Send private message
aztech
Tux's lil' helper
Tux's lil' helper


Joined: 29 Jul 2002
Posts: 130
Location: Stenungsund, Sweden

PostPosted: Thu Apr 10, 2008 6:29 pm    Post subject: cpu.cfg error Reply with quote

I can't get my cpu.cfg to work.
When running
Code:
mrtg cpu.cfg

the result is ..
Code:

bionic mrtg # mrtg cpu.cfg                                                     
ERROR: CFG Error Unknown Option "sscpurawsystem.0&sscpurawsystem.0" on line 5 or
 above.                                                                         
           Check doc/reference.txt for Help


I've tried with having the Target[localhost.cpu]: .... on the same line, break it up in to several line,
but the result is still the same.

My cpu.cfg
Code:

WorkDir: /var/www/localhost/htdocs/mrtg                                         
LoadMIBs: /usr/share/snmp/mibs/UCD-SNMP-MIB-txt                                 
Target[localhost.cpu]:ssCpuRawUser.0&ssCpuRawUser.0:public@127.0.0.1+           
ssCpuRawSystem.0&ssCpuRawSystem.0:public@127.0.0.1+                             
ssCpuRawNice.0%ssCpuRawNice.0:public@127.0.0.1                                 
RouterUptime[localhost.cpu]: public@127.0.0.1                                   
MaxBytes[localhost.cpu]: 100                                                   
Title[localhost.cpu]: CPU Load                                                 
PageTop[localhost.cpu]: <H1>Active CPU Load %</H1>                             
Unscaled[localhost.cpu]: ymwd                                                   
ShortLegend[localhost.cpu]: %                                                   
YLegend[localhost.cpu]: CPU Utilization                                         
Legend1[localhost.cpu]: Active CPU in % (Load)                                 
Legend2[localhost.cpu]:                                                         
Legend3[localhost.cpu]:                                                         
Legend4[localhost.cpu]:                                                         
LegendI[localhost.cpu]:  Active                                                 
LegendO[localhost.cpu]:                                                         
Options[localhost.cpu]: growright,nopercent

I can't se whats wrong, can you, anyone ?

BR
Andreas
Back to top
View user's profile Send private message
sleepingsun
Guru
Guru


Joined: 03 May 2006
Posts: 370
Location: Bosnia

PostPosted: Sun Jul 20, 2008 10:25 am    Post subject: Reply with quote

I installed MRTG but i have problems with CPU, Mem, Swap !

When i type :
Quote:

/etc/cron.mrtg/cpu


i get error massage :

Code:
Unknown SNMP var ssCpuRawUser.0
 at /usr/bin/mrtg line 2202
Unknown SNMP var ssCpuRawUser.0
 at /usr/bin/mrtg line 2202
2008-07-20 12:18:48: WARNING: Expected a number but got '0:04:24'
2008-07-20 12:18:48: WARNING: Expected a number but got 'bloodflowerz'
Unknown SNMP var ssCpuRawSystem.0
 at /usr/bin/mrtg line 2202
Unknown SNMP var ssCpuRawSystem.0
 at /usr/bin/mrtg line 2202
2008-07-20 12:18:48: WARNING: Expected a number but got '0:04:24'
2008-07-20 12:18:48: WARNING: Expected a number but got 'bloodflowerz'
Unknown SNMP var ssCpuRawNice.0
 at /usr/bin/mrtg line 2202
Unknown SNMP var ssCpuRawNice.0
 at /usr/bin/mrtg line 2202
2008-07-20 12:18:48: WARNING: Expected a number but got '0:04:24'
2008-07-20 12:18:48: WARNING: Expected a number but got 'bloodflowerz'
2008-07-20 12:18:48: ERROR: Target[localhost.cpu][_IN_] ' $target->[0]{$mode}  +                                             $target->[1]{$mode}  +  $target->[2]{$mode} ' (warn): Use of uninitialized val                                           ue in addition (+) at (eval 21) line 1.
2008-07-20 12:18:48: ERROR: Target[localhost.cpu][_OUT_] ' $target->[0]{$mode}                                             +  $target->[1]{$mode}  +  $target->[2]{$mode} ' (warn): Use of uninitialized va                                           lue in addition (+) at (eval 22) line 1.


Also for Memory i get this one massage :

/etc/cron.mrtg/mem

Code:
Unknown SNMP var memAvailReal.0
 at /usr/bin/mrtg line 2202
Unknown SNMP var memAvailReal.0
 at /usr/bin/mrtg line 2202
2008-07-20 12:20:07: WARNING: Expected a number but got '0:05:44'
2008-07-20 12:20:07: WARNING: Expected a number but got 'bloodflowerz'
2008-07-20 12:20:07: ERROR: Target[localhost.mem][_IN_] ' $target->[0]{$mode} ' did not eval into defined data
2008-07-20 12:20:07: ERROR: Target[localhost.mem][_OUT_] ' $target->[0]{$mode} ' did not eval into defined data


and for swap i get this:

/etc/cron.mrtg/swap
Code:
Unknown SNMP var memAvailSwap.0
 at /usr/bin/mrtg line 2202
Unknown SNMP var memAvailSwap.0
 at /usr/bin/mrtg line 2202
2008-07-20 12:21:15: WARNING: Expected a number but got '0:06:52'
2008-07-20 12:21:15: WARNING: Expected a number but got 'bloodflowerz'
2008-07-20 12:21:15: ERROR: Target[localhost.swap][_IN_] ' $target->[0]{$mode} ' did not eval into defined data
2008-07-20 12:21:15: ERROR: Target[localhost.swap][_OUT_] ' $target->[0]{$mode} ' did not eval into defined data


This work till i dont decide to put CPU Temperature and emerge net-snmp with flags lm_sensors !

Is it any way that all works together ?
Back to top
View user's profile Send private message
sdutky
n00b
n00b


Joined: 14 Sep 2006
Posts: 8
Location: Takoma Park MD

PostPosted: Tue Aug 12, 2008 9:22 pm    Post subject: Many thanks for the mrtg kick start - question on templates Reply with quote

Many thanks for the information here: I did it, it worked.

I have list of particular interfaces on each of several cisco devices:

Is there any simple way of feeding them into cfgmaker?

I have looked for an at the filter-template options: they seem like overkill.

I could use cfgmaker to produce a file with all up interfaces and then edit that to prune the ones I don't care about.

Is there a simpler way to accomplish this?

Thanks.
_________________
Ever tried. Ever failed.
No matter.
Try Again. Fail again.
Fail better.
--Samuel Beckett
Back to top
View user's profile Send private message
sdutky
n00b
n00b


Joined: 14 Sep 2006
Posts: 8
Location: Takoma Park MD

PostPosted: Wed Aug 20, 2008 3:50 pm    Post subject: question on templates: skinned cat Reply with quote

not intuitive, not pretty, but it worked:

cfgmaker --global "WorkDir: /home/here/.mrtg" --global "Options[_]: growright,bits" --ifref=name --ifdesc=alias --community=public --subdirs=core_HOSTNAME --noreversedns \
--if-filter='$target_name=~m/Fa0_(?:2|5|6|7|9|10)$/' dhcp@169.254x.214.63 \
--if-filter='$target_name=~m/(?:Fa0_22|Gi0_[12])$/' 169.254x.1.1 \
--if-filter='$target_name=~m/(?:Gi0_1)$/' 169.254x.1.2 \
--if-filter='$target_name=~m/(?:Fa0_(?:11|21|20|22|23)|Gi0_1)$/' 169.254x.1.3 \--if-filter='$target_name=~m/_Fa/' 169.254x.1.4 \
--if-filter='$target_name=~m/Gi0_(?:8|9|10)$/' 169.254x.1.5 \
--if-filter='$target_name=~m/Gi0_(?:7|9|10)$/' 169.254x.1.6
_________________
Ever tried. Ever failed.
No matter.
Try Again. Fail again.
Fail better.
--Samuel Beckett
Back to top
View user's profile Send private message
dcreatorx
Tux's lil' helper
Tux's lil' helper


Joined: 11 Jan 2008
Posts: 111

PostPosted: Thu Jan 29, 2009 9:05 am    Post subject: Reply with quote

Can somebody tell me a very simple thing : how do you configure snmpd.conf to permit an SNMP request from another host that is not localhost ?
I'm trying to modify the file and restarting with what I have read, but I can't get it to work !!

Thanks.
Back to top
View user's profile Send private message
hikarinoko
n00b
n00b


Joined: 29 Sep 2009
Posts: 1

PostPosted: Tue Sep 29, 2009 12:24 pm    Post subject: Reply with quote

Hi everyone !

First, i'd like to thanks the people that created this HOW-TO, it helped me a LOT with MRTG !

still, i'm facing a problem that i can't solve, i've been looking for a lot of ways to get it to work but it just doesn't !

i'm using MRTG @Work, it runs on a SUNOS environement (SunOS 10 i guess)
i wanted to poll some specific data onto an Ironport C660.
As it wasn't on the MIB, i decided to create a script and do like the "PING" part so i did the following :

i tried to test a simple thing that just doesn't work :

script test.sh :

Code:

#!/bin/ksh


retour=`wc -l /usr/local/mrtg-2/bin/pydmm1_conn_state.txt | gawk '{print $1}'`
echo $retour
echo $retour
echo $retour >> /usr/local/mrtg-2/bin/debug.txt
echo
echo


This script count lines in a file (i let this "static" to 197) , running this scripts returns :
Code:

197
197




so i get the "right values" for what i want to do, i then create a config file :
Code:

WorkDir: /usr/local/mrtg-2/www
Include: base-options.inc
### Global Defaults
Options[_]: growright
EnableIPv6: no

Target[test3.cursess]:`/usr/local/mrtg-2/bin/test.sh`
MaxBytes[test3.cursess]: 200000
YLegend[test3.cursess]: whatever
ShortLegend[test3.cursess]: whatever
Options[test3.cursess]:gauge, growright, nopercent
Title[test3.cursess]: whatever ironport
PageTop[test3.cursess]: <H1>whatever ironport</H1>


then i run indexmaker :
Code:
./indexmaker ../conf/testscript.conf --output ../www/test.html

and then i run the thing :
Code:
./mrtg ../conf/testscript.conf --logging test.log


this runs FINE and do the graph with no problem

then i add this to crontabs to get the thing right, THIS IS WHERE THE PROBLEM BEGINS

i go to my crontabs and add the line :
Code:
2,7,12,17,22,27,32,37,42,47,52,57 * * * *  /usr/local/mrtg-2/bin/mrtg /usr/local/mrtg-2/conf/testscript.conf --logging /usr/local/mrtg-2/log/testscript.log


i wait a few minute and my graph stays @ 0, when i cat the log file i get :
Code:

2009-09-29 14:13:16 -- Started mrtg with config '/usr/local/mrtg-2/conf/testscript3.conf'
2009-09-29 14:13:17 -- WARNING: Problem with External get '/usr/local/mrtg-2/bin/test.sh':
   Expected a Number for 'in' but got ''

2009-09-29 14:13:17 -- WARNING: Problem with Externale get '/usr/local/mrtg-2/bin/test.sh':
   Expected a Number for 'out' but got ''

2009-09-29 14:13:17 -- ERROR: Target[test3.cursess][_IN_] ' $target->[0]{$mode} ' did not eval into defined data
2009-09-29 14:13:17 -- ERROR: Target[test3.cursess][_OUT_] ' $target->[0]{$mode} ' did not eval into defined data


i can see that my script doesn't return any data when crontab, after serching for a while i try to change my script with :
Code:

#!/bin/ksh

echo hello
echo world
echo
echo

i obtain

Code:

hello
world


after a few minutes... this is what i get in the logfile...

Code:
2009-09-29 14:13:16 -- Started mrtg with config '/usr/local/mrtg-2/conf/testscript3.conf'
2009-09-29 14:13:17 -- WARNING: Problem with External get '/usr/local/mrtg-2/bin/test.sh':
   Expected a Number for 'in' but got 'hello'

2009-09-29 14:13:17 -- WARNING: Problem with Externale get '/usr/local/mrtg-2/bin/test.sh':
   Expected a Number for 'out' but got 'world'


i really don't understand why with some basic echo it works and why when i try to echo a variable it doesn't ....

i also tried to write my variables into a file whenever my script is used, and so far all i'm getting is an empty file with blank lines at every execution of crontabs....

if someone could help me out... :) THX A LOOOTTTTTT !!!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Goto page Previous  1, 2, 3, 4
Page 4 of 4

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum