Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Monitoring weapon-- Cacti

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

I. Overview of cacti

1.1 cacti is a software implemented in PHP language, its main function is to use snmp services to obtain data, then use rrdtool to store and update data, and when users need to view data, use rrdtool to generate charts and present them to users. Therefore, snmp and rrdtool are the key to cacti. Snmp is related to data collection, and rrdtool is related to data storage and chart generation.

1.2 Mysql cooperates with PHP program to store some variable data and call it, such as hostname, host ip, snmp community name, port number, template information and other variables.

1.3 the data captured by snmp is not stored in mysql, but in the rrd file generated by rrdtool (in the rra folder of the cacti root directory). The update and storage of data in rrdtool is the processing of rrd file. Rrd file is a fixed-size archive file (RoundRobin Archive), and the number of data it can store has been defined at the time of creation.

1.4 LAMP: Linux + Apache + Mysql + PHP, and this Cacti version number 0.8.8H can only be used for document centos6, PHP 5.6, Mysql 5.6. An error will be reported if the version above is above.

1.5 modify the / etc/crontab configuration file to add the contents in the red box:

Second, install rrdtool

2.1 rpm-ivh http://apt.sw.be/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm

2.2 yum install rrdtool-y

3. Install and configure net-snmp

3.1 install net-snmp

Yum install net-snmp net-snmp-libs net-snmp-utils

3.2 configure net-snmp and modify it in / etc/snmp/snmpd.conf:

View systemview included .1.3.6.1.2.1.1 is: view systemview included .1.3.6.1.2.1

3.3Test net-snmp

Service snmpd start

Snmpwalk-v 1-c public localhost. 1.3.6.1.2.1.1.1.0

SNMPv2-MIB::sysDescr.0 = STRING: Linux cronos 2.4.28 # 2 SMP ven jan 1414 CET 2005 i686

Fourth, install LAMP

Yum install httpd php php-mysql php-snmp php-xml php-gd mysqlmysql-server

5. Install cacti

5.1 cd / home

Wget http://www.cacti.net/downloads/cacti-0.8.8h.tar.gz

Tar xzf cacti-0.8.8h.tar.gz

Mv cacti-0.8.8h / var/www/html/cacti

Cd / var/www/html/cacti

5.2 create a database. The database name can be defined according to your preferences.

Mysqladmin--user=root-p create cacti

Or go to the mysql backend to create a database, as shown below:

5.3 Import the database, which requires mysql-uroot-p cacti

< cacti.sql 5.4 创建数据库用户,注,我个人比较懒mysql里设定的全是空密码,在生产环境里必须设定密码以保证数库的安全;另外在生产环境需要设定独立的数据库用户名,不要使用root; shell>

Mysql-u root-p

Mysql > GRANT ALL ON cacti.* TO root@localhost

Mysql > flush privileges

5.5 configure include/config.php

$database_type = "mysql"

$database_default = "cacti"

$database_hostname = "localhost"

$database_username = "root"

$database_password = ""

5.6 set directory permissions

Chown-R apache rra/ log/

5.7 configure scheduled tasks

Echo "* / 5 * cactiuser php / var/www/html/cacti/poller.php > / dev/null2 > & 1" > > / etc/crontab

Servicecrond restart

Servicehttpd restart

5.8 complete the installation of cacti

Enter: http://XX.XX.XX.XX/cacti/ in the browser

Default user name: admin password: admin

Change password

Set the command path used by cacti

-

Note: at this point, the cacti setting is complete, as long as the switch sets the relevant SNMP service, the Cacti can collect the relevant data. Since the focus of this paper is not on data acquisition, there is no explanation on how to collect data.

-

VI. Plugins management

Plugins storage location / var/www/html/cacti/plugins-- > only do the frequently used Plugin instructions and installation

Configstore: backup management of the configure used to manage the switch firewall. This plug-in can help classify and batch backups of all devices.

Weathermap: needless to say, this is a plug-in that I think is the most powerful plug-in for monitoring the network topology map. Weathermap can do this for commercial software that cannot solve some functions. For example, you can show the number of end users connected by several AP on a diagram; you can display the traffic of your network architecture, CPU of each device, memory and other information on a topology diagram. You can show all the server devices in a computer room on one picture, such as network card information, Imax 0 information, and so on.

Syslog is used to collect the Log; of all network devices and view network device logs is a normal thing for network workers, but when you face thousands of network devices, how do you analyze huge amounts of device information? Yes, syslog can help you solve your troubles. It may quickly collect all the device information, and then according to the Alert classification you write, you can separate it from the heavy work of analyzing logs.

Thold is used to set various thresholds. For example, if your device is run up to 100% by CPU, how do you find and solve the problem? Thold can help you solve this kind of problem.

7. Plugins: Configstore use

Installation of tftp on 7.1 Linux: xinetd, tftp, tftp-server3 software is required

If you have access to the Internet, install through yum:

Sudo yum install xinetd

Sudo yum install tftp

Sudo yum install tptp-server

If you do not have access to the Internet, you can install the provided rpm package directly:

Sudo rpm-ivh xinetd-2.3.14-18.fc9.i386.rpm

Sudo rpm-ivh tftp-0.48-3.fc9.i386.rpm

Sudo rpm-ivhtftp-server-0.48-3.fc9.i386.rpm

7.2 configure the tftp server and modify the / etc/xinetd.d/tftp file

Change disable=yes to disable=no

Change server_args=-s / var/lib/tftpboot to server_args=-s / opt/backups-c

7.3 check tftp

Modify / etc/sysconfig/selinux file: SELINUX=disabled (system default is enforcing) to change to disabled

Chmod 777 / opt/backups modify permissions for / opt/backups folder

Start service xinetd restart

O check whether the tftp service is enabled: netstat-a | grep tftp displays a result of udp 0 0 *: tftp *: * indicating that the service has been enabled and the tftp configuration is successful

7.4 Configstore Settin

Set various types of Accounts to manage the permissions of different devices

Add the switch to the device group and set the backup time, which can be divided into three types: day / week / month. You must set DeviceType and authentication group, otherwise you cannot back up.

The following picture shows the devices that have been backed up.

Configstore downloads https://forums.cacti.net/viewtopic.php?f=19&t=39573&hilit=configstore

8. Plugins: syslog use

8.1 install syslog-ng

Rpm-Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm

Yum install-y syslog-ng

8.2 configure syslog-ng

Vi / etc/syslog-ng/syslog-ng.conf, add the following at the end of this configuration file:

# Remote logging

Source s_remote {

Tcp (ip (XXX.XXX.XXX.XXX) port (514)); [remarks: this is the native IP]

Udp (ip (XXX.XXX.XXX.XXX) port)

}

Destination d_separatedbyhosts {

File ("/ var/log/syslog-ng/$HOST/messages" owner ("root") group ("root") perm (0640) dir_perm (0750) create_dirs (yes))

}

Log {source (s_remote); destination (d_separatedbyhosts);}

Destination d_mysql {

Program ("mysql-u root syslog" [Note: syslog is the collection of device log database]

Template ("INSERT INTO syslog_incoming (host, facility, priority, date, time, message, status)

VALUES ('$HOST','$FACILITY','$PRIORITY','$YEAR-$MONTH-$DAY','$HOUR:$MIN:$SEC','$MSG','0');\ n ")

Template-escape (yes))

}

Log {source (s_remote); destination (d_mysql);}

8.3. Install the syslog plug-in, this syslog is already installed, without explanation and configured as follows:

Create a syslog database

Mysql-uroot-p

Create database syslog

GRANT ALL ON syslog.* TO root@localhost; [Note: set the database password in the production environment]

Go to cacti's syslog plug-in directory and execute the following command

Mysql-uroot-p syslog

< /var/www/html/cacti/plugins/syslog/syslog.sql [导入相关数据表] vi /var/www/html/cacti/plugins/syslog/config.php 内容如下: 修改/etc/crontab,增加如下内容 */1 * * * * root php /var/www/html/cacti/plugins/syslog/syslog_process.php 重启以下服务 /etc/init.d/syslog-ng restart /etc/init.d/mysqld restart 交机或是路由器增加log日志指向服务器 logging source-interface Loopback0 logging host 10.133.83.194 logging on 完成后系统收集的log,后面就可以根据收集到的数据进行分类alert消息 九、Plugins: weathermap使用 weathermap监控拓扑图如下: 下图监控状态实例说明: --------->

->

->

The configuration of IFSTATUS is as follows:

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report