Jump to content

Recommended Posts

Posted

Привет!

Есть скрипт:

#!/bin/sh

cp /proc/net/dev /etc/mrtg/scripts/eth

cat /etc/mrtg/scripts/eth | grep eth0 | awk -F":" '{print $2}' | awk '{print$1"n"$9"n0n0"}' > /etc/mrtg/var/eth0.snmp

cat /etc/mrtg/scripts/eth | grep eth1 | awk -F":" '{print $2}' | awk '{print$1"n"$9"n0n0"}' > /etc/mrtg/var/eth1.snmp

cat /etc/mrtg/scripts/eth | grep eth2 | awk -F":" '{print $2}' | awk '{print$1"n"$9"n0n0"}' > /etc/mrtg/var/eth2.snmp

HDA=`/usr/sbin/smartctl -a /dev/hda|grep 194|awk '{print $6}'`

HDB=`/usr/sbin/smartctl -a /dev/hdb|grep 194|awk '{print $6}'`

rm -f /etc/mrtg/var/hdtemp.snmp

echo "$HDA" > /etc/mrtg/var/hdtemp.snmp

echo "$HDB" >> /etc/mrtg/var/hdtemp.snmp

echo "0" >> /etc/mrtg/var/hdtemp.snmp

echo "0" >> /etc/mrtg/var/hdtemp.snmp

Запускается по крону за 1 минуту до запуска MRTG

Как вы поняли первые 4 строчки отвечают за сбор статов из proc и дальнейшего парсинга и отправления в отдельные файлы.

Дальше задаю 2 переменные $HDA & $HDB, которые в свою очередь выполняют снятие показателя температуры с жестких дисков сервера.

И так, после работы скрипта я имею вот что:

4 файла

eth0.snmp eth1.snmp eth2.snmp hdtemp.snmp

Вот каково их содержиние:

[root@headspin /]# cat /etc/mrtg/var/eth0.snmp

4167216979

2383661922

0

0

--CUT--

[root@headspin /]# cat /etc/mrtg/var/hdtemp.snmp

31

35

0

0

В mrtg.cfg вот что:

WorkDir: /var/www/html/mrtg

Target[eth0]: `/etc/mrtg/bin/eth0`

Title[eth0]: eth0

MaxBytes1[eth0]: 12500000

MaxBytes2[eth0]: 12500000

PageTop[eth0]: <H1> Realtek 8139 eth0 </H1>

LegendI[eth0]: in

LegendO[eth0]: out

Legend1[eth0]: traffic in

Legend2[eth0]: traffic out

YLegend[eth0]: Byte per second

ShortLegend[eth0]: b/s

Options[eth0]: nopercent nolegend

--CUT--

Target[hdtemp]: `/etc/mrtg/bin/hdtemp`

Title[hdtemp]: hard drives temp graph

MaxBytes1[hdtemp]: 60

MaxBytes2[hdtemp]: 60

PageTop[hdtemp]: <H1>/dev/hda & /dev/hdb temperature graph</H1>

LegendI[hdtemp]: hda

LegendO[hdtemp]: hdb

Legend1[hdtemp]: /dev/hda

Legend2[hdtemp]: /dev/hdb

YLegend[hdtemp]: t, C

ShortLegend[hdtemp]: t, C

Options[hdtemp]: nopercent nolegend

Значит MRTG получает данные путем вызова скриптов вида:

[root@headspin /]# cat /etc/mrtg/bin/eth0

#!/bin/sh

cat /etc/mrtg/var/eth0.snmp

[root@headspin /]# cat /etc/mrtg/bin/hdtemp

#!/bin/sh

cat /etc/mrtg/var/hdtemp.snmp

 

Ну вот собственно вопрос, в случае с графиками загрузки эзернетов, то все просто отлично, все рисуется, но вот в случае с температурой хардо, то тут глухо, график пуст и все.

Подскажите плизз, что бы это могло быть

Posted

Насколько я понял, этот MRTG, по умолчанию, строит график "Величина в секунду" основываясь на инкриментирующемся счетчике.

В случае с hdtemp, может быть нужна опция 'gauge'.

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...
На сайте используются файлы cookie и сервисы аналитики для корректной работы форума и улучшения качества обслуживания. Продолжая использовать сайт, вы соглашаетесь с использованием файлов cookie и с Политикой конфиденциальности.