Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
SNMP & MRTG made in easy (Power Under Control ;)
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2, 3, 4, 5, 6  Next  
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
jamesrt
n00b
n00b


Joined: 09 Sep 2003
Posts: 47
Location: New Zealand

PostPosted: Tue Feb 24, 2004 12:15 am    Post subject: Reply with quote

khazad-dum wrote:
Code:
guardian proc # cat /etc/mrtg/mem2.sh
#!/bin/sh
cat /proc/meminfo | grep MemTotal | cut -d ' ' -f 8
cat /proc/meminfo | grep MemFree | cut -d ' ' -f 11

Code:
guardian proc # cat /etc/mrtg/swap2.sh
#!/bin/sh
cat /proc/meminfo | grep SwapFree | cut -d ' ' -f 8
cat /proc/meminfo | grep SwapTotal | cut -d ' ' -f 7


IMPORTANT: man cut !!! The value of fields are different for every /proc/stat.

Perhaps not as elegant, but it saves all the mucking about with trying to work out cut fields if you do this:
Code:
# cat /etc/mrtg/swap2.sh
#!/bin/sh
cat /proc/meminfo | grep SwapFree | awk '{print $2}'
cat /proc/meminfo | grep SwapTotal | awk '{print $2}'
and
Code:
# cat /etc/mrtg/mem2.sh
#!/bin/sh
cat /proc/meminfo | grep MemTotal | awk '{print $2}'
cat /proc/meminfo | grep MemFree | awk '{print $2}'
Back to top
View user's profile Send private message
PedroKiefer
n00b
n00b


Joined: 23 Mar 2003
Posts: 6
Location: Porto Alegre - RS - Brazil

PostPosted: Thu Mar 04, 2004 2:47 pm    Post subject: Reply with quote

Folk's don't use cut, the value of free memory changes over time, and cut doesn't work. so, use awk :D

Code:

cat /etc/mrtg/mem.sh
#!/bin/sh
cat /proc/meminfo | awk '/MemTotal/{print $2}'
cat /proc/meminfo | awk '/MemFree/{print $2}'


works perfectly :)
Back to top
View user's profile Send private message
Strom
n00b
n00b


Joined: 01 Mar 2003
Posts: 36
Location: Estonia, Tallinn

PostPosted: Fri Mar 12, 2004 1:12 pm    Post subject: Reply with quote

Oh btw, if someone hasn't got the CPU graph working or hasn't got multi-cpu graphs working then you may get some ideas from my cpu load script:
Code:

#!/bin/sh
#
# This script calculates CPU usage in %
# (C) 2004 Kaur Kuut
#
# CPU name: (default: cpu0)
CPU_NAME="cpu0"
# Temp dir yo use (default: /tmp/)
TEMP_DIR="/tmp/"
# Sleep time if temp file doesn't exist (default: 10)
SLEEP_TIME="10"
# Output accuracy (default: 0)
ACCURACY="0"



TEMP_FILE="$TEMP_DIR""$CPU_NAME""calc"

# When CPU_NAME is just "cpu" without a number then we need to
# parse data in a different way
if [ $CPU_NAME == "cpu" ]
then
  KNOWN_ISSUE=1
else
  KNOWN_ISSUE=0
fi

USER_CUT=`echo "(2+$KNOWN_ISSUE)" | bc -l`
NICE_CUT=`echo "(3+$KNOWN_ISSUE)" | bc -l`
SYSTEM_CUT=`echo "(4+$KNOWN_ISSUE)" | bc -l`
IDLE_CUT=`echo "(5+$KNOWN_ISSUE)" | bc -l`

# If temp file doesn't exist -> create it and put user,nice,system,idle there
if [ ! -s $TEMP_FILE ]
then
  cat /proc/stat | grep -m1 "^$CPU_NAME" | cut -d ' ' -f 3,4,5,6 > $TEMP_FILE
  sleep $SLEEP_TIME # Sleep for $SLEEP_TIME seconds, otherwise the results will be very ugly
fi


# Loading vars from temp file...
USER_1=`cat $TEMP_FILE | cut -d ' ' -f 1`
NICE_1=`cat $TEMP_FILE | cut -d ' ' -f 2`
SYSTEM_1=`cat $TEMP_FILE | cut -d ' ' -f 3`
IDLE_1=`cat $TEMP_FILE | cut -d ' ' -f 4`

# Geting current ticks..
USER_2=`cat /proc/stat | grep -m1 "^$CPU_NAME" | cut -d ' ' -f $USER_CUT`
NICE_2=`cat /proc/stat | grep -m1 "^$CPU_NAME" | cut -d ' ' -f $NICE_CUT`
SYSTEM_2=`cat /proc/stat | grep -m1 "^$CPU_NAME" | cut -d ' ' -f $SYSTEM_CUT`
IDLE_2=`cat /proc/stat | grep -m1 "^$CPU_NAME" | cut -d ' ' -f $IDLE_CUT`

# Calculating avarage values
USER=`echo "($USER_2-$USER_1)" | bc -l`
NICE=`echo "($NICE_2-$NICE_1)" | bc -l`
SYSTEM=`echo "($SYSTEM_2-$SYSTEM_1)" | bc -l`
IDLE=`echo "($IDLE_2-$IDLE_1)" | bc -l`

# Doing final calculations
IDLE_PERCENT=`echo "(($NICE+$IDLE)/($USER+$NICE+$SYSTEM+$IDLE)*100)" | bc -l`

#echo "(`echo "(101-$IDLE_PERCENT)" | bc -l | cut -d '.' -f 1`-1)" | bc -l
CPU_USAGE=`echo "print round(100-$IDLE_PERCENT,$ACCURACY)" | python`

# Echoing the CPU usage
echo $CPU_USAGE
echo $CPU_USAGE

# Saving current ticks to temp file for another run :)
echo $USER_2 $NICE_2 $SYSTEM_2 $IDLE_2 > $TEMP_FILE

_________________
This is my signature.
Back to top
View user's profile Send private message
Drunkula
Apprentice
Apprentice


Joined: 28 Jul 2003
Posts: 257
Location: Denton, TX - USA

PostPosted: Thu Mar 18, 2004 12:57 am    Post subject: Thanks to this guide! Reply with quote

I got mrtg working on my Sun Ultra 2, with one exception. The CPU is not showing any activity on the graph. I have a dual cpu UltraSparc II box. I DID try to get the second CPU to display as well but was getting errors so I deleted that config and went back to single for now. And, yes, I did see the other post in this thread about additional processors.

Incidentally I saw this on the net-smtp docs webpage..
Code:
    Sorry - the CPU statistics (both original percentages, and the
  newer raw statistics) both refer to the system as a whole.  There
  is currently no way to access individual statistics for a particular
  processor.

    Note that although the Host Resources table includes a hrProcessorTable,
  the current implementation suffers from two major flaws.  Firstly, it
  doesn't currently recognise the presence of multiple processors, and
  simply assumes that all systems have precisely one CPU.  Secondly, it
  doesn't calculate the hrProcessorLoad value correctly, and either returns
  a dummy value (based on the load average) or nothing at all.

    If you want to monitor a multi-processor system, you're currently
  out of luck.  We hope to address this in a future release of the agent.
  But you've got the source, so you can always have a go yourself :-)
Back to top
View user's profile Send private message
Rooney
Apprentice
Apprentice


Joined: 07 Aug 2003
Posts: 193
Location: Sheffield, UK

PostPosted: Thu Mar 18, 2004 9:00 am    Post subject: Wrong Disk Sizes Reply with quote

Why does snmp report the wrong disk size and does any one know how i can set this right.

HOST-RESOURCES-MIB::hrStorageDescr.2 = STRING: /
HOST-RESOURCES-MIB::hrStorageDescr.3 = STRING: /home

HOST-RESOURCES-MIB::hrStorageSize.2 = INTEGER: 4611420
HOST-RESOURCES-MIB::hrStorageSize.3 = INTEGER: 19487056

HOST-RESOURCES-MIB::hrStorageUsed.2 = INTEGER: 837368
HOST-RESOURCES-MIB::hrStorageUsed.3 = INTEGER: 9316812

but this is the reslut of a df

/dev/hda3 18445680 3349352 14159340 20% /
/dev/hdb3 77948224 37267248 36721356 51% /home

Ive tried snmpset but this just reports an error

beaver root # snmpset -v 2c -c root localhost HOST-RESOURCES-MIB::hrStorageSize.3 i 77948224
Error in packet.
Reason: notWritable (that object does not support modification)
Failed object: HOST-RESOURCES-MIB::hrStorageSize.3
Back to top
View user's profile Send private message
Rooney
Apprentice
Apprentice


Joined: 07 Aug 2003
Posts: 193
Location: Sheffield, UK

PostPosted: Thu Mar 18, 2004 3:14 pm    Post subject: Reply with quote

sorry people found a fix by opening my eyes

https://forums.gentoo.org/viewtopic.php?t=109817&highlight=snmp+disk
Back to top
View user's profile Send private message
matt2413
n00b
n00b


Joined: 12 Apr 2003
Posts: 48

PostPosted: Sat Mar 20, 2004 3:49 am    Post subject: Reply with quote

*EDIT* Solved swap on 2.4

So, 2 things.

1. Thanks for the nice guide. Mucho help.

2. So what's the final status of getting mem/swap to work in 2.6+?

Anyone have a solution for multiple CPU's yet?

Thanks for any help.

Matt
Back to top
View user's profile Send private message
Popsikle
n00b
n00b


Joined: 11 Apr 2004
Posts: 6

PostPosted: Sun Apr 11, 2004 6:52 am    Post subject: Reply with quote

Code:

asuka mrtg # mrtg --debug cfg,log  mems.cfg
--cfg: mems.cfg[1]: LoadMIBs: /usr/share/snmp/mibs/HOST-RESOURCES-MIB.txt
--cfg: mems.cfg[2]: Target[localhost.mems]: `/etc/mrtg/swap.sh`
--cfg: mems.cfg[3]: PageTop[localhost.mems]: <H1>Free Swap Memory </H1>
--cfg: mems.cfg[4]: WorkDir: /var/www/localhost/asuka
--cfg: mems.cfg[5]: Options[localhost.mems]: nopercent,growright,gauge,noinfo
--cfg: mems.cfg[6]: Title[localhost.mems]: Free Swap
--cfg: mems.cfg[7]: MaxBytes[localhost.mems]: 1000000
--cfg: mems.cfg[8]: kMG[localhost.mems]: k,M,G,T,P,X
--cfg: mems.cfg[9]: YLegend[localhost.mems]: bytes
--cfg: mems.cfg[10]: ShortLegend[localhost.mems]: bytes
--cfg: mems.cfg[11]: LegendI[localhost.mems]:  Swap Memory:
--cfg: mems.cfg[12]: LegendO[localhost.mems]:
--cfg: mems.cfg[13]: Legend1[localhost.mems]: Swap memory in bytes
--log: Called /usr/bin/rateup /var/www/localhost/asuka/ localhost.mems 1081694833 -Z g 2008116 0 1000000 c #00cc00 #0000ff #006600 #ff00ff l [bytes] k 1000 K k,M,G,T,P,X i /var/www/localhost/asuka/localhost.mems-day.png -1000000 -1000000 400 100 1 1 1 300 0 4 1


When I run the rateup manually:
Code:

asuka mrtg # /usr/bin/rateup /var/www/localhost/asuka/ localhost.mems 1081694833 -Z g 2008116 0 1000000 c #00cc00 #0000ff #006600 #ff00ff l [bytes] k 1000 K k,M,G,T,P,X i /var/www/localhost/asuka/localhost.mems-day.png -1000000 -1000000 400 100 1 1 1 300 0 4 1
Segmentation fault

Is all I get.



Code:
asuka mrtg # cat mem.cfg
LoadMIBs: /usr/share/snmp/mibs/HOST-RESOURCES-MIB.txt
Target[localhost.mem]: .1.3.6.1.4.1.2021.4.6.0&.1.3.6.1.4.1.2021.4.6.0:public@localhost
PageTop[localhost.mem]: <H1>Free Memory </H1>
WorkDir: /var/www/localhost/asuka
Options[localhost.mem]: nopercent,growright,gauge,noinfo
Title[localhost.mem]: Free Memory
MaxBytes[localhost.mem]: 1000000
kMG[localhost.mem]: k,M,G,T,P,X
YLegend[localhost.mem]: bytes
ShortLegend[localhost.mem]: bytes
LegendI[localhost.mem]:  Free Memory:
LegendO[localhost.mem]:
Legend1[localhost.mem]: Free memory, not including swap, in bytes


Code:
asuka mrtg # cat swap.sh
cat /proc/meminfo  | grep SwapFree | awk '{print $2}'
cat /proc/meminfo  | grep SwapCached | awk '{print $2}'
echo "00:00:00"
echo "Swap Memory"


Code:
asuka mrtg # ./swap.sh
2008116
0
00:00:00
Swap Memory


Any Ideas?
Back to top
View user's profile Send private message
his_royal_evilness
n00b
n00b


Joined: 19 Apr 2004
Posts: 6
Location: Rotterdam , The Netherlands

PostPosted: Mon Apr 19, 2004 8:57 am    Post subject: Reply with quote

smtp root # uname -rsv
Linux 2.6.4-gentoo-r1 #1 Sat Apr 3 09:05:56 CEST 2004

I managed to produce graphs for mem/swap :)

My .cfg's :
Mem.cfg :
WorkDir: /var/www/localhost/htdocs/mrtg
Title[mem]: memory used/free - FQDN
Target[mem]: `free | /usr/bin/awk '/Mem: /{print $3*1000; print $4*1000; print ""; print ""}'`
PageTop[mem]: <H1> memory used/free - FQDN </H1>
Options[mem]: gauge
MaxBytes[mem]: 50000000000
Ylegend[mem]: mem
ShortLegend[mem]: mem
XSize[mem]: 350
YSize[mem]: 150
Legend1[mem]: mem&nbsp;
LegendI[mem]: used&nbsp;
LegendO[mem]: free&nbsp;
WithPeak[mem]: ymwd

swap.cfg:
LoadMIBs: /usr/share/snmp/mibs/UCD-SNMP-MIB.txt
Target[localhost.swap]: `free | /usr/bin/awk '/Swap: /{print $3; print $3; print ""; print ""}'`
PageTop[localhost.swap]: <H1>Swap Memory</H1>
WorkDir: /var/www/localhost/htdocs/mrtg
Options[localhost.swap]: nopercent,growright,gauge,noinfo
Title[localhost.swap]: Free Memory
MaxBytes[localhost.swap]: 1000000
kMG[localhost.swap]: k,M,G,T,P,X
YLegend[localhost.swap]: bytes
ShortLegend[localhost.swap]: bytes
LegendI[localhost.swap]: Free Memory:
LegendO[localhost.swap]:
Legend1[localhost.swap]: Swap memory avail, in bytes


Hope i helped ya out :)
_________________
To spoof or not to spoof, that is the packet
----------
(char MyBrain)malloc(sizeof)(MyBrain); **** OUT OF MEMORY ****
Back to top
View user's profile Send private message
thejayjay
n00b
n00b


Joined: 31 Mar 2004
Posts: 11

PostPosted: Wed Apr 21, 2004 4:21 am    Post subject: Reply with quote

I am getting strange results from one of my graphs -- I followed the directions exactly but something isn't coming up right. The numbers for my cable connection fluctuate and are no where near correct, it currently thinks I am downloading at 40-50k a second and seems to only "flatline" around 12-16k a second. If i unplug the cable modem it still sits around 5-8kb a second, what gives?
Back to top
View user's profile Send private message
his_royal_evilness
n00b
n00b


Joined: 19 Apr 2004
Posts: 6
Location: Rotterdam , The Netherlands

PostPosted: Wed Apr 21, 2004 7:49 am    Post subject: Reply with quote

thejayjay wrote:
I am getting strange results from one of my graphs -- I followed the directions exactly but something isn't coming up right. The numbers for my cable connection fluctuate and are no where near correct, it currently thinks I am downloading at 40-50k a second and seems to only "flatline" around 12-16k a second. If i unplug the cable modem it still sits around 5-8kb a second, what gives?

is that pc directly connected to the cable modem?
_________________
To spoof or not to spoof, that is the packet
----------
(char MyBrain)malloc(sizeof)(MyBrain); **** OUT OF MEMORY ****
Back to top
View user's profile Send private message
thejayjay
n00b
n00b


Joined: 31 Mar 2004
Posts: 11

PostPosted: Thu Apr 22, 2004 10:46 am    Post subject: Reply with quote

Yes -- direct cat5 cable straight to the modem. When the machine ran debian and mrtg before it didn't have a problem. I guess that snmp is capturing strange data, how do i check this out and fix it? I followed the guide exactly and i tried reading some of the output from snmpwalk but i do not know exactly what i am looking for.
Back to top
View user's profile Send private message
custo
n00b
n00b


Joined: 22 Apr 2004
Posts: 3

PostPosted: Thu Apr 22, 2004 5:00 pm    Post subject: Reply with quote

Hi! I've been having problems with cpu and storage information from the mibs.

When I try this:
snmpwalk -c public 192.168.0.168 cpu

I get:

UCD-SNMP-MIB::ssCpuRawInterrupt = No Such Object available on this agent at this OID

And the same occurs for storage information. I don't know what to do...please help me!
Back to top
View user's profile Send private message
his_royal_evilness
n00b
n00b


Joined: 19 Apr 2004
Posts: 6
Location: Rotterdam , The Netherlands

PostPosted: Thu Apr 22, 2004 10:57 pm    Post subject: Reply with quote

custo wrote:
Hi! I've been having problems with cpu and storage information from the mibs.

When I try this:
snmpwalk -c public 192.168.0.168 cpu

I get:

UCD-SNMP-MIB::ssCpuRawInterrupt = No Such Object available on this agent at this OID

And the same occurs for storage information. I don't know what to do...please help me!

is the following line present in your .cfg's ?

LoadMIBs: /usr/share/snmp/mibs/HOST-RESOURCES-MIB.txt
_________________
To spoof or not to spoof, that is the packet
----------
(char MyBrain)malloc(sizeof)(MyBrain); **** OUT OF MEMORY ****
Back to top
View user's profile Send private message
custo
n00b
n00b


Joined: 22 Apr 2004
Posts: 3

PostPosted: Fri Apr 23, 2004 8:11 am    Post subject: Reply with quote

Thanks for your fast response

I've already put that line in the cfg but it still doesn't work..

When I do snmpwalk in the console it also should work, shouldn't it? But there's no way to put this info when I do a snmpwalk in the console

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


Joined: 19 Apr 2004
Posts: 6
Location: Rotterdam , The Netherlands

PostPosted: Fri Apr 23, 2004 11:13 am    Post subject: Reply with quote

custo wrote:
Thanks for your fast response

I've already put that line in the cfg but it still doesn't work..

When I do snmpwalk in the console it also should work, shouldn't it? But there's no way to put this info when I do a snmpwalk in the console

Thanks

could you please paste the config here? :)
_________________
To spoof or not to spoof, that is the packet
----------
(char MyBrain)malloc(sizeof)(MyBrain); **** OUT OF MEMORY ****
Back to top
View user's profile Send private message
custo
n00b
n00b


Joined: 22 Apr 2004
Posts: 3

PostPosted: Mon Apr 26, 2004 12:40 pm    Post subject: Reply with quote

Hi! thanks again..I've been out for this weekend

Thanks! I've included the Loadmib and now the cpu load works! but memory usage doesn't....any values are printed on the html page. Always 0.0

And I have another question...some of the hosts I have to monitor are Windows Stations, and I can't find the OID for cpu load and memory usage. How can I do this?

I get something like this on a snmpwalk:

UCD-SNMP-MIB::ssCpuRawUser = No more variables left in this MIB View (It is past the end of the MIB tree)


Lots of thanks
Back to top
View user's profile Send private message
brown
n00b
n00b


Joined: 07 Apr 2004
Posts: 27

PostPosted: Fri Apr 30, 2004 4:33 pm    Post subject: Reply with quote

Great guide, thanks so much.

Anyone have any idea how to get stats for Samba? I'd like to display network usage of samba if possible.
Back to top
View user's profile Send private message
brown
n00b
n00b


Joined: 07 Apr 2004
Posts: 27

PostPosted: Mon May 03, 2004 5:51 pm    Post subject: Reply with quote

khazad-dum wrote:
Folks,

i've finally get memory stat with 2.6 kernel IN MY MACHINE

Code:

guardian proc # cat meminfo
MemTotal:       321380 kB
MemFree:          6760 kB
Buffers:         14052 kB
Cached:         145624 kB
SwapCached:       7076 kB
Active:         167652 kB
Inactive:        86192 kB
HighTotal:           0 kB
HighFree:            0 kB
LowTotal:       321380 kB
LowFree:          6760 kB
SwapTotal:      248968 kB
SwapFree:       229056 kB
Dirty:               0 kB
Writeback:           0 kB
Mapped:         125376 kB
Slab:            57784 kB
Committed_AS:   137320 kB
PageTables:       1116 kB
VmallocTotal:   712504 kB
VmallocUsed:       284 kB
VmallocChunk:   712116 kB


Memory
Code:

guardian proc # cat /etc/mrtg/mem2.sh
#!/bin/sh
cat /proc/meminfo | grep MemTotal | cut -d ' ' -f 8
cat /proc/meminfo | grep MemFree | cut -d ' ' -f 11


Code:

guardian proc #  /etc/mrtg/mem2.sh
321380
6760


Swap
Code:

guardian proc # cat /etc/mrtg/swap2.sh
#!/bin/sh
cat /proc/meminfo | grep SwapFree | cut -d ' ' -f 8
cat /proc/meminfo | grep SwapTotal | cut -d ' ' -f 7


Code:

guardian proc #  /etc/mrtg/swap2.sh
248968
229056


Sorry, but I don't get this. How are you using these shell scripts in your cfg file? What does the Target line look like? And why do you have MemTotal and then MemFree in the first one, and the order is swapped for the Swap2.sh?
Back to top
View user's profile Send private message
_Daan_
n00b
n00b


Joined: 08 Jun 2004
Posts: 1

PostPosted: Wed Jun 09, 2004 12:05 am    Post subject: Reply with quote

Great guide! It all Just Works (tm).

I'm running an Icecast 2 server, and desperately searching for a way to make mrtg display listener statistics for each stream. Are there any scripts out there or do I have to write them myself? Google returns nothing useful...
Back to top
View user's profile Send private message
Seather
Apprentice
Apprentice


Joined: 23 May 2003
Posts: 194
Location: South Africa

PostPosted: Wed Jun 09, 2004 7:37 pm    Post subject: Reply with quote

Hi, I'm trying to get some apache stats with mrtg, but got stuck.

I tried this: http://lab.xpto.org/apache.mrtg/ but it turned into a bit of a mess, I'm not *entirely* sure how to use it though.

Anyone else that have done this, or know where I can find documentation on it?
Back to top
View user's profile Send private message
neutcomp
Tux's lil' helper
Tux's lil' helper


Joined: 12 Aug 2004
Posts: 112
Location: The Netherlands

PostPosted: Mon Oct 11, 2004 8:40 pm    Post subject: Not really working :( Reply with quote

I did find a few problems, during the tutorial. I am just a rookie so maby I am totally wrong but here it is:

This did not worked for me
Code:
emerge media-libs/libgd


Whats the v1, v2c and usm?
The group MyROGroup does not exist in cat /etc/group
Neither the user public in cat /etc/passwd

Found my problem!!
com2sec local 213.84.184.144/24 public
replaced with
com2sec local 213.84.184.144/32 public

I found the error with cat /var/log/net-snmpd.log

/etc/snmp/snmpd.conf
Code:
com2sec local     127.0.0.1/32    public
com2sec local     213.84.184.144/24   public  #my external ipadres is this correct?

group MyROGroup v1         local
group MyROGroup v2c        local
group MyROGroup usm        local

view all    included  .1                               80

access MyROGroup ""      any       noauth    exact  all    none   none

syslocation /wwwroot/stats.nl
syscontact Webmaster <neutcomp@hotmail.com>


Hope someone can help me out?
http://neutcomp.xs4all.nl/stats.nl/

Its still not reporting anything :cry:

Thanxx
Bjorn 8)
Back to top
View user's profile Send private message
HomerSimpson
l33t
l33t


Joined: 25 Jan 2003
Posts: 869
Location: Ohio, USA

PostPosted: Sun Oct 17, 2004 3:05 pm    Post subject: Reply with quote

Thanks for the howto
_________________
The strong must protect the Sweet.
Back to top
View user's profile Send private message
Tuinslak
Tux's lil' helper
Tux's lil' helper


Joined: 26 Nov 2003
Posts: 129
Location: Belgium

PostPosted: Tue Nov 02, 2004 10:45 am    Post subject: Reply with quote

his_royal_evilness wrote:
smtp root # uname -rsv
Linux 2.6.4-gentoo-r1 #1 Sat Apr 3 09:05:56 CEST 2004

I managed to produce graphs for mem/swap :)

My .cfg's :
Mem.cfg :
WorkDir: /var/www/localhost/htdocs/mrtg
Title[mem]: memory used/free - FQDN
Target[mem]: `free | /usr/bin/awk '/Mem: /{print $3*1000; print $4*1000; print ""; print ""}'`
PageTop[mem]: <H1> memory used/free - FQDN </H1>
Options[mem]: gauge
MaxBytes[mem]: 50000000000
Ylegend[mem]: mem
ShortLegend[mem]: mem
XSize[mem]: 350
YSize[mem]: 150
Legend1[mem]: mem&nbsp;
LegendI[mem]: used&nbsp;
LegendO[mem]: free&nbsp;
WithPeak[mem]: ymwd

swap.cfg:
LoadMIBs: /usr/share/snmp/mibs/UCD-SNMP-MIB.txt
Target[localhost.swap]: `free | /usr/bin/awk '/Swap: /{print $3; print $3; print ""; print ""}'`
PageTop[localhost.swap]: <H1>Swap Memory</H1>
WorkDir: /var/www/localhost/htdocs/mrtg
Options[localhost.swap]: nopercent,growright,gauge,noinfo
Title[localhost.swap]: Free Memory
MaxBytes[localhost.swap]: 1000000
kMG[localhost.swap]: k,M,G,T,P,X
YLegend[localhost.swap]: bytes
ShortLegend[localhost.swap]: bytes
LegendI[localhost.swap]: Free Memory:
LegendO[localhost.swap]:
Legend1[localhost.swap]: Swap memory avail, in bytes


Hope i helped ya out :)


finaly, a cfg that works :p
thx :p
now I just need to get that cpu cfg working... :/

brown wrote:

Sorry, but I don't get this. How are you using these shell scripts in your cfg file? What does the Target line look like? And why do you have MemTotal and then MemFree in the first one, and the order is swapped for the Swap2.sh?

idem dito, didn't get it, but use the cfg from above, those work for me!
mrtg located here :p
now wait some time that it generates some stats, and then fix some other things (like me going from left to right, instead of right to left, and it's a bigger 'square' then the other ..)
and yes, my english sux :p
_________________
Tuinslak
Back to top
View user's profile Send private message
Tuinslak
Tux's lil' helper
Tux's lil' helper


Joined: 26 Nov 2003
Posts: 129
Location: Belgium

PostPosted: Tue Nov 02, 2004 6:34 pm    Post subject: Reply with quote

I get this error when executing the cpu part:
Code:
Unknown SNMP var ssCpuRawUser.0
 at /usr/bin/mrtg line 1846
Unknown SNMP var ssCpuRawUser.0
 at /usr/bin/mrtg line 1846
WARNING: Expected a number but got '3:17:30'
WARNING: Expected a number but got 'zero.rootspirit.com'
Unknown SNMP var ssCpuRawSystem.0
 at /usr/bin/mrtg line 1846
Unknown SNMP var ssCpuRawSystem.0
 at /usr/bin/mrtg line 1846
WARNING: Expected a number but got '3:17:30'
WARNING: Expected a number but got 'zero.rootspirit.com'
Unknown SNMP var ssCpuRawNice.0
 at /usr/bin/mrtg line 1846
Unknown SNMP var ssCpuRawNice.0
 at /usr/bin/mrtg line 1846
WARNING: Expected a number but got '3:17:30'
WARNING: Expected a number but got 'zero.rootspirit.com'
ERROR: Target[cpu][_IN_] ' $target->[1]{$mode}  +  $target->[2]{$mode}  +  $target->[3]{$mode} ' (warn): Use of uninitialized value in addition (+) at (eval 8) line 1.
ERROR: Target[cpu][_OUT_] ' $target->[1]{$mode}  +  $target->[2]{$mode}  +  $target->[3]{$mode} ' (warn): Use of uninitialized value in addition (+) at (eval 9) line 1.

Any idea what's wrong?
_________________
Tuinslak
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, 5, 6  Next
Page 4 of 6

 
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