Sie sind auf Seite 1von 33

CACTI ( )

1. Cacti
2. Cacti
Cacti EZ (Centos / )
( OS Centos 6 ; 0.8.7g ; PA-2.8 ) Syslog-ng
Cacti ( Linux Distributions ) 10.4
( OS Ubuntu 10.4 ;0.8.7g;PA-2.9) Rsyslog
[HOWTO] Installation Guide | Ubuntu 11.04 | Cacti | Nagio
s
http://richardkok.wordpress.com/2010/10/14/install-and-con
figure-cacti-v0-8-7g-on-ubuntu-v10-04-1-step-by-step/
Cacti ( Windows )
(OS Windows 2008R2/ Window7;0.8.7g;PA2-8)
http://forums.cacti.net/viewtopic. php?t=14946
3 . Device / RRD
4 .
5 .
Graph / Tree
Flow / Mac track / Router Backup / WeatherMap / Syslog
CACTI ( )

1. Network
2. UNIX
SNMP
SSH Trust
3. WINDOWS
SNMP
WMI
POWERSHELL
4. Cacti /
Cacti
Cacti
What is Cacti ?
An Open Source
Performance Measurement Tool & Graphing Application
1. Web-base RRD frontend Management
2. Graphing &User Right Management information in MySQL
3. SNMP / Script or Command Support

Devices
SNMP
SNMP
RRD WMI
WMI
Script/Command
RRD Script/Command
Cacti ( )
Cacti ( )
1. Prerequisite
OS / WEB SERVER / PHP / MYSQL / NET-SNMP / RRD-TOOL
2. Web SERVER (DocumentRoot ->?)
/etc/apache2/sites-available/default Ubuntu( vi /etc/httpd/conf/httpd.conf )
/var/www/cacti/include/config.php $url_path = "/"; $url_path = "/cacti/;
3. MYSQL (3 /2 )
MySQLCactiUser="_cactiuser
MySQLCactiPwd="_cactipassw"
SystemCactiUser="usercacti"
MySQLRootPwd="dbadmin"
mysqlcheck -a -c -o -r --all-databases # db / / /
/usr/bin/mysql_secure_installation #change password
4. Spine (Option)
yum install gcc libtool (mysql-devel net-snmp-devel autoconf automake libtool)
Cacti ( )
Cacti ( )
1. CactiEZ
Network / Hostname / NTP / DNS / php.ini / Change password
2. Ubuntu
Network / Hostname / NTP / DNS / php.ini / Change root password
http://forums.cacti.net/viewtopic.php?f=6&t=38633 ( + +spine)
http://forums.cacti.net/viewtopic.php?f=14&t=41514 (syslog)
http://blog.jsdan.com/2675 ( yahei )
http://blog.happinesskt.idv.tw/2008/05/119 (RRD )
3. Windows
http://forums.cacti.net/viewtopic.php?t=14946 Windows Installer
IIS & IIS CGI install -> -> -> windows
->WEB (IIS )+World Wide Web (CGI)
Spine cygwin
http://www.cacti.net/spine_install_wincyg.php

* ubuntu /lib/init distribution os /etc/rc.d/init.d


* Remote DB (config.php . spine.conf )
CactiEZ
CactiEZ
password ( root / CactiEZ)
vi /etc/sysconfig/network-scripts/ifcfg-eth0

service network restart


vi /etc/reslov.conf
vi /etc/ntpd.conf
server time.stdtime.gov.tw
service ntpd restart
ntpdate -u ntpdate -u time.stdtime.gov.tw
http://w.x.y.z
Cacti Ubuntu 10.04
Cacti Ubuntu 10.04 (12)
iface eth0 inet static
sudo passwd root ( root ) address 10.1.1.1
netmask 255.255.255.0
vi /etc/network/interfaces
network 10.1.1.0
vi /etc/resolv.conf broadcast 10.1.1.255
nameserver 10.1.1.1 gateway 10.1.1.254
sudo apt-get update
apt-get install ntp chkconfig -y
vi /etc/ntp.conf ifconfig eth0 192.168.0.1 netmask 255.255.255.0
server 10.1.1.2 route add default gw 192.168.0.254
ntpdate -u 10.220.8.100
vi /etc/php5/apache2/php.ini (find / -name php.ini)

0.8.7g-spine0.8.7g-PA 2.9
cd ~
wget http://forums.cacti.net/download/file.php?id=22710 -O cacti_autoinstall_v0.40c.sh
wget http://forums.cacti.net/download/file.php?id=22711 -O README_CAIS_v0.40c.txt
cat ./README_CAIS_v0.40c.txt
chmod a+x cacti_autoinstall_v0.40c.sh
vi cacti_autoinstall_v0.40c.sh
echo "*/1 * * * * $SystemCactiUser php /var/www/cacti/poller.php >/dev/null 2>&1" >
/etc/cron.d/cacti
Cacti Ubuntu 10.04
Cacti Ubuntu 10.04 (3)
syslog
mkdir -p /home/update
cd /home/update
wget http://docs.cacti.net/_media/plugin:syslog-v1.21-1.tgz
mv plugin\:syslog-v1.21-1.tgz aaa.tgz
tar zxvf aaa.tgz
mv syslog /var/www/cacti/plugins
cd /var/www/cacti/plugins/syslog mysql -uroot -pdbadmin
use syslog;
mysql -uroot -pdbadmin syslog < syslog.sql
show tables;
5
mysql -uroot -pdbadmin
Mysql> GRANT ALL PRIVILEGES ON syslog.* TO _cactiuser@localhost IDENTIFIED BY
'_cactipassw' ;
Mysql> flush privileges;
apt-get install rsyslog rsyslog-mysql
vi /etc/rsyslog.conf
1- $ModLoad ommysql
2- $template cacti_syslog,"INSERT INTO syslog_incoming(facility, priority, date, time, host,
message) values (%syslogfacility%, %syslogpriority%, '%timer eported:::date-mysql
%', '%timereported:::date-mysql%', '%HOSTNAME%', '%msg%')", SQL
3- *.* >localhost,syslog,_cactiuser,_cactipassw;cacti_syslog
reboot
Cacti Ubuntu 10.04
Cacti Ubuntu 10.04 (45)
yahei
apt-get install lynx-cur*
lynx http://www.box.net/shared/6rfdpirpku
sudo mkdir /usr/share/fonts/yahei
sudo mv msyh.ttf /usr/share/fonts/yahei
sudo chmod 755 /usr/share/fonts/yahei -R
sudo mkfontscale
sudo mkfontdir
sudo fc-cache -fv
/usr/share/fonts/yahei/msyh.ttf
root@ubuntu:~# fc-list
vi /var/www/cacti/lib/functions.php
<?php
setlocale(LC_CTYPE, "zh_TW.UTF-8");
DB / WEB SERVER
mysql -uroot -pdbadmin
mysql> ALTER DATABASE `cacti` DEFAULT CHARACTER SET utf8 COLLATE
utf8_general_ci;
mysql> Exit;
Cacti Windows
Cacti Windows (1)
Web: admin / cactipw
DB: root / cacti
Cacti Windows
Cacti Windows (2)

browser
SNMP
SNMP (SimpleProtocol
Protocol)
()
Network Management

SNMPstoresinformationinavirtualdatabasecalledaManagementInformation
Base(MIB).Thedatabaseishierarchical(treestructured)andentriesare
addressedthroughobjectidentifiers(OID).ThefollowingSNMPtableoutput
showsthisstructure:
.1.3.6.1.2.1.25.3.8.1.1.1=INTEGER:1
.1.3.6.1.2.1.25.3.8.1.1.2=INTEGER:2

1. SNMPv1doesnothaveanyencryptionandonlyusesacommunitystring
toidentifythemanagementstation,andeventhenitistransmittedinclear
text.Asaresult,SNMPv1isaveryinsecureprotocolbecauseSetRequests
canbeusedtoreconfigurenetworkequipmentifimproperlyconfigured.
2. SNMPv2(c)addressessomeoftheshortcomingsoftheSNMPv1protocol
byintroducingtwonewprotocoldataunits:GetBulkRequestsand
InformRequest.
3. SNMPv3doesnotaddnewoperationsorenhancementstotheMIB,but
addressesthesecurityproblemsofSNMPv1andSNMPv2c.Itcanbeseen
asSNMPv2cplusadditionalsecurity,asitallowsmessageencryptionand
strongauthenticationofsenders.
SNMP
SNMP (SimpleProtocol
Protocol)
()
Network Management
1. Standardized
2. Universallysupported
3. Extendible
4. Portable
5. allowsdistributedmanagementaccess
6. lightweightprotocol

SNMP or Ping HostDown ( )


Source IP Destination IP Flows Bytes Packets
10.0.2.3 10.200.50.41 1437 71.62 KB 1438
10.200.50.41 10.0.2.3 2874 143.54 KB 2882
-> 24 / 71.62/143.54 KB
: -> 24
Source IP Destination IP Flows Bytes Packets
10.0.2.51 10. 200.50.41 16658 3.46 MB 41090
10.200.50.41 10.0.2.51 33398 6.17 MB 82334
-> 24 / 3.46/6.17 MByte -> 144/257 Kbyte
: -> 3
Source IP Destination IP Flows Bytes Packets
ath09.unix 10.200.50.41 2874 665.39 KB 4598
10.200.50.41 ath09.unix 5756 742.57 KB 9210
-> 24 / 665.39/742.57 KB
RRDRRD-Create
/ RRA ( )
RRD
TheRoundRobinDatabase
RRDfilesstoredatainafixedsizefile
UsingaFirstIn,FirstOut(FIFO)methodology
DifferentRoundRobinArchives(RRA)aredefinedwithinasingleRRDfile.
TheseRRAsusuallyconsistofdaily,weekly,monthly,andyearlyarchives

rrdtoolcreatetest.rrdstep300\
DS:data:GAUGE:600:U:U\
RRA:AVERAGE:0.5:1:16\
RRA:AVERAGE:0.5:4:16\
RRA:AVERAGE:0.5:12:16
RRDRRD-
/ RRA
((
) )
rrdtoolgraphdata1.png\
title"InterfaceSpeed"\
start1318216831\
end1318260031\
verticallabelbps\
DEF:intspeed=data1.rrd:data:AVERAGE\
CDEF:isGreen=intspeed,0,50,LIMIT\
HRULE:50#C0C0C0FF:"Threshold(50)\n"\
AREA:intspeed#FF0000:"OverThreshold\n"\
AREA:isGreen#00FF00:"Interfaceeth0"\
GPRINT:intspeed:LAST:"Current\:%8.0lf"\
GPRINT:intspeed:AVERAGE:"Average\:%8.0lf"\
GPRINT:intspeed:MAX:"Maximum\:%8.0lf\n"
Monitor Traffic( )Add
Device
1. Cisco Router / Switch Configuration
C3750(config)#snmp-server community 1234 ro
root@ubuntu:~# snmpwalk -c ytmisrt -v2c 10.227.130.254
2. Console->Devices
Add / Delete / Disable / Modify / Tree
(Availability / Reach ability Options)
Console->Settings->Poller->Host Up/Down Settings
Console->Settings->Poller->Host Availability Settings
(SNMP Options)
Console ->Settings->SNMP Defaults
3. Console ->Host Templates
Associated Data Queries+Associated Graph
Templates
4. Create Graphs for this Host
Data Source (RRD-Raw Data Management)
Graphs (Graph Management )
5. Add a Tree
Sub Tree
Management / User Right / Relation
Monitor Traffic( )Data
Input
1. Data Input Method
Simple Data Input (SNMP)
SNMP Data Input Method
Script / Command Data Input Method
2. Associated Data Queries
None
Uptime Goes Backwards
Index Count Changed
Verify All Fields
Monitor Traffic( )Import
1. Template ( )
Module
2. Other / Custom
http://forums.cacti.net
Scripts and Templates
3. Import template / Export template
Graph Template / Data Template / Data Query
Old -> New (ex: 0.8.7e->0.8.7g ) OK
Delete Template
4 .
Add Description
<
Monitor Traffic( )CDEF
1. CDEF(Status) +THOLD

2. CDEF (Status) Graph


Monitor Traffic( )CDEF( )
http://forums.cacti.net/viewtopic.php?f=5&t=43923&hilit=CDEF+color
+change
http://forums.cacti.net/viewtopic.php?f=12&t=31669

Eq
Ne
Lt
Gt
Le
Ge

CDEF=a,1,LE,a,UNKN,IF,1,+
if a<=1 -> a=a+1 or
unknow
,1,+ , up
CDEF=a,1,GT,a,UNKN,IF,1,+
if a<=1 -> a=a+1 or
unknow
,1,+ , up
Monitor Traffic( )THOLD
1. Threshold
Console -> Threshold
Console -> Data Sources
Graph
Thold

2. Threshold Template
Range
->
Device / DS / Graph
Monitor Traffic( )Mail
1.
Relay
Console -> Settings-> Mail/DNS
PHP Mail() Function
vi /etc/php.ini
install sendmail
SMTP
2 .
Monitor
Traffic( )WeatherMap
1. vi/etc/apache2/httpd.conf #
<Directory/var/www/cacti/plugins/weathermap>
# #
</Directory>
2. chownusercacti:wwwdata<cacti>/plugins/weathermap
3. chmod770<cacti>/plugins/weathermap/config
USER Management
User Management
1. Console->User Management
Add ( copy & batch copy ) (Shell)
User Right
Monitor Graph
Delete
Modify ( Change passed)
Local LDAP & Web Server

2. Console-> System Utilities->View User Log
3. Superlink
Monitor(1.2)
1. Host Down
2. Console -> Settings -> Misc
( )


3. Monitor / Disable
Flow(1.1)
syslog-(1.21)
1 . flowview 1.0
http://docs.cacti.net/plugin:flowview /cacti/plugins
2. mysql cacti < flowview.sql
3. chown -R usercacti:www-data flowview/*
4 .
5 . : Console -> Settings ->Paths
Default -> /var/netflow/flows/completed/
Flow(1.1)
Flowview 1.0
6 . Flows->Listeners
7 . flow-tools (apt-get install flow-tool*)
8 .
/usr/bin/flow-capture -w /var/netflow/flows/completed/C2821 0/0/2821 -S5
-V5 -z 9 -n 1439 -e 43200 -N -1
/usr/bin/flow-capture -w /var/netflow/flows/completed/C7206 0/0/7206 -S5
-V5 -z 9 -n 1439 -e 43200 -N -1
/etc/rc.local
9 . flow ? /var/netflow/flows/.
1 0 . / -bug (10/14)
Flow(1.2)
Flowview 1.0
Router Command-----------------------------
(config)#ipflowcachetimeoutactive5
(config)#ipflowexportsource
(config)#GigabitEthernet0/1
(config)#ipflowexportversion5
(config)#ipflowexportdestinationIPPort
(config)#ipflowtoptalkers
(config)#top50
(config)#sortbybytes
-----------------------------------------------
(configif)#ipflowingress
(configif)#ipflowegress
OR
(configif)#iproutecacheflow
-----------------------------------------------
#shipflowtoptalker
Flow(1.2)
/usr/bin/flowcatt"10/24/201109:16:28"T"10/25/201109:16:28"
/var/netflow/flows/completed/C3845/var/netflow/flows/completed/C3845|/usr/bin/flownfilter
f/tmp/1234FFlowViewer_filter|/usr/bin/flowstatf8S2|headn1000>>flow03.txt
Other Plugins
Cacti
Mactrack http://10.216.7.11
phpmactrack_scanner.phpfd
Aggregate http://10.220.8.222
Cycle http://10.216.7.13/cacti
Syslog http://10.220.8.221
Clog http://10.216.7.13/cacti
WeatherMap http://10.220.8.222
RouterConfig http://10.216.7.13/cacti
http://www.linuxidc.com/Linux/201008/27921.htm
Superlink http://10.216.7.13/cacti
Discovery http://10.216.7.11

Cacti
Cacti

Cactiwebsite
ThemainCactiwebsiteprovidesthelatestpatchesaswellaslotsofotherusefulinformationat:
http://www.cacti.net
DownloadSpine&PA&&/Document/Forum

Spine
Spineisahighperformancepollerwhich,byfar,exceedstheperformanceoftheoriginalcmd.php.Youcanfind
thelatestspineversionat:
http://www.cacti.net/spine_download.php

Cactibugreporting
IfyoufindabuginCacti,andthecommunityintheforumscanconfirmit,youshouldpostabugticketintheir
trackerat:
http://bugs.cacti.net/

CactiUsers'site
TheCactiUsers'siteprovidessomeadditionalplugins,aswellastheCactiEZISOimages.
http://www.cactiusers.org/
Cacti
Cli>reindex/useadd/repairdb
Docs>http://IP/docs/html/
Image>logo
Include>config.php
Install
Lib 1.vi/etc/logrotate.d/cactilog
Log 2.Insertthefollowingcode:
Resource /var/www/cacti/log/cacti.log{
RRA daily
Scripts rotate7
copytruncate
compress
notifempty
missingok
}
logrotate/etc/logrotate.confv
Cacti
Backup
mkdirp/home/backup/cacti
vi/var/www/cacti/backup.sh
#!/bin/sh
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
exportPATH
day=`date+%Y%m%d`

mysqldumpladddroptablecacti>/home/backup/Cacti/mysql.cacti."$day"
mysqldumpladddroptablesyslog>/home/backup/Cacti/mysql.syslog."$day"

tarjcvf/home/backup/Cacti/html."$day".tar.bz2exclude=/var/www/html/rra*
exclude=/var/www/html/log*/var/www/html
cp/var/spool/cron/root/home/backup/Cacti/root."$day

find/home/backup/Cacti/*typefmtime+15execrmfr{}\;>/dev/null2>&1

Das könnte Ihnen auch gefallen