hmm, are you sure mrtg has enough rights to write to that directory?
how long did you wait before checking? it might take 5 minutes:)
Printable View
I hope Yes:-)) - mrtg did write three files there. And I did chmod a+w
I was absent for more then hour - nothing new:-((
SOLVED
Commented string 'RunAsDaemon: Yes' in config and started from terminal - it told me what it need - libjpeg & fontconfig packages
SOLVED
Anyway thank You for attention
ONE MORE TIP (I've spend some time to overcome)
When your uncommenting some interface in mrtg.cfg you MUST remove '#' sign and following SPACE simbol. String '_Target[localhost .....' will be ignored by mrtg
Some interesting MRTG settings and scripts...
CPU
http://img841.imageshack.us/img841/584/cpuu.png
MRTG settings
cpu.shCode:Target[cpu]: `/opt/etc/mrtg/cpu.sh`
MaxBytes[cpu]: 500
Title[cpu]: server CPU Load (5 minute average)
YLegend[cpu]: Load*100
ShortLegend[cpu]: load
Legend1[cpu]: CPU Load (x 100)
Legend2[cpu]:
LegendI[cpu]: 1min load
LegendO[cpu]: 5min load
PageTop[cpu]: server 5-minute average CPU Load
Options[cpu]: gauge,nopercent,integer,growright
MemoryCode:#!/bin/sh
awk </proc/loadavg '{print (100*$1) "\n" (100*$2) }'
hostname;
echo "loadavg";
http://img823.imageshack.us/img823/7047/memoryu.png
(blue - RAM, green - Swap)
MRTG settings
memory.shCode:Target[memory]: `/opt/etc/mrtg/memory.sh`
Title[memory]: Mem and Swap Usage
PageTop[memory]: <h1>Memory and Swap Usage</h1>
MaxBytes[memory]: 100000000000
ShortLegend[memory]: B
YLegend[memory]: Memory
LegendI[memory]: Swap
LegendO[memory]: Mem
Legend1[memory]: Swap
Legend2[memory]: Mem
Options[memory]: gauge,growright,nopercent
Code:#!/bin/sh
/usr/bin/free | awk '\
NR==2 {ramUsed = $3 * 1000 }\
NR==3 {swapUsed = $3 * 1000 }\
END { print swapUsed "\n" ramUsed "\n0\n0" }'
Ping
http://img196.imageshack.us/img196/2705/pingbo.png
MRTG settings
ping.shCode:Title[ping]: RTT to google.com
PageTop[ping]: <H1>Round Trip Time</H1>
Target[ping]: `/opt/etc/mrtg/ping.sh`
MaxBytes[ping]: 2000
Options[ping]: growright,unknaszero,nopercent,gauge
LegendI[ping]: Pkt loss %
LegendO[ping]: Avg RTT
YLegend[ping]: RTT (ms)
/opt usageCode:#!/bin/sh
PING="/bin/ping"
ADDR="google.com"
DATA=`$PING -c10 $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
http://img641.imageshack.us/img641/7592/dfopt.png
MRTG settings
df_opt.shCode:Target[df_opt]: `/opt/etc/mrtg/df_opt.sh`
Title[df_opt]: /opt usage
PageTop[df_opt]: <h1>/opt usage</h1>
MaxBytes[df_opt]: 100000000000
ShortLegend[df_opt]: M
YLegend[df_opt]: /opt
LegendI[df_opt]: Free
LegendO[df_opt]: Used
Legend1[df_opt]: Free
Legend2[df_opt]: Used
Options[df_opt]: gauge,growright,nopercent
/tmp/harddisk usageCode:#!/bin/sh
/bin/df | awk '\
NR==5 {used = $2 / 1024}\
NR==5 {free = $3 / 1024}\
END { print free "\n" used "\n0\n0" }'
http://img717.imageshack.us/img717/6034/dfharddisk.png
MRTG settings
df_harddisk.shCode:Target[df_harddisk]: `/opt/etc/mrtg/df_harddisk.sh`
Title[df_harddisk]: /tmp/harddisk usage
PageTop[df_harddisk]: <h1>/tmp/harddisk usage</h1>
MaxBytes[df_harddisk]: 100000000000
ShortLegend[df_harddisk]: M
YLegend[df_harddisk]: /tmp/harddisk
LegendI[df_harddisk]: Free
LegendO[df_harddisk]: Used
Legend1[df_harddisk]: Free
Legend2[df_harddisk]: Used
Options[df_harddisk]: gauge,growright,nopercent
Code:#!/bin/sh
/bin/df | awk '\
NR==7 {used = $2 / 1024}\
NR==7 {free = $3 / 1024}\
END { print free "\n" used "\n0\n0" }'
Very nice post kolaCZek!
they all work very well:)
Just a note for the memory script: it shows that I'm using 124kb, but according to free that is supposed to be in megabytes:p
i have a similarly problem, i get the 3 files from above and no html. (i waited, restart router several times and after several 10 minute period and still no html)
Code:SNMP running
[admin@rtn root]$ pss | grep snmpd
559 pts/0 S+ 0:00 \_ grep snmpd
215 ? S 0:00 snmpd -c /tmp/snmpd.conf
MRTG running
[admin@rtn root]$ pss | grep mrtg
561 pts/0 S+ 0:00 \_ grep mrtg
rights for mrtg folder
[admin@rtn root]$ ls -la /mnt/www/
total 20
drwxr--r-- 4 admin root 4096 Dec 12 10:51 .
drwxr--r-- 5 admin root 4096 Dec 11 21:40 ..
drwxr-xr-x 3 admin root 4096 Dec 11 23:32 cgi-bin
-rwxrw-rw- 1 admin root 28 Dec 11 18:28 index.php
drwxr-xr-x 2 admin root 4096 Dec 12 11:05 mrtg
my mrtg.cfg file is:
/mnt/www/mtg - indicated by me because I have lighttpd & samba shares in place. I could not see the interfaces to uncomment ! What do i miss ?
Code:# Created by
# /opt/bin/cfgmaker --global "WorkDir: /mnt/www/mrtg" --global "RunAsDaemon: Yes" --global "Options[_]: bits,growright" --output /opt/etc/mrtg.cfg public@localhost
### Global Config Options
# for UNIX
# WorkDir: /home/http/mrtg
# or for NT
# WorkDir: c:\mrtgdata
### Global Defaults
# to get bits instead of bytes and graphs growing to the right
# Options[_]: growright, bits
EnableIPv6: no
WorkDir: /mnt/www/mrtg
RunAsDaemon: Yes
Options[_]: bits,growright
######################################################################
# System:
# Description:
# Contact:
# Location:
######################################################################
1) I've tried with this, but my ipkg says the 2 packs above are installed and up to date (I ran ipkg update first).Quote:
SOLVED
Commented string 'RunAsDaemon: Yes' in config and started from terminal - it told me what it need - libjpeg & packages
2) i killed the mrtg daemon and started it manually. I get this:
Code:[admin@rtn root]$ /opt/etc/init.d/S99mrtg
Segmentation fault
Daemonizing MRTG ...
[admin@rtn root]$ pss | grep mrtg
579 pts/0 S+ 0:00 \_ grep mrtg
577 ? Ss 0:00 /opt/bin/perl -w /opt/bin/mrtg /opt/etc/mrtg.cfg
Unfortunately I've stopped to use mrtg because of hi processor load, but as I remember I can suggest
First of all stop mrtg, then rename or remove your mrgt.cfg (as if it just empty) and run:
/opt/bin/cfgmaker --global "WorkDir: /opt/share/www/mrtg" --global "RunAsDaemon: Yes" --global "Interval: 5" --global "Options[_]: bits,growright" --output /opt/etc/mrtg.cfg public@localhost
with Your WorkDir.
This must create new mrtg.cfg with such sections:
This is what you need to uncomment (not all, but what you need).Code:### Interface 1 >> Descr: 'lo' | Name: '' | Ip: '127.0.0.1' | Eth: '' ###
### The following interface is commented out because:
### * it is a Software Loopback interface
#
# Target[localhost_1]: 1:public@localhost:
# SetEnv[localhost_1]: MRTG_INT_IP="127.0.0.1" MRTG_INT_DESCR="lo"
# MaxBytes[localhost_1]: 1250000
# Title[localhost_1]: Traffic Analysis for 1 -- noone-gateway
# PageTop[localhost_1]: <h1>Traffic Analysis for 1 -- noone-gateway</h1>
# <div id="sysdetails">
# <table>
# <tr>
# <td>System:</td>
# <td>noone-gateway in Unknown</td>
# </tr>
# <tr>
# <td>Maintainer:</td>
# <td>Administrator</td>
# </tr>
# <tr>
# <td>Description:</td>
# <td>lo </td>
# </tr>
# <tr>
# <td>ifType:</td>
# <td>softwareLoopback (24)</td>
# </tr>
# <tr>
# <td>ifName:</td>
# <td></td>
# </tr>
# <tr>
# <td>Max Speed:</td>
# <td>10.0 Mbits/s</td>
# </tr>
# <tr>
# <td>Ip:</td>
# <td>127.0.0.1 (localhost.localdomain)</td>
# </tr>
# </table>
# </div>
Like this - remember that you need to remove leading spaces too:
Then you must comment line:Code:Target[localhost_4]: 4:public@localhost:
SetEnv[localhost_4]: MRTG_INT_IP="" MRTG_INT_DESCR="eth1"
MaxBytes[localhost_4]: 1250000
Title[localhost_4]: Traffic Analysis for 4 -- noone-gateway
PageTop[localhost_4]: <h1>Traffic Analysis for 4 -- noone-gateway</h1>
<div id="sysdetails">
<table>
<tr>
<td>System:</td>
<td>noone-gateway in Unknown</td>
</tr>
<tr>
<td>Maintainer:</td>
<td>Administrator</td>
</tr>
<tr>
<td>Description:</td>
<td>eth1 </td>
</tr>
<tr>
<td>ifType:</td>
<td>ethernetCsmacd (6)</td>
</tr>
<tr>
<td>ifName:</td>
<td></td>
</tr>
<tr>
<td>Max Speed:</td>
<td>10.0 Mbits/s</td>
</tr>
</table>
</div>
#RunAsDaemon: Yes
in your mrtg.cfg and run
/opt/bin/mrtg /opt/etc/mrtg.cfg
you will see the whole process, But I think that your main problem is that you have no interfaces in mrtg.cfg
I think that "Segmentation fault" mean that you shell check (with fsck) your harddisk - I've did it on my linux desktop.
Simply perfect.
Working like a charm.:D:D:D
Cpu load is acceptable.
Thank you wpte.
Regards
Rumen