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 1, 2, 3, 4  Next  
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
khazad-dum
Tux's lil' helper
Tux's lil' helper


Joined: 26 May 2003
Posts: 148
Location: Moria

PostPosted: Fri Nov 14, 2003 3:43 pm    Post subject: SNMP & MRTG made in easy Reply with quote

Object required:
* [net-analyzer/net-snmp]
* [media-libs/libgd]
* [net-analyzer/mrtg]
* [sys-apps/dcron]

Optionally:
* [net-www/mini_httpd] or [net-www/apache]

WARNING: Do not Cut&Paste commands that begin with:
Code:

/bin/cat -s > /foo/bar


0) Switch User

Code:

/bin/su -

Enter Password

1) Begin

Code:

/usr/bin/mkdir /etc/mrtg
/usr/bin/mkdir /etc/cron.mrtg
/usr/bin/mkdir /var/www/localhost/mrtg


2) Edit

Code:

/bin/cat -s > /etc/snmp/snmpd.conf

com2sec local     127.0.0.1/32    public
com2sec local     10.10.10.0/24   public

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 MyLocation
syscontact Me <me@somewhere.org>

Now just press [ctrl+d].

Edit /etc/conf.d/snmpd file, and add:
Code:

-c /etc/snmp/snmpd.conf

in SNMPD_FLAGS line
(like this: SNMPD_FLAGS="-c /etc/snmp/snmpd.conf")

3) Daemon
Code:

/etc/init.d/snmpd start
/sbin/rc-update add snmpd default


4) Configuration
Traffic:
Code:

/usr/bin/cfgmaker  \
--output=/etc/mrtg/traffic.cfg \
--ifdesc=ip \
--ifref=descr \
--global "WorkDir: /var/www/localhost/mrtg" \
--global "Options[_]: bits,growright" \
public@localhost


Cpu:
Code:

/bin/cat -s > /etc/mrtg/cpu.cfg
WorkDir: /var/www/localhost/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

Now just press [ctrl+d].

Mem:
Code:

/bin/cat -s > /etc/mrtg/mem.cfg
LoadMIBs: /usr/share/snmp/mibs/HOST-RESOURCES-MIB.txt
Target[localhost.mem]: .1.3.6.1.4.1.2021.4.11.0&.1.3.6.1.4.1.2021.4.11.0:public@localhost
PageTop[localhost.mem]: <H1>Free Memory </H1>
WorkDir: /var/www/localhost/mrtg
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

Now just press [ctrl+d].

Swap:
Code:

/bin/cat -s > /etc/mrtg/swap.cfg
LoadMIBs: /usr/share/snmp/mibs/UCD-SNMP-MIB.txt
Target[localhost.swap]: memAvailSwap.0&memAvailSwap.0:public@localhost
PageTop[localhost.swap]: <H1>Swap Memory</H1>
WorkDir: /var/www/localhost/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

Now just press [ctrl+d].

Ping:
Code:

/bin/cat -s > /etc/mrtg/ping.cfg
WorkDir: /var/www/localhost/mrtg
Title[mithril.ping]: Round Trip Time
PageTop[mithril.ping]: <H1>Round Trip Time</H1>
Target[mithril.ping]: `/etc/mrtg/ping.sh`
MaxBytes[mithril.ping]: 2000
Options[mithril.ping]: growright,unknaszero,nopercent,gauge
LegendI[mithril.ping]: Pkt loss %
LegendO[mithril.ping]: Avg RTT
Legend1[mithril.ping]: Maximum Round Trip Time in ms
Legend2[mithril.ping]: Minimum Round Trip Time in ms
#Legend3[mithril.ping]: Maximal 5 Minute Maximum Round Trip Time in ms
#Legend4[mithril.ping]: Maximal 5 Minute Minimum Round Trip Time in ms
YLegend[mithril.ping]: RTT (ms)

Now just press [ctrl+d].

5) Make the jobs
Traffic:
Code:

/bin/cat -s > /etc/cron.mrtg/traffic.sh
#!/bin/sh
/usr/bin/mrtg /etc/mrtg/traffic.cfg

Now just press [ctrl+d].

Cpu:
Code:

/bin/cat -s > /etc/cron.mrtg/cpu.sh
#!/bin/sh
/usr/bin/mrtg /etc/mrtg/cpu.cfg

Now just press [ctrl+d].

Mem:
Code:

/bin/cat -s > /etc/cron.mrtg/mem.sh
#!/bin/sh
/usr/bin/mrtg /etc/mrtg/mem.cfg

Now just press [ctrl+d].

Swap:
Code:

/bin/cat -s > /etc/cron.mrtg/swap.sh
#!/bin/sh
/usr/bin/mrtg /etc/mrtg/swap.cfg

Now just press [ctrl+d].

Ping:
Code:

/bin/cat -s > /etc/cron.mrtg/ping.sh
#!/bin/sh
/usr/bin/mrtg /etc/mrtg/ping.cfg



ping.sh
Code:

/bin/cat -s > /etc/mrtg/ping.sh
#!/bin/sh
PING="/bin/ping"
# Google, for example
ADDR="google.com"
DATA=`$PING -c10 -s500 $ADDR -q `
LOSS=`echo $DATA | awk '{print $18 }' | tr -d %`
echo $LOSS
if [ $LOSS = 100 ];
then
               echo 0
else
        echo $DATA | awk -F/ '{print $5 }'
fi

Now just press [ctrl+d].

Code:

/bin/chmod +x /etc/cron.mrtg/*.sh
/bin/chmod +x /etc/mrtg/ping.sh


Run each script 3 times (don't care warnings)
Code:

/etc/cron.mrtg/traffic.sh
/etc/cron.mrtg/cpu.sh
/etc/cron.mrtg/mem.sh
/etc/cron.mrtg/swap.sh
/etc/cron.mrtg/ping.sh


6) Make the index
Code:

/usr/bin/indexmaker --output=/var/www/localhost/mrtg/index.html \
--title="Power Under Control :)" \
--sort=name \
--enumerate \
/etc/mrtg/traffic.cfg \
/etc/mrtg/cpu.cfg \
/etc/mrtg/mem.cfg \
/etc/mrtg/swap.cfg \
/etc/mrtg/ping.cfg


7) Cronjob
Code:

/bin/cat >> /var/spool/cron/crontabs/root
*/5 * * * * /bin/run-parts /etc/cron.mrtg 1> /dev/null

Now just press [ctrl+d].
(or /usr/bin/crontab -e)

Power Under Control
Open Mozilla (I love it) and browse:

Code:

/var/www/localhost/www/index.html


(or use yours httpd server)

http://localhost/mrtg

# Advanced Users#

For other targets (and other stat), try with other object identifier (OID)

* Polling:
Code:

roberto@moira mrtg $ snmpwalk -v 1 -c public localhost mgmt.1.2.2.1.10.2
IF-MIB::ifInOctets.2 = Counter32: 140021440


* Translating:
Code:

roberto@moria mrtg $ snmptranslate -IR -Td mgmt.1.2.2.1.10.2
IF-MIB::ifInOctets.2
ifInOctets OBJECT-TYPE
  -- FROM       IF-MIB, RFC1213-MIB
  SYNTAX        Counter32
  MAX-ACCESS    read-only
  STATUS        current
  DESCRIPTION   "The total number of octets received on the interface,
            including framing characters.

            Discontinuities in the value of this counter can occur at
            re-initialization of the management system, and at other
            times as indicated by the value of
            ifCounterDiscontinuityTime."
::= { iso(1) org(3) dod(6) internet(1) mgmt(2) mib-2(1) interfaces(2) ifTable(2) ifEntry(1) ifInOctets(
10) 2 }


* Most important files:
Code:

/usr/share/doc/net-snmp
/usr/share/doc/mrtg-*/contrib

- man mrtg
- man snmpd
- man snmpwalk
- man crontab
- man cat


Enjoy,

khazad-dum
Back to top
View user's profile Send private message
s970501
n00b
n00b


Joined: 01 Dec 2003
Posts: 38

PostPosted: Fri Jul 09, 2004 12:00 am    Post subject: net-snmp doesn't work in kernel 2.6? Reply with quote

When I run cfgmaker, cfgmaker doesn't get snmp information from servers w/ kernel 2.6. Everything is working okay, but not in 2.6 system.
Is there any issue about this?
_________________
z9To5o!@wOrms.
Back to top
View user's profile Send private message
Smegma
Tux's lil' helper
Tux's lil' helper


Joined: 25 Apr 2003
Posts: 111

PostPosted: Wed Jul 14, 2004 6:15 am    Post subject: Reply with quote

excellent and easy howto

good job :wink:
_________________
Smegma
Back to top
View user's profile Send private message
Regor
Guru
Guru


Joined: 06 Aug 2002
Posts: 545
Location: 39° 2' 48" N, 120° 59' 2" W

PostPosted: Wed Jul 14, 2004 10:10 am    Post subject: Reply with quote

For use with apache, I had to change everything that referred to
Code:
/var/www/localhost/mrtg

to
Code:
/var/www/localhost/htdocs/mrtg

but otherwise it seems to work fine.

Thanks :)
_________________
Sometimes the appropriate response to reality is to go insane.
-Philip K. Dick, Valis
Back to top
View user's profile Send private message
kpoman
Apprentice
Apprentice


Joined: 15 May 2003
Posts: 209
Location: Buenos Aires, Argentina

PostPosted: Wed Jul 14, 2004 8:12 pm    Post subject: Reply with quote

i am trying to monitor free disk space but get errors !
i typed this:
Code:

snmpwalk -v 1 -c public localhost
to find out what was the var name of my different disks and could see this
Code:

HOST-RESOURCES-MIB::hrStorageDescr.2 = STRING: Real Memory
HOST-RESOURCES-MIB::hrStorageDescr.3 = STRING: Swap Space
HOST-RESOURCES-MIB::hrStorageDescr.4 = STRING: /
HOST-RESOURCES-MIB::hrStorageDescr.5 = STRING: /sys
HOST-RESOURCES-MIB::hrStorageDescr.6 = STRING: /mnt/win2k
HOST-RESOURCES-MIB::hrStorageDescr.7 = STRING: /home
HOST-RESOURCES-MIB::hrStorageDescr.8 = STRING: /proc/bus/usb
HOST-RESOURCES-MIB::hrStorageDescr.9 = STRING: /export
HOST-RESOURCES-MIB::hrStorageDescr.10 = STRING: /media
HOST-RESOURCES-MIB::hrStorageDescr.11 = STRING: /mnt/shuttle/home
HOST-RESOURCES-MIB::hrStorageDescr.12 = STRING: /mnt/smart/contenu
HOST-RESOURCES-MIB::hrStorageDescr.13 = STRING: /mnt/smart/dev
HOST-RESOURCES-MIB::hrStorageDescr.14 = STRING: /mnt/smart/share
HOST-RESOURCES-MIB::hrStorageAllocationUnits.2 = INTEGER: 1024 Bytes
HOST-RESOURCES-MIB::hrStorageAllocationUnits.3 = INTEGER: 1024 Bytes
HOST-RESOURCES-MIB::hrStorageAllocationUnits.4 = INTEGER: 4096 Bytes
HOST-RESOURCES-MIB::hrStorageAllocationUnits.5 = INTEGER: 4096 Bytes
HOST-RESOURCES-MIB::hrStorageAllocationUnits.6 = INTEGER: 8192 Bytes
HOST-RESOURCES-MIB::hrStorageAllocationUnits.7 = INTEGER: 4096 Bytes
HOST-RESOURCES-MIB::hrStorageAllocationUnits.8 = INTEGER: 4096 Bytes
HOST-RESOURCES-MIB::hrStorageAllocationUnits.9 = INTEGER: 4096 Bytes
HOST-RESOURCES-MIB::hrStorageAllocationUnits.10 = INTEGER: 4096 Bytes
HOST-RESOURCES-MIB::hrStorageAllocationUnits.11 = INTEGER: 4096 Bytes
HOST-RESOURCES-MIB::hrStorageAllocationUnits.12 = INTEGER: 512 Bytes
HOST-RESOURCES-MIB::hrStorageAllocationUnits.13 = INTEGER: 512 Bytes
HOST-RESOURCES-MIB::hrStorageAllocationUnits.14 = INTEGER: 512 Bytes
HOST-RESOURCES-MIB::hrStorageSize.2 = INTEGER: 189284
HOST-RESOURCES-MIB::hrStorageSize.3 = INTEGER: 393544
HOST-RESOURCES-MIB::hrStorageSize.4 = INTEGER: 1440904
HOST-RESOURCES-MIB::hrStorageSize.5 = INTEGER: 0
HOST-RESOURCES-MIB::hrStorageSize.6 = INTEGER: 127384
HOST-RESOURCES-MIB::hrStorageSize.7 = INTEGER: 990236
HOST-RESOURCES-MIB::hrStorageSize.8 = INTEGER: 0
HOST-RESOURCES-MIB::hrStorageSize.9 = INTEGER: 2048223
HOST-RESOURCES-MIB::hrStorageSize.10 = INTEGER: 14419375
HOST-RESOURCES-MIB::hrStorageSize.11 = INTEGER: 4807069
HOST-RESOURCES-MIB::hrStorageSize.12 = INTEGER: 282229180
HOST-RESOURCES-MIB::hrStorageSize.13 = INTEGER: 26727348
HOST-RESOURCES-MIB::hrStorageSize.14 = INTEGER: 60772258
HOST-RESOURCES-MIB::hrStorageUsed.2 = INTEGER: 168788
HOST-RESOURCES-MIB::hrStorageUsed.3 = INTEGER: 122084
HOST-RESOURCES-MIB::hrStorageUsed.4 = INTEGER: 1231157
HOST-RESOURCES-MIB::hrStorageUsed.5 = INTEGER: 0
HOST-RESOURCES-MIB::hrStorageUsed.6 = INTEGER: 2
HOST-RESOURCES-MIB::hrStorageUsed.7 = INTEGER: 849900
HOST-RESOURCES-MIB::hrStorageUsed.8 = INTEGER: 0
HOST-RESOURCES-MIB::hrStorageUsed.9 = INTEGER: 1726622
HOST-RESOURCES-MIB::hrStorageUsed.10 = INTEGER: 12743561
HOST-RESOURCES-MIB::hrStorageUsed.11 = INTEGER: 3951579
HOST-RESOURCES-MIB::hrStorageUsed.12 = INTEGER: 82128576
HOST-RESOURCES-MIB::hrStorageUsed.13 = INTEGER: 17444928
HOST-RESOURCES-MIB::hrStorageUsed.14 = INTEGER: 48783682


so i created a /etc/mrtg/hd.cfg and put this on it:

Code:


WorkDir: /var/www/localhost/mrtg
LoadMIBs: /usr/share/snmp/mibs/HOST-RESOURCES-MIB.txt
Target[localhost.hd]:hrStorageSize.9&hrStorageUsed.9:public@localhost
RouterUptime[localhost.hd]: public@localhost
YLegend[localhost.hd]: DISK Utilization
Legend1[localhost.hd]: Root disk
Legend2[localhost.hd]: /usr disk
Legend3[localhost.hd]:
Legend4[localhost.hd]:
LegendI[localhost.hd]:  Root disk
LegendO[localhost.hd]:  /usr disk
Options[localhost.hd]: growright,gauge,nopercent

MaxBytes[localhost.hd]: 3000
Title[localhost.hd]: DISK / USAGE
PageTop[localhost.hd]: <H1>DISK / Usage</H1>
ShortLegend[localhost.hd]: B
kMG[localhost.hd]: k,M,G,T,P
kilo[localhost.hd]: 1024



i dont get what i would like to have and actually i dont really know how to do this :) i would prefer maybe to have disk usage percentage ! if someone has an idea :)
_________________
please, help me, pity on me :'(
Back to top
View user's profile Send private message
majonnes
n00b
n00b


Joined: 03 Feb 2004
Posts: 4

PostPosted: Thu Jul 15, 2004 8:47 pm    Post subject: Errors in cpu.sh Reply with quote

First, thanks for a nice howto!

All my scripts except cpu.sh works fine, I get this error when run:

ERROR: Target[localhost.cpu][_IN_] ' $target->[0]{$mode} + ssCpuRawSystem.0&ssCpuRawSystem.' (warn): Ambiguous use of & resolved as operator & at (eval 6) line 1.

Anyone know what may cause this?
I use the same settings as in the howto with the exception of the workdir
Back to top
View user's profile Send private message
Smegma
Tux's lil' helper
Tux's lil' helper


Joined: 25 Apr 2003
Posts: 111

PostPosted: Fri Jul 16, 2004 1:49 am    Post subject: Reply with quote

majonnes:

You must write Target sentence just in a line.
_________________
Smegma
Back to top
View user's profile Send private message
majonnes
n00b
n00b


Joined: 03 Feb 2004
Posts: 4

PostPosted: Fri Jul 16, 2004 7:08 am    Post subject: Reply with quote

EDIT

I fixed it, thank you!

This line:
Code:
Target[localhost.cpu]:ssCpuRawUser.0&ssCpuRawUser.0:public@localhost + ssCpuRawSystem.0&ssCpuRawSystem.
0:public@localhost + ssCpuRawNice.0&ssCpuRawNice.0:public@localhost


Should be like this:
Code:
Target[localhost.cpu]:ssCpuRawUser.0&ssCpuRawUser.0:public@localhost + ssCpuRawSystem.0&ssCpuRawSystem.0:public@localhost + ssCpuRawNice.0&ssCpuRawNice.0:public@localhost
Back to top
View user's profile Send private message
nautical9
n00b
n00b


Joined: 24 Feb 2003
Posts: 22
Location: Calgary, Alberta, Canada

PostPosted: Tue Jul 20, 2004 11:05 am    Post subject: SNMP Problems Reply with quote

Thanks for the wonderful how-to! I've always wanted to get MRTG up and running, but unfortunately I'm still having some basic problems after following your instructions. I think they're way back in snmpd.

I followed all your instructions, replacing only the work-dir in your examples to a different apache directory, but here's the error I get for cpu.sh (I get almost identical errors for mem.sh and swap.sh - traffic.sh and ping.sh seem to work).

Code:

# /etc/cron.mrtg/cpu.sh
SNMP Error:
no response received
SNMPv1_Session (remote host: "localhost" [127.0.0.1].161)
                  community: "public"
                 request ID: 1813541724
                PDU bufsize: 8000 bytes
                    timeout: 2s
                    retries: 5
                    backoff: 1)
 at /usr/bin/../lib/mrtg2/SNMP_util.pm line 490
SNMPGET Problem for ssCpuRawUser.0 ssCpuRawUser.0 sysUptime sysName on public@localhost::::::v4only
 at /usr/bin/mrtg line 1866
WARNING: skipping because at least the query for ssCpuRawUser.0 on  localhost did not succeed
WARNING: no data for ssCpuRawUser&ssCpuRawUser:public@localhost. Skipping further queries for Host localhost in this round.
ERROR: Target[localhost.cpu][_IN_] ' $target->[0]{$mode}  +  $target->[1]{$mode}  +  $target->[2]{$mode} ' (warn): Use of uninitialized value in addition (+) at (eval 6) line 1.
ERROR: Target[localhost.cpu][_OUT_] ' $target->[0]{$mode}  +  $target->[1]{$mode}  +  $target->[2]{$mode} ' (warn): Use of uninitialized value in addition (+) at (eval 7) line 1.
SNMP Error:
no response received
SNMPv1_Session (remote host: "localhost" [127.0.0.1].161)
                  community: "public"
                 request ID: 143882839
                PDU bufsize: 8000 bytes
                    timeout: 2s
                    retries: 5
                    backoff: 1)
 at /usr/bin/../lib/mrtg2/SNMP_util.pm line 490
SNMPGET Problem for sysUptime sysName on public@localhost
 at /usr/bin/mrtg line 524


Also related I'm sure, but I get a similar error running the cfgmaker command, which basically generates a useless traffic.cfg file for me:
Code:

#/usr/bin/cfgmaker --output=/etc/mrtg/traffic.cfg --ifdesc=ip --ifref=descr --global "WorkDir: /home/www/pub/admin/mrtg" --global "Options[_]: bits,growright" public@localhost
--base: Get Device Info on public@localhost:
SNMP Error:
no response received
SNMPv1_Session (remote host: "localhost" [127.0.0.1].161)
                  community: "public"
                 request ID: 489553356
                PDU bufsize: 8000 bytes
                    timeout: 2s
                    retries: 5
                    backoff: 1)
 at /usr/bin/../lib/mrtg2/SNMP_util.pm line 627
SNMPWALK Problem for 1.3.6.1.2.1.1 on public@localhost::::::v4only
 at /usr/bin/cfgmaker line 827
WARNING: Skipping public@localhost: as no info could be retrieved

--base: Writing /etc/mrtg/traffic.cfg

Sorry for such a newbie question, but I'm not at all familiar with SNMP. There's nothing in my syslog from snmpd, nor in /var/log/net-snmpd.log.

Any ideas?
Back to top
View user's profile Send private message
presto8
n00b
n00b


Joined: 03 Jan 2003
Posts: 35
Location: Portland, Oregon, USA

PostPosted: Thu Jul 22, 2004 5:34 pm    Post subject: Reply with quote

Very nice HOW-TO. I am up and running after only 10 minutes! Thanks.
Back to top
View user's profile Send private message
_benj_
n00b
n00b


Joined: 05 May 2004
Posts: 32

PostPosted: Mon Jul 26, 2004 12:01 pm    Post subject: Reply with quote

the how to is great, thanks.

I've done a script to automatize the adding of a new computer when monitoring many of them.

make free to download/use and submit critics/suggestions :)

here it is


enjoy.
_________________
we are microsoft: what you are experiencing is an undocumented feature, not a bug.
Back to top
View user's profile Send private message
fE_rdy
Tux's lil' helper
Tux's lil' helper


Joined: 14 Feb 2003
Posts: 75
Location: Old Europe (m'kay Rummy?)

PostPosted: Tue Aug 17, 2004 10:29 am    Post subject: Reply with quote

_benj_ wrote:
the how to is great, thanks.

I've done a script to automatize the adding of a new computer when monitoring many of them.

make free to download/use and submit critics/suggestions :)

here it is


enjoy.


How bad... Translate the script it into english and I will translate into german if you wish :-)

I'd like to add a question: While making the index-page i get to following error:
Code:

w0t4n ferdy # /usr/bin/indexmaker --output=/var/www/localhost/mrtg/index.html \
> --title="Power Under Control :)" \
> --sort=name \
> --enumerate \
> /etc/mrtg/traffic.cfg \
> /etc/mrtg/cpu.cfg \
> /etc/mrtg/mem.cfg \
> /etc/mrtg/swap.cfg \
> /etc/mrtg/ping.cfg
ERROR: CFG Error Unknown Option "rkdir" on line 3 or above.
           Check doc/reference.txt for Help

w0t4n ferdy #


Any suggestions?

bye
ferdy
Back to top
View user's profile Send private message
_benj_
n00b
n00b


Joined: 05 May 2004
Posts: 32

PostPosted: Tue Aug 17, 2004 11:16 am    Post subject: Reply with quote

make sure that the /var/www/localhost/mrtg/ dir exists.
that's the only prob i can see
_________________
we are microsoft: what you are experiencing is an undocumented feature, not a bug.
Back to top
View user's profile Send private message
fE_rdy
Tux's lil' helper
Tux's lil' helper


Joined: 14 Feb 2003
Posts: 75
Location: Old Europe (m'kay Rummy?)

PostPosted: Tue Aug 17, 2004 11:48 am    Post subject: Reply with quote

_benj_ wrote:
make sure that the /var/www/localhost/mrtg/ dir exists.
that's the only prob i can see


It _does_ exist. It contains also all files except the one that should analyze traffic. I have no clue...
Code:
ferdy@w0t4n /var/www/localhost/mrtg $ ls -la
total 377
drwxr-xr-x  2 root root  1024 Aug 17 12:14 .
drwxr-xr-x  3 root root    72 Aug 17 11:44 ..
-rw-r--r--  1 root root  1400 Aug 17 12:14 localhost.cpu-day.png
-rw-r--r--  1 root root  1401 Aug 17 12:11 localhost.cpu-month.png
-rw-r--r--  1 root root  1422 Aug 17 12:11 localhost.cpu-week.png
-rw-r--r--  1 root root  1754 Aug 17 12:11 localhost.cpu-year.png
-rw-r--r--  1 root root  5517 Aug 17 12:14 localhost.cpu.html
-rw-r--r--  1 root root 48182 Aug 17 12:14 localhost.cpu.log
-rw-r--r--  1 root root 48182 Aug 17 12:13 localhost.cpu.old
-rw-r--r--  1 root root  1375 Aug 17 12:12 localhost.mem-day.png
-rw-r--r--  1 root root  1373 Aug 17 12:12 localhost.mem-month.png
-rw-r--r--  1 root root  1392 Aug 17 12:12 localhost.mem-week.png
-rw-r--r--  1 root root  1747 Aug 17 12:12 localhost.mem-year.png
-rw-r--r--  1 root root  5594 Aug 17 12:12 localhost.mem.html
-rw-r--r--  1 root root 48226 Aug 17 12:12 localhost.mem.log
-rw-r--r--  1 root root 48210 Aug 17 12:12 localhost.mem.old
-rw-r--r--  1 root root  1375 Aug 17 12:12 localhost.swap-day.png
-rw-r--r--  1 root root  1373 Aug 17 12:12 localhost.swap-month.png
-rw-r--r--  1 root root  1392 Aug 17 12:12 localhost.swap-week.png
-rw-r--r--  1 root root  1747 Aug 17 12:12 localhost.swap-year.png
-rw-r--r--  1 root root  5583 Aug 17 12:12 localhost.swap.html
-rw-r--r--  1 root root 48226 Aug 17 12:12 localhost.swap.log
-rw-r--r--  1 root root 48210 Aug 17 12:12 localhost.swap.old
-rw-r--r--  1 root root   538 Aug 17 12:11 mrtg-l.png
-rw-r--r--  1 root root   414 Aug 17 12:11 mrtg-m.png
-rw-r--r--  1 root root  1759 Aug 17 12:11 mrtg-r.png
-rw-r--r--  1 root root    70 Aug 17 12:12 oid-mib-cache.txt
ferdy@w0t4n /var/www/localhost/mrtg $

bye
ferdy
Back to top
View user's profile Send private message
seand
Tux's lil' helper
Tux's lil' helper


Joined: 29 Jan 2004
Posts: 101

PostPosted: Mon Sep 27, 2004 9:32 pm    Post subject: Reply with quote

nicely done!

i had to append public@localhost at the end of the cfgmaker line for it to work, but besides that? PERFECTO!
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 3:17 pm    Post subject: Reply with quote

Hello,

I supose that:
Object required:
* [net-analyzer/net-snmp]
* [media-libs/libgd]
* [net-analyzer/mrtg]
* [sys-apps/dcron]

That you need to:
emerge net-analyzer/net-snmp
emerge media-libs/libgd (Could not be found!)
emerge net-analyzer/mrtg
emerge sys-apps/dcron

Everything works (no errors) but still notting to see
http://neutcomp.xs4all.nl/stats.nl

Thanxx
Bjorn 8)
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: Mon Nov 01, 2004 11:08 pm    Post subject: Reply with quote

libgd doesn't exist, indeed
type `emerge gd` instead.

--

Here is mine.
swap, ram and hdd give bad results?
"1kb swap" and in free -m it shows 85mb used...
also my cpu is quite idle (nonstop 0%), this isn't correct as it should be at least have 10% load...
_________________
Tuinslak
Back to top
View user's profile Send private message
eASy_
n00b
n00b


Joined: 16 Aug 2004
Posts: 53

PostPosted: Sun Feb 27, 2005 2:38 pm    Post subject: Reply with quote

Hello,

first, very good Howto. :)
But what have I to change in the snmpd.conf if I want use it over the Internet and with auth?

Thanks for Help.

eASy
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 Mar 29, 2005 8:09 am    Post subject: Reply with quote

First I have to say that this is very good and easy HOWTO. Thanks for that. :)

But I have a broblem. That being that mrtg doesn't generate the images for the web page. Actually it doesnt generate or have any images on the page, only the slots where they should be. Not even the mrtg advertisement at the bottom of the web page. 8O

I did everything as told and I didn't get any errors what so ever, except "/usr/bin/mrtg: bad interpreter: No such file or directory" when running the scripts. In HOWTO there was said that ignore any errors concerning running the scripts, so I guess that it's perfectly normal? Then I thought that maeby my snmp doesn't work, but when running this command "snmpwalk -v 1 -c public localhost IP-MIB::ipAdEntIfIndex", it showed all my ethernet ip's correctly. So I guess it isn't that either?

Does anyone gnow what might be the broblem, have I missed something?
_________________
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: Wed Mar 30, 2005 3:52 pm    Post subject: Reply with quote

Solved, look at the other mrtg thread.
_________________
How do you do the things you do...
Back to top
View user's profile Send private message
mOoh
n00b
n00b


Joined: 20 Jun 2003
Posts: 39
Location: paris

PostPosted: Mon Jun 06, 2005 1:25 am    Post subject: Reply with quote

thx
_________________
pom.
Back to top
View user's profile Send private message
loonix
Tux's lil' helper
Tux's lil' helper


Joined: 18 Nov 2004
Posts: 98
Location: Barrie, Ontario, Canada

PostPosted: Mon Jul 25, 2005 5:56 pm    Post subject: Reply with quote

Great work! got it to work and even added a mysql monitor.

I would like to measure cpu temperature and fan speed as well but I have no clue how to go about it.

Any thoughts?

Thanks

AR
Back to top
View user's profile Send private message
loonix
Tux's lil' helper
Tux's lil' helper


Joined: 18 Nov 2004
Posts: 98
Location: Barrie, Ontario, Canada

PostPosted: Wed Jul 27, 2005 4:53 pm    Post subject: Reply with quote

I gave up on the fan speed and temperature, but now suddenly my Traffic monitor stopped working, it looks like it still measures (the numbers are there at the bottom) but the graph is not updated nor being ploted! any thoughts?

I used the exact same traffic.cfg script from the how-to above...

AR
Back to top
View user's profile Send private message
Sibben
n00b
n00b


Joined: 16 Nov 2003
Posts: 40
Location: Sweden

PostPosted: Mon Aug 01, 2005 3:21 pm    Post subject: Reply with quote

I was having problems because run-parts wouldn't run any of the scripts, so I read the manpage and by default it won't run any file with a dot in the filename. Works like a charm when I renamed the scripts. Just in case anyone else has the same problem.
Back to top
View user's profile Send private message
Dreadfull
Tux's lil' helper
Tux's lil' helper


Joined: 15 Apr 2005
Posts: 139

PostPosted: Wed Aug 03, 2005 7:30 am    Post subject: Reply with quote

executed:
Code:

/usr/bin/cfgmaker  --output=/etc/mrtg/traffic.cfg --ifdesc=ip --ifref=descr --global "WorkDir: /var/www/localhost/htdocs/mrtg" --global "Options[_]: bits,growright" public@localhost


got:
Code:

--base: Get Device Info on public@localhost:
SNMP Error:
no response received
SNMPv1_Session (remote host: "localhost" [127.0.0.1].161)
                  community: "public"
                 request ID: 719708923
                PDU bufsize: 8000 bytes
                    timeout: 2s
                    retries: 5
                    backoff: 1)
 at /usr/bin/../lib/mrtg2/SNMP_util.pm line 627
SNMPWALK Problem for 1.3.6.1.2.1.1 on public@localhost::::::v4only
 at /usr/bin/cfgmaker line 796
WARNING: Skipping public@localhost: as no info could be retrieved

--base: Writing /etc/mrtg/traffic.cfg

also the graphs are updating but not getting any info
my current snmpd.conf:
Code:

###########################################################################
#
# snmpd.conf
#
#   - created by the snmpconf configuration program
#
###########################################################################
# SECTION: System Information Setup
#
#   This section defines some of the information reported in
#   the "system" mib group in the mibII tree.

# syslocation: The [typically physical] location of the system.
#   Note that setting this value here means that when trying to
#   perform an snmp SET operation to the sysLocation.0 variable will make
#   the agent return the "notWritable" error code.  IE, including
#   this token in the snmpd.conf file will disable write access to
#   the variable.
#   arguments:  location_string

syslocation Right here, right now.
syslocation  SunShells

# syscontact: The contact information for the administrator
#   Note that setting this value here means that when trying to
#   perform an snmp SET operation to the sysContact.0 variable will make
#   the agent return the "notWritable" error code.  IE, including
#   this token in the snmpd.conf file will disable write access to
#   the variable.
#   arguments:  contact_string

syscontact Dreadfull <dreadfull@sunshells.org>
syscontact



###########################################################################
# SECTION: Access Control Setup
#
#   This section defines who is allowed to talk to your running
#   snmp agent.

# rwuser: a SNMPv3 read-write user
#   arguments:  user [noauth|auth|priv] [restriction_oid]

rwuser  Dreadfull auth

# rouser: a SNMPv3 read-only user
#   arguments:  user [noauth|auth|priv] [restriction_oid]

rouser  Dreadfull



###########################################################################
# SECTION: Trap Destinations
#
#   Here we define who the agent will send traps to.

# informsink: A SNMPv2c inform (acknowledged trap) receiver
#   arguments: host [community] [portnum]

informsink  "localhost sunshells 5000"  5000

# trapcommunity: Default trap sink community to use
#   arguments: community-string

trapcommunity  sunshells

# authtrapenable: Should we send traps when authentication failures occur
#   arguments: 1 | 2   (1 = yes, 2 = no)

authtrapenable  1



###########################################################################
# SECTION: Monitor Various Aspects of the Running Host
#
#   The following check up on various aspects of a host.

# proc: Check for processes that should be running.
#     proc NAME [MAX=0] [MIN=0]
#
#     NAME:  the name of the process to check for.  It must match
#            exactly (ie, http will not find httpd processes).
#     MAX:   the maximum number allowed to be running.  Defaults to 0.
#     MIN:   the minimum number to be running.  Defaults to 0.
#
#   The results are reported in the prTable section of the UCD-SNMP-MIB tree
#   Special Case:  When the min and max numbers are both 0, it assumes
#   you want a max of infinity and a min of 1.

proc mountd
proc ntalkd 4
proc sendmail 10 1

# disk: Check for disk space usage of a partition.
#   The agent can check the amount of available disk space, and make
#   sure it is above a set limit.
#
#    disk PATH [MIN=100000]
#
#    PATH:  mount path to the disk in question.
#    MIN:   Disks with space below this value will have the Mib's errorFlag set.
#           Can be a raw byte value or a percentage followed by the %
#           symbol.  Default value = 100000.
#
#   The results are reported in the dskTable section of the UCD-SNMP-MIB tree

disk / 10000

# load: Check for unreasonable load average values.
#   Watch the load average levels on the machine.
#
#    load [1MAX=12.0] [5MAX=12.0] [15MAX=12.0]
#
#    1MAX:   If the 1 minute load average is above this limit at query
#            time, the errorFlag will be set.
#    5MAX:   Similar, but for 5 min average.
#    15MAX:  Similar, but for 15 min average.
#
#   The results are reported in the laTable section of the UCD-SNMP-MIB tree

load 12 14 14



###########################################################################
# SECTION: Extending the Agent
#
#   You can extend the snmp agent to have it return information
#   that you yourself define.

# exec: run a simple command using exec()
#   arguments:  [oid] name /path/to/executable arguments

exec echotest /bin/echo hello world






#
# Unknown directives read in from other files by snmpconf
#
com2sec local    localhost      public
com2sec mynetwork 192.168.65.0/28          public
com2sec local     127.0.0.1/32    public
com2sec local     192.168.65.0/24   public
group MyRWGroup        v1        local
group MyRWGroup        v2c       local
group MyRWGroup        usm       local
group MyROGroup v1         mynetwork
group MyROGroup v2c        mynetwork
group MyROGroup usm        mynetwork
view all   included .1                               80
access MyROGroup ""      any       noauth    exact all    none  none
access MyRWGroup ""      any       noauth    exact all    all   none

_________________
CPU: AMD Athlon 64 3200+
RAM: 2 GB DDR 400 Dual channel
HDD: 2x200 GB WDC SATA
OS: Gentoo 2005.1
Compiler: GCC 3.4.5
kernel: 2.6.14-hardened-r5
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 1, 2, 3, 4  Next
Page 1 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