Воскресенье
17-11-2024
20:24
Главная страница
Каталог статей
Информист Приветствую Вас Гость | RSS
Регистрация
Вход
Меню сайта

Категории каталога
Без категории [60]
Статьи требующие создания отдельной категории

Наш опрос
Что Вы веберете
Всего ответов: 230

Копилка
Если вам понравился наш сайт или вы нашли полезную информацию, то у вас есть возможность отблагодарить администрацию.

Начало » Статьи » Статьи » Без категории

MRTG setup

Prerequisites

This little guide was written for Fedora Core 2, other versions of RedHat/Fedora Linux may differ.

Make sure you have a working http server at the host before setting up mrtg.

Initial setup

MRTG is controlled by a file named mrtg.cfg. In Fedora Core 2 this file can be found at /etc/mrtg/mrtg.cfg. Remove the old one, as we are going to create a new one.

cd /etc/mrtg
mv mrtg.cfg mrtg.cfg.original

Now create a new file with the command

cfgmaker --output=/etc/mrtg/mrtg.cfg.new \
-ifref=ip \
--global 'Workdir: /var/www/mrtg/data' \
--global 'Options[_]: growright,bits,unknaszero' \
--global 'Weekformat[^]: V' \
public@localhost

This will create a configuration file in /etc/mrtg with the name mrtg.cfg.new. The global statements will tell mrtg that all data, and created files, should be placed in the directory /var/www/mrtg/data, that the IP-number will be used as a reference of the interface (in the title on the web page etc.), that the plots will grow to the right, the value in the plots will be bits per second (default is bytes per second), and that we will get a data value of zero in case of trouble reading data from the SNMP server.

Go through the file and comment the lines of those interfaces you do not want to monitor, and uncomment those that you want to monitor. Then add the data directory, remove any stale locking files rename the file to mrtg.cfg, and run mrtg three times (this will create all files, disregard the fault messages the first two times, a fault message the third time is a sign to start worrying)

mkdir -p /var/www/mrtg/data
cd /etc/mrtg
rm -f mrtg.cfg_l*
mv mrtg.cfg.new mrtg.cfg
mrtg mrtg.cfg
mrtg mrtg.cfg
mrtg mrtg.cfg

Now create an index file for the /var/www/mrtg directory (move the old one first)

cd /var/www/mrtg
mv index.html index_mrtg.html
indexmaker --output=/var/www/mrtg/index.html \
--columns=1 \
--autoprefix \
/etc/mrtg/mrtg.cfg

In the file /etc/httpd/conf.d/mrtg.conf make sure that you have set up access rights the correct way. If you want all to be able to see your graphs, do

<Location /mrtg>
Order deny,allow
Allow from all
</Location>

If you on the other hand only want to grant access to the local LAN, and localhost, do

<Location /mrtg>
Order deny,allow
Deny from all
Allow from 127.0.0.1
Allow from 192.168.0
</Location>

You should now be able to se plots by surfing to http://127.0.0.1/mrtg/

There are a lots of switches to the indexmaker program, take a look at 'man indexmaker' and test some of them to get a better layout for the graphs, or edit /var/www/html/index.html yourself.



Источник: http://www.sm6rpz.se/linux/mrtg.php
Категория: Без категории | Добавил: gfff (28-10-2009)
Просмотров: 1494 | Комментарии: 2 | Рейтинг: 0.0 |

Всего комментариев: 2
2 Judge  
0
Использование оперативной памяти:
Создаем файл /usr/local/bin/memstat.sh

#!/bin/sh
/usr/bin/free -b | /bin/awk '\
NR==2 {ramUsed = $3 }\
NR==4 {swapUsed = $3 }\
END { print swapUsed "\n" ramUsed "\n0\n0" }'

В конфиг /etc/mrtg/mrtg.cnf добавляем:

Target[localmem]: `/usr/local/bin/memstat.sh`
Title[localmem]: Mem and Swap Usage [surtr]
PageTop[localmem]: <h1>Memory and Swap Usage [surtr]</h1>
MaxBytes[localmem]: 100000000000
ShortLegend[localmem]: B
YLegend[localmem]: Memory
LegendI[localmem]: Swap
LegendO[localmem]: Mem
Legend1[localmem]: Swap
Legend2[localmem]: Mem
Options[localmem]: gauge,growright,nopercent
kMG[localmem]: k,M,G,T,P,X
Colours[localmem]: RED#bb0000,BLUE#1000ff,GREEN#006600,VIOLET#ff00ff

Источник


1 gfff  
0
перезапуск Apache:
httpd -k restart

Имя *:
Email *:
Код *:
Форма входа

Поиск по каталогу
Яндекс


Поиск по Информисту

Наша кнопка


Друзья сайта

Статистика


Copyright MyCorp © 2006Сайт создан в системе uCoz