{{page>:menu}} ====== Cacti ====== *[[http://www.cacti.net/downloads/docs/html/install_unix.html|Instalace]] *[[http://cactiez.cactiusers.org/|CactiEZ]] - distribuce CentOs s předinstalovaným Cacti ===== instalace ===== yum install net-snmp* rrdtool* svn checkout svn://svn.cacti.net/cacti/cacti/branches/0.8.8 ./cacti ==== spine ==== *http://www.cacti.net/downloads/spine/ svn checkout svn://svn.cacti.net/cacti/spine/branches/0.8.7/ spine ===== Skripty ===== ==== cron ==== # Cacti */5 * * * * cactiuser /usr/bin/php /home/www/cacti/poller.php > /dev/null 2>&1 12 4 * * * cactiuser /usr/bin/php /home/www/cacti/cli/poller_reindex_hosts.php --id=All --qid=all > /dev/null 2>&1 12 5 * * * cactiuser /usr/bin/php /home/www/cacti/cli/poller_graphs_reapply_names.php -id=All > /dev/null 2>&1 ==== 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 /scripts/iptables.pl " # and you will need to setup an input field so that the 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"; } * Data: {{ostatni:cacti_data_template_iptables_all_traffic.xml}} * Graph: {{ostatni:cacti_graph_template_iptables_traffic.xml}} ==== packet_loss.pl ==== #!/usr/bin/perl $ping = `ping -c 5 $ARGV[0] | grep loss`; $ping =~ m/(.*, )(.*)%/; print $2; {{:ostatni:cacti_graph_template_packet_loss.xml|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 "; } * Data template: {{ostatni:cacti_data_template_mbmon_teploty.xml}} * Graf template: {{ostatni:cacti_graph_template_mbmonteploty.xml}} ==== sqladv.php ==== ==== rrdupdate.sh ==== *aktualizace maximálních hodnot #!/bin/sh RRA_PATH=/var/www/cacti/rra for rdd in `ls $RRA_PATH | grep traffic` do rrdtool tune $RRA_PATH/$rdd --maximum traffic_in:1000000000 --maximum traffic_out:1000000000 done ==== Ubiquiti wifi ==== *{{:ostatni:cacti_graph_template_ubiquity_wifi.xml|}} #!/usr/bin/perl use strict; #use warnings; use LWP::UserAgent; use HTTP::Cookies; use JSON; if (($#ARGV+1) ne 4) { exit(); } my $host = $ARGV[0]; my $port = $ARGV[1]; my $user = $ARGV[2]; my $pass = $ARGV[3]; my $cookie_jar = HTTP::Cookies->new(); my $browser = LWP::UserAgent->new(); my $response = ''; my $json = JSON->new(); $browser->cookie_jar($cookie_jar); $response = $browser->get( "https://${host}:${port}/login.cgi" ); $response = $browser->post( "https://${host}:${port}/login.cgi", Content_Type => 'form-data', Content => [ username => ${user}, password => ${pass}, ], ); $response = $browser->get( "https://${host}:${port}/status.cgi" ); #print ("apmac:" .$json->decode($response->content)->{wireless}->{apmac} ." "); print ("ccq:" .$json->decode($response->content)->{wireless}->{ccq}/10 ." "); print ("signal:".$json->decode($response->content)->{wireless}->{signal} ." "); print ("noisef:".$json->decode($response->content)->{wireless}->{noisef} ." "); #print ("snr:" .$json->decode($response->content)->{wireless}->{noisef} ." "); print ("txrate:".$json->decode($response->content)->{wireless}->{txrate} ." "); print ("rxrate:".$json->decode($response->content)->{wireless}->{rxrate} ." "); print ("channel:".$json->decode($response->content)->{wireless}->{channel}); ===== XML configs ===== ==== wlan-client ==== Wireless Clients Clients connect to AP .1.3.6.1.4.1.762.2.9.1.1.2 Client Name walk value input .1.3.6.1.4.1.762.2.9.1.1.4 MAC addr walk value input .1.3.6.1.4.1.762.2.9.1.1.2 Signal-to-Noise Ratio (SNR) - average walk value input .1.3.6.1.4.1.762.2.9.1.1.7 Total bytes walk value input .1.3.6.1.4.1.762.2.9.1.1.5 Signal-to-Noise Ratio (SNR) - average walk value output .1.3.6.1.4.1.762.2.9.1.1.7 Total bytes walk value output .1.3.6.1.4.1.762.2.9.1.1.5 ===== šablony ===== *{{:ostatni:cacti_host_template_apc.xml|}} *{{:ostatni:cacti_host_template_mikrotik.xml|}} - CPU, temp, interface *{{:ostatni:cacti_host_template_papouch.xml|}}