In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly shows you "how to integrate the Cacti+Nagios monitoring platform". The content is simple and clear. I hope it can help you solve your doubts. Let the editor lead you to study and learn this article "how to integrate the Cacti+Nagios monitoring platform".
I. Cacti installation and deployment
As a Linux SA, the most important thing is to ensure the normal and stable operation of the website. We need to monitor the running status of the website and server in real time, and then we need to use open source software (cacti, nagios, zabbix, etc.) to monitor.
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. The data captured by snmp is not stored in mysql, but in the rrd file generated by rrdtool (under the rra folder of the cacti root directory, the suffix name is usually rra). The simple schematic diagram is as follows:
1. Cacti server-side installation
Downloading cacti-related software on the official website requires a total of three software. the download address is as follows:
Http://www.cacti.net/downloads/cacti-0.8.8a.tar.gzhttp://oss.oetiker.ch/rrdtool/pub/rrdtool-1.4.5.tar.gzhttp://www.cacti.net/downloads/spine/cacti-spine-0.8.8a.tar.gz
2. Install the LAMP system environment
The yum installation method is used here, and the installation command:
Yum install httpd mysql mysql-server php php-mysql php-json php-pdo-y
3. Install the rrdtool acquisition tool
Before installing rrdtool, you need to install the appropriate lib library, as follows:
Yuminstallcairo-devel libxml2-devel pango pango-devel-ytarxzf rrdtool-1.4.5.tar.gz;cdrrdtool-1.4.5;./configure-- prefix=/usr/local/rrdtool/make&&makeinstall;ln-s / usr/local/rrdtool/bin/* / usr/local/bin/
4. Install the SNMP service
Yum install net-snmp net-snmp-utils-y
5. Install the caction main program
Tar xzf cacti-0.8.8a.tar.gz & & mv cacti-0.8.8a / var/www/html/cacti/
6. Create a cacti database
Mysql-uroot-p enter your password to enter the database, and then create the database: create database cacti; create database grant all on cacti.*tocacti@'localhost'identified by "123456"; create users and authorize flush privileges; refresh permissions
7. After mysql is configured, import the cacti data into the cacti database
Mysql-ucacti-p123456 cacti > / tmp/cacti_rrdtool.log 2 > & 1
10. After installation of Cacti, test access
The following interface appears when accessed through http://ip/cacti/, and click NEXT next.
By default, always click on the next step:
To enter the login screen, you need to change the password for the first time:
11. Enter the Cacti configuration management interface
12. Click device to add devices. You can see 127.0.0.1 server by default. The Add in the upper right corner can add devices.
Click localhost to see the specific settings, including the version of snmp protocol used, the name of the monitor, and so on:
If snmp error appears, check to see if the snmp service is started or has permissions. If the above message appears, it is normal.
Click the second button in the upper left corner, and graphs will view the cacti image-select the localhost host-and on the right will display the monitoring image of cacti every 5 minutes.
II. Nagios deployment configuration
In view of the problem of space, the deployment of nagios is skipped here. Interested students can refer to my courses from introduction to advanced. Here we directly explain how to integrate nagios+cacti.
First of all, you need to install the php json module and ndoutils, where Ndoutils is a plug-in to nagios, which can be used to store the data obtained by nagios into the mysql database. It is also possible to integrate with cacti's plug-in npc, and the installation of this tool is key.
Php-json installation method:
Wget http://down1.chinaunix.net/distfiles/json-1.2.1.tgztarxzf json-1.2.1;cdjson-1.2.1;/usr/bin/phpize;./configure;make;makeinstall
After installation, add the json module by executing the following statement:
Echo "extension=json.so" > / etc/php.d/json.ini
Restart the apache server and go to the phpinfo.php page to see the following:
Note * if the module is not loaded correctly, you can use the command to view:
Php- m | grep json if you prompt a json, the module is loaded correctly, and if you prompt libxx.so, it indicates an error. The solution: yum remove php-common, and then reinstall common to OK.
1. Install ndoutils:
Wget http://downloads.sourceforge.net/project/nagios/ndoutils-1.x/ndoutils-1.4b9/ndoutils-1.4b9.tar.gztar xzf ndoutils-1.4b9.tar.gz;cd ndoutils-1.4b9;./configure--with-mysql-inc=/usr/include/mysql--with-mysql-lib=/usr/lib/mysql--enable-mysql--with-ndo2db-user=nagios--with-ndo2db-group=nagios&&make&&make install
Next, configure ndoutils:
Cp config/ndo2db.cfg-sample / usr/local/nagios/etc/ndo2db.cfg
Cp config/ndomod.cfg-sample / usr/local/nagios/etc/ndomod.cfg
The ndo2db.cfg content is as follows:
Ndo2db_user=nagiosndo2db_group=nagiossocket_type=tcpsocket_name=/usr/local/nagios/var/ndo.socktcp_port=5668db_servertype=mysqldb_host=localhostdb_port=3306db_name=cactidb_prefix=npc_db_user=cactidb_pass=123456max_timedevents_age=1440max_systemcommands_age=10080max_servicechecks_age=10080max_hostchecks_age=10080max_eventhandlers_age=44640debug_level=1debug_verbosity=1debug_file=/usr/local/nagios/var/ndo2db.debugmax_debug_file_size=1000000
The ndomod.cfg content is as follows:
Instance_name=defaultoutput_type=tcpsocketoutput=127.0.0.1tcp_port=5668output_buffer_items=5000buffer_file=/usr/local/nagios/var/ndomod.tmpfile_rotation_interval=14400file_rotation_timeout=60reconnect_interval=15reconnect_warning_interval=15data_processing_options=-1config_output_options=2
At the same time, add the following statement at the end of the nagios.cfg file:
Broker_module=/usr/local/nagios/bin/ndomod.o config_file=/usr/local/nagios/etc/ndomod.cfg
2. Install npc software:
Wget ftp://ftp.mirrorservice.org/sites/downloads.sourceforge.net/g/gi/gibtmirdas/npc-2.0.4.tar.gz
Tar xzf npc-2.0.4.tar.gz; mv npc / var/www/html/cacti/plugins/
Enable NPC through the interface
3. Select enable, then click settings, find the NPC entry, and enter the following content.
4. Then start the nod2db service at the background:
/ usr/local/nagios/bin/ndo2db-c / usr/local/nagios/etc/ndo2db.cfg
To view the backend log, you need to execute the following sql in mysql:
Mysql > use cacti;alter table npc_eventhandlers add long_output TEXT NOT NULL default''after output;alter table npc_hostchecks add long_output TEXT NOT NULL default''after output;alter table npc_hoststatus add long_output TEXT NOT NULL default''after output;alter table npc_notifications add long_output TEXT NOT NULL default''after output;alter table npc_servicechecks add long_output TEXT NOT NULL default''after output;alter table npc_servicestatus add long_output TEXT NOT NULL default''after output;alter table npc_statehistory add long_output TEXT NOT NULL default''after output Alter table npc_systemcommands add long_output TEXT NOT NULL default''after output
After the execution is successful, restart nagios and ndo2db. Through the page refresh, you can see that the following interface means the integration is successful.
The above is all the contents of the article "how to integrate the Cacti+Nagios Monitoring platform". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.