Toto je starší verze dokumentu!


ÚVOD » tajná oblast CLnet » 3comCiscoHuaweiIPv6LinuxMicrosoftNovellRouterboardVMwareostatní instalaceknihovna


04.01.2015 09:55

Cacti

instalace

yum install net-snmp* rrdtool*
svn checkout svn://svn.cacti.net/cacti/cacti/branches/0.8.7 ./cacti

spine

svn checkout svn://svn.cacti.net/cacti/spine/branches/0.8.7/ spine

Skripty

iptables.pl

#!/usr/bin/perl
#
# Oznacovani paketu pro mereni prenosu
#
# $IPTABLES -N InetOut
# $IPTABLES -A InetOut  -o eth0  -j RETURN
# $IPTABLES -A OUTPUT  -o eth0  -j InetOut
# $IPTABLES -A FORWARD  -o eth0  -j InetOut
#
# $IPTABLES -N InetIn
# $IPTABLES -A InetIn  -i eth0  -j RETURN
# $IPTABLES -A INPUT  -i eth0  -j InetIn
# $IPTABLES -A FORWARD  -i eth0  -j InetIn
#
# Pak se spusti: iptables.pl Inet
#
# Sudo Configuration (/etc/sudoers)
# > www-data    ALL = NOPASSWD: /usr/share/cacti/scripts/iptables.pl
#
# The Input String should be set to "sudo <path_cacti>/scripts/iptables.pl <chain>"
# and you will need to setup an input field so that the <chain> argument can be passwd.
#
# The data input type should be set to COUNTER
#
#
 
 
@smery = ("In","Out");
 
if ($ARGV[0]) {
    foreach $smer (@smery) {
        $chains = `/sbin/iptables -xnvL | grep -A 2 'Chain $ARGV[0]$smer'`;
        @chains = split(/\n/, $chains);
        $chains[2] =~ /[\W+]?[0-9]+\W+([0-9]+)\W+/;
        print "bytes_$smer:$1 ";
    }
}
else {
    print "Usage: $0 Chain\n";
}

packet_loss.pl

#!/usr/bin/perl
 
$ping = `ping -c 5 $ARGV[0] | grep loss`; 
$ping =~ m/(.*, )(.*)%/; 
 
print $2; 

cacti_graph_template_packet_loss.xml

mbmon.pl

#!/usr/bin/perl
#
#  Monitoring teplot 
#
@data =  split(/\n/, `/usr/bin/mbmon -r -c 1`);
foreach $value (@data) {
	$value =~ s/ //g;
	print "$value ";
}

sqladv.php

<?php
$var = $argv[1];
mysql_connect("localhost", "root", "xxxxx") or die ("No connect");
$res = mysql_query("SHOW STATUS") or die("No query");
while ($a = mysql_fetch_row($res)) {
    $stat[$a[0]] = $a[1];
}
printf("%s", $stat[$var]);
mysql_close();
?>

XML configs

wlan-client

<interface>
	<name>Wireless Clients</name>
	<description>Clients connect to AP</description>
	<oid_index>.1.3.6.1.4.1.762.2.9.1.1.2</oid_index>
	<fields>
		<name>
			<name>Client Name</name>
			<method>walk</method>
			<source>value</source>
			<direction>input</direction>
			<oid>.1.3.6.1.4.1.762.2.9.1.1.4</oid>
		</name>
		<MacAddr>
			<name>MAC addr</name>
			<method>walk</method>
			<source>value</source>
			<direction>input</direction>
			<oid>.1.3.6.1.4.1.762.2.9.1.1.2</oid>
		</MacAddr>
		<SnrShow>
			<name>Signal-to-Noise Ratio (SNR) - average</name>
			<method>walk</method>
			<source>value</source>
			<direction>input</direction>
			<oid>.1.3.6.1.4.1.762.2.9.1.1.7</oid>
		</SnrShow>
		<TotalBytesShow>
			<name>Total bytes</name>
			<method>walk</method>
			<source>value</source>
			<direction>input</direction>
			<oid>.1.3.6.1.4.1.762.2.9.1.1.5</oid>
		</TotalBytesShow>
		<SNR>
			<name>Signal-to-Noise Ratio (SNR) - average</name>
			<method>walk</method>
			<source>value</source>
			<direction>output</direction>
			<oid>.1.3.6.1.4.1.762.2.9.1.1.7</oid>
		</SNR>
		<TotalBytes>
			<name>Total bytes</name>
			<method>walk</method>
			<source>value</source>
			<direction>output</direction>
			<oid>.1.3.6.1.4.1.762.2.9.1.1.5</oid>
		</TotalBytes>
	</fields>
</interface>

šablony

ostatni/cacti.1299324346.txt.gz · Poslední úprava: 13.03.2020 18:43 (upraveno mimo DokuWiki)
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0