溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

The Nagios Monitoring數(shù)據(jù)如何寫進(jìn)Mysql中

發(fā)布時間:2020-06-02 11:22:49 來源:網(wǎng)絡(luò) 閱讀:202 作者:三月 欄目:移動開發(fā)

下文主要給大家?guī)鞹he Nagios Monitoring數(shù)據(jù)如何寫進(jìn)Mysql中,希望這些內(nèi)容能夠帶給大家實際用處,這也是我編輯The Nagios Monitoring數(shù)據(jù)如何寫進(jìn)Mysql中這篇文章的主要目的。好了,廢話不多說,大家直接看下文吧。

-------------------------------CMAKE-------------------------------

Install the compiler tool:

#tar xzf cmake-2.8.10.2.tar.gz 
#cd cmake-2.8.10.2
#./bootstrap
#make
#make install
-------------------------------Mysql-------------------------------
Preparatory work:
#groupadd mysql
#useradd -r -g mysql mysql
#mkdir /etc/mysql
#chown mysql:mysql /etc/mysql
 
Compile & Install:
#tar xzf mysql-5.6.10.tar.gz
#cd mysql-5.6.10
#cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_DATADIR=/var/mysql/data \
-DSYSCONFDIR=/etc/mysql \
-DEXTRA_CHARSETS=all \
-DENABLED_LOCAL_INFILE=1
#make
#make install
 
Database initialization:
#chown -R mysql:mysql /usr/local/mysql
#mkdir -p /var/mysql/data
#chown -R mysql:mysql /var/mysql
#cd /usr/local/mysql/scripts
#./mysql_install_db --user=mysql \
--basedir=/usr/local/mysql \
--datadir=/var/mysql/data \
--skip-name-resolve
#mv ../support-files/my-default.cnf /etc/mysql/my.cnf
#mv ../support-files/mysql.server /etc/rc.d/init.d/mysqld
#service mysqld start
 
Change Password & verify that the installation was successful:
#/usr/local/mysql/bin/mysqladmin -u root password 'mysql'
#/usr/local/mysql/bin/mysql -uroot -pmysql
>status
 
-------------------------------Ndoutils-------------------------------
The ndoutils installation:
#tar xzf ndoutils-1.5.2.tar.gz
#cd ndoutils-1.5.2
#./configure --prefix=/usr/local/nagios \
--with-mysql=/usr/local/mysql \
--sysconfdir=/etc/nagios \
--with-ndo2db-user=nagios \
--with-ndo2db-group=nagios \
--enable-mysql
 
Modify the installation configuration file, otherwise it will make an error:
#vi include/config.h
#Original configuration is as follows:
#include <mysql/mysql.h>
#include <mysql/errmsg.h>
#Modified as follows
#include </usr/local/mysql/include/mysql.h>
#include </usr/local/mysql/include/errmsg.h>
 
Installation:
#make
  
Copy the compiled daemon to your Nagios installation:
#cp src/ndomod-3x.o /usr/local/nagios/bin/
#cp src/ndo2db-3x /usr/local/nagios/bin/ndo2db
#chown nagios:nagios /usr/local/nagios/bin/ndo*
 
Copy the default configuration file to the configuration directory that you specify:
#cp config/ndo2db.cfg-sample /etc/nagios/ndo2db.cfg
#cp config/ndomod.cfg-sample /etc/nagios/ndomod.cfg
#chown nagios:nagios /etc/nagios/ndo*
 
Increase to start the service:
#cp daemon-init /etc/init.d/ndo2db
#chmod u+x /etc/init.d/ndo2db
 
Create a database:
#export PATH=$PATH:/usr/local/mysql/bin/
#mysql -uroot -pmysql
>create database nagios;
>quit
 
Creating a database structure:
#cd db
#mysql -uroot -p nagios<./mysql.sql
 
Modify the Nagios configuration file:
#vim /etc/nagios/nagios.cfg
#Add by Kingcraft
broker_module=/usr/local/nagios/bin/ndomod-3x.o config_file=/etc/nagios/ndomod.cfg
 
Empowering for the database user nagios:
#mysql -u root -pmysql
>grant all privileges on nagios.* to 'nagios'@'127.0.0.1' identified by 'nagios';
>quit
 
Modify the Ndoutils configuration file:
#vim /etc/nagios/ndo2db.cfg
db_user=nagios
db_pass=nagios
db_host=127.0.0.1
 
#vim /etc/nagios/ndomod.cfg
output=127.0.0.1
 
Create soft links, or can not start:
#ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib64
 
Verify whether the nagios data can be written to the database:
#service ndo2db start
#service nagios restart
 
#mysql -u root -pmysql
>use nagios
>select host_id,display_name,address from nagios_hosts;
+---------+-----------------+-----------------+
| host_id | display_name    | address         |
+---------+-----------------+-----------------+
|       1 | Linuxhost       | 192.168.174.130 |
|       2 | linksys-srw224p | 192.168.60.16   |
+---------+-----------------+-----------------+
對于以上關(guān)于The Nagios Monitoring數(shù)據(jù)如何寫進(jìn)Mysql中,大家是不是覺得非常有幫助。如果需要了解更多內(nèi)容,請繼續(xù)關(guān)注我們的行業(yè)資訊,相信你會喜歡上這些內(nèi)容的。

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI