This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
сервис_mrtg [2018/03/13 09:46] val [Ubuntu] |
сервис_mrtg [2022/02/26 05:57] val [Использование скриптов] |
||
---|---|---|---|
Line 44: | Line 44: | ||
debian# mkdir /var/www/html/mrtg/ | debian# mkdir /var/www/html/mrtg/ | ||
или | или | ||
- | freebsd# mkdir /usr/local/www/apache22/data/mrtg/ | + | freebsd# mkdir /usr/local/www/apache24/data/mrtg/ |
- | freebsd# chown -R mrtg:mrtg /usr/local/www/apache22/data/mrtg/ | + | freebsd# chown -R mrtg:mrtg /usr/local/www/apache24/data/mrtg/ |
debian# indexmaker /etc/mrtg.cfg > /var/www/html/mrtg/index.html | debian# indexmaker /etc/mrtg.cfg > /var/www/html/mrtg/index.html | ||
или | или | ||
- | freebsd# indexmaker /usr/local/etc/mrtg/mrtg.cfg > /usr/local/www/apache22/data/mrtg/index.html | + | freebsd# indexmaker /usr/local/etc/mrtg/mrtg.cfg > /usr/local/www/apache24/data/mrtg/index.html |
</code> | </code> | ||
Line 56: | Line 56: | ||
==== FreeBSD ==== | ==== FreeBSD ==== | ||
<code> | <code> | ||
- | [server:~] # /usr/local/etc/rc.d/mrtg_daemon rcvar | + | [server:~] # sysrc mrtg_daemon_enable="YES" |
- | [server:~] # /usr/local/etc/rc.d/mrtg_daemon start | + | [server:~] # service mrtg_daemon start |
</code> | </code> | ||
Line 70: | Line 70: | ||
===== Отладка ===== | ===== Отладка ===== | ||
<code> | <code> | ||
- | server# cat /WWWDATADIR/mrtg/*.log | + | server# cat /var/www/html/mrtg/*.log |
</code> | </code> | ||
Line 118: | Line 118: | ||
</code> | </code> | ||
- | ==== Использование не SNMP источника ==== | + | ==== Использование скриптов ==== |
<code> | <code> | ||
- | # cat /root/scripts/dhcp/dhcpstat.sh | + | # cat /etc/mrtg-dhcp-stat.sh |
</code><code> | </code><code> | ||
#!/bin/sh | #!/bin/sh | ||
- | DATA=`/usr/local/dhcpd-pools-2.15/bin/dhcpd-pools -l /var/lib/dhcpd/dhcpd.leases | grep 195.19.34 | sed -re 's/ {1,}/ /g'` | + | |
- | echo $DATA | cut -f6 -d" " | + | #CMD='rsh router show ip dhcp binding | grep 192.168 | wc -l' |
- | echo $DATA | cut -f7 -d" " | + | #MAX=9 |
+ | #CUR=`eval $CMD` | ||
+ | |||
+ | #CMD='/usr/bin/dhcpd-pools -l /var/lib/dhcp/dhcpd.leases -c /etc/dhcp/dhcpd.conf -f c | grep 192.168.X.' | ||
+ | #CMD='/usr/local/bin/dhcpd-pools -l /var/db/dhcpd/dhcpd.leases -c /usr/local/etc/dhcpd.conf -f c | grep 192.168.X.' | ||
+ | #MAX=`eval $CMD | cut -d'"' -f8` | ||
+ | #CUR=`eval $CMD | cut -d'"' -f10` | ||
+ | |||
+ | echo $MAX | ||
+ | echo $CUR | ||
echo 0 | echo 0 | ||
echo 0 | echo 0 | ||
Line 132: | Line 141: | ||
</code><code> | </code><code> | ||
... | ... | ||
- | Target[dhcp.stat]: `/root/scripts/dhcp/dhcpstat.sh` | + | Target[dhcp-stat]: `/etc/mrtg-dhcp-stat.sh` |
- | Title[dhcp.stat]: dhcp stat (ip) | + | Title[dhcp-stat]: dhcp stat (ip) |
- | PageTop[dhcp.stat]: <H1>lb dhcp stat (ip)</H1> | + | PageTop[dhcp-stat]: <H1>dhcp stat (ip)</H1> |
- | Options[dhcp.stat]: nobanner,gauge,noinfo,nopercent | + | Options[dhcp-stat]: nobanner,gauge,noinfo,nopercent |
- | MaxBytes[dhcp.stat]: 256 | + | MaxBytes[dhcp-stat]: 100 |
- | Unscaled[lb.dhcp.stat]: dwmy | + | Unscaled[dhcp-stat]: dwmy |
- | YLegend[lb.dhcp.stat]: Hosts (ip) | + | YLegend[dhcp-stat]: Hosts (ip) |
- | ShortLegend[lb.dhcp.stat]: ip | + | ShortLegend[dhcp-stat]: ip |
- | LegendI[lb.dhcp.stat]: dhcp leased | + | LegendI[dhcp-stat]: dhcp leased |
- | LegendO[lb.dhcp.stat]: max ip in pool | + | LegendO[dhcp-stat]: max ip in pool |
- | ... | + | |
</code> | </code> |