91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

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

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

nagio cacti整合配置

發布時間:2020-06-27 03:44:36 來源:網絡 閱讀:564 作者:Tonl 欄目:移動開發

所需軟件:httpd-2.4.1.tar.gz  mysql-5.0.96.tar.gz      php-5.3.25.tar.gz

nagios-3.2.0.tar.gz   nagios-plugins-1.4.16.tar.gz   nrpe-2.12.tar.gz

rrdtool-1.4.8.tar.gz  cacti-0.8.8a.tar.gz   cacti-spine-0.8.8a.tar.gz

ntop-v0.2-1.tgz   monitor-v1.3-1.tgz  ndoutils-1.5.2.tar.gz

npc-2.0.4.tar.gz  json-1.2.1.tgz  PDO_MYSQL-1.0.2.tgz

一.設置lamp環境

編譯安裝httpd

Shell>tar zxvf httpd-2.4.1.tar.gz

Shell>cd httpd-2.4.1

Shell>./configure  --prefix=/usr/local/apache --enable-so

Shell>make && make install

編譯安裝msyql

Shell>tar zxvf mysql-5.3.25.tar.gz

Shell>cd mysql-5.3.25

Shell>./configure --prefix=/usr/local/mysql  --enable-thread-safe-client

Shell>make && make install

Shell>groupadd mysql

Shell>useradd mysql -g mysql

Shell>chown -r mysql.mysql /var/lib/mysql

Shell>/usr/local/mysql/bin/mysql_install_db    ##初始化數據庫##

Shell>cp support-files/my-medium.cnf /etc/my.cnf

Shell>/usr/local/mysql/bin/mysqld_safe  --defaults-file=/etc/my.cnf  --user=root &  

     ##啟動mysql##

Shell>/usr/local/msyql/bin/mysqldadmin -uroot -p 123456     #修改mysql登陸密碼##

Shell>ps -ef |grep mysqld    ##查看mysq進程##

編譯安裝

Shell>tar zxvf php-5.3.25.tar.gz

Shell>cd php-5.3.25

Shell>./confiugre --prefix=/usr/local/php  --with--mysql=/usr/local/mysql  

     --with-apxs2=/usr/local/apache/bin/apxs  --enable-sockets

     --with-config-file-path=/usr/local/php/etc  ##修改php.ini的存放位置##

Shell>make &&  make install

Shell>cp  php.ini-production  /etc/php.ini


安裝pdo_mysql擴展模塊

Shell>tar zxvf    PDO_MYSQL-1.0.2.tgz

Shell>cd   PDO_MYSQL-1.0.2

Shell>/usr/local/php/bin/phpize

Shell>make && make install

Shell>vim  /usr/local/php/etc/php.ini

     extension_dir = "/usr/local/php/lib/php/extensions/no-debug-zts-20090626/"

     extension = pdo_mysql.so

重啟apahce  查看是否已加載  php  -m |grep pdo-mysql

二、Apache php整合

打開Apache配置文件httpd.conf

添加PHPIniDir "/etc/php.ini"

跳轉到373后添加

AddType application/x-httpd-php .php

AddType application/x-httpd-php-source .phps


跳轉到246行添加 index.php

保存退出重啟apache  

Shell>/usr/local/apache/bin/apachectl start  

測試apachephp是否整合

Shell>vim /usr/local/apache/htdocs/text.php

<?php

Phpinfo;

?>

打開瀏覽器輸入http://ip/test.php,輸出php信息說明配置成功


測試php mysql整合

Shell>vim /usr/local/apache/htdocs/test.php

<?php

$link=mysql_connect("localhost","root","123456");

if(!$link) echo "FAILD!";

else echo "OK!";

?>

保存退出打開瀏覽器http://ip/test.php  輸出ok說明配置成功


三、安裝nagios

Shell>useradd -s /sbin/nologin nagios

Shell>mkdir -p /usr/local/nagios

Shell>chown -R nagios.nagios /usr/local/nagios

Shell>usermod  -G  nagios  -a  apache   ##apache用戶加入到nagios組中

Shell>tar zxvf nagios-3.2.0.tar.gz

Shell>cd nagios-3.2.0

Shell>./configure --prefix=/usr/local/nagios

Shell>make all

Shell>make install

Shell>make install-init

Shell>make install-commandmode

Shell>make install-config


安裝nagios插件

Shell>tar zxvf nagios-plugins-1.4.16.tar.gz

Shell>cd nagios-plugins-1.4.16

Shell>./configure --prefix=/usr/local/nagios

Shell>make && make install



打開apache配置文件httpd.conf 在末尾添加以后代碼:

ScriptAlias /nagios/cgi-bin /usr/local/nagios/sbin

<Directory "/usr/local/nagios/sbin">

   AuthType Basic

   Options ExecCGI

   AllowOverride None

   Order allow,deny

   Allow from all

   AuthName "Nagios Access"

   AuthUserFile /usr/local/nagios/etc/htpasswd

   Require valid-user

</Directory>


Alias /nagios /usr/local/nagios/share

<Directory "/usr/local/nagios/share">

   AuthType Basic

   Options None

   AllowOverride None

   Order allow,deny

   Allow from all

   AuthName "nagios Access"

   AuthUserFile /usr/local/nagios/etc/htpasswd

   Require valid-user

</Directory>


創建nagios登陸用戶

Shell>/usr/local/apache/bin/htpasswd -c /usr/local/nagios/etc/htpasswd admin     ##輸入登陸密碼

修改nagios目錄下cgi.cfg

Shell>vim /usr/local/nagios/etc/cgi.cfg

authorized_for_system_information=admin       #多個用戶用逗號分隔

authorized_for_configuration_information=admin

authorized_for_system_commands=admin

authorized_for_all_services=admin

authorized_for_all_hosts=admin

authorized_for_all_service_commands=admin

authorized_for_all_host_commands=admin


修改nagios目錄下nagios.cfg

command_check_interval=10s    ##檢查時間間隔

check_external_commands=1    ##允許web界面下重啟、關閉nagios進程等


檢查下nagios配置文件是否正確

Shell>/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

修改apache 運行的用戶

Shell>vim /usr/local/apache/conf/httpd.conf

    User  apache

    Group  apache


啟動nagios

Shell>/usr/local/nagios/bin/nagios -d  /usr/local/nagios/etc/nagios.cfg

啟動apache

Shell>/usr/local/apache/bin/httpd -k start

打開瀏覽器輸入http://ip/nagios就可以看到nagios的主界面


四、安裝nrpe

被監控機上安裝

Shell>groupadd nagios

Shell>useradd -g nagios -d  /usr/local/nagios  -s  /sbin/nologin  nagios

Shell>tar zxvf  nagios-plugins-1.4.16.tar.gz

Shell>cd  nagios-plugins-1.4.16

Shell>./configure --prefix=/usr/local/nagios

Shell>make && make install

Shell>tar zxvf nrpe-2.12.tar.gz

Shell>cd nrpe-2.12

Shell>./configure

Shell>make all

Shell>make instlal-plugin

Shell>make install-daemon

Shell> make install-daemon-config

Shell>chown  -R  nagios.nagios  /usr/local/nagios

配置nrpe

Shell>vim /usr/local/nagios/etc/nrpe.cfg

allowed_hosts=127.0.0.1,監控機ip

Shell>echo “nrpe:監控機ip” >>/etc/host.allow

啟動nrpe

Shell>/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d

Shell>echo “/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d “ >>/etc/rc.local  

    ## 設置開機啟動nrpe

檢查nrpe是否正常

Shell>netstat -atnlp |grep 5666

Shell>/usr/local/nagios/libexec/check_nrpe -H localhost

    NRPE v2.12                      ##說明nrpe啟動成功


監控機上安裝

Shell>tar zxvf  nrpe-2.12.tar.gz

Shell>cd nrpe-2.12

Shell>./configure --prefix=/usr/local/nagios

Shell>make

Shell>make install-plugin


測試是否可以連接被監控機

Shell>/usr/local/nagios/libexec/check_nrpe  -H  被監控機ip

     NRPE v2.12                    ##說明可以和被監控機通信


五.安裝cacti

安裝rrdtool

Shell>tar zxvf  rrdtool-1.4.8.tar.gz

Shell>cd rrdtool-1.4.8

Shell>./configure

Shell>make &&make install


安裝net-snmp

Shell>yum install net-snmp* -y


配置mysql

Shell>/usr/local/mysql/bin/mysql -uroot -p

Mysql>create database cactidb;

Mysql>grant all privileges on cactidb.* to “cactier”@”locahost” identified by “123456”

Mysql>grant all privileges on cactidb.* to “cactier”@”localhost” identified by “123456”


配置snmp.conf  (紅色字體為修改部分)

Shell>vim /etc/snmp/snmp.conf

    #       sec.name  source          community

    com2sec notConfigUser  default       public

    #       name           incl/excl     subtree         mask(optional)

    view    systemview    included   .1.3.6.1.2.1.1

    view    systemview    included   .1.3.6.1.2.1.25.1.1

    #       group          context sec.model sec.level prefix read   write  notif

    access  notConfigGroup ""      any       noauth    exact all  none  none

    ##           incl/excl subtree                          mask

view all    included  .1                               80

Shell>service snmpd start


安裝cacti

Shell>tar zxvf  cacti-0.8.8a.tar.gz

Shell>mv  cacti-0.8.8a   cacti

Shell>mv  cacti  /usr/local/apache/htdocs

Shell>cd /usr/local/apache/htdocs/cacti

Shell>/usr/local/mysql/bin/mysql  -uroot -p  cactidb <cacti.sql

Shell>chown -R  cactier /usr/local/apache/htdocs/cacti/rra   /usr/local/apache/htdocs/cacti/log  

編輯cacti/include/config.php文件

Shell>vim /usr/local/apache/htdocs/cacti/config.php

    $database_type = "mysql";

    $database_default = "cactidb";

    $database_hostname = "localhost";

    $database_username = "cactier";

    $database_password = "123456";

    $database_port = "3306";

保存退出

Shell>useradd  cactier

Shell>passwd  cactier

Shell>crontab -u cactier -e

*/1 * * * * *  /usr/bin/php /var/www/html/cacti/poller.php >/dev/null 2>&1  

登陸cacti

打開瀏覽器輸入http://ip/cacti   ---->設置

注意第一次登陸cacti默認用戶名和密碼為admin,登陸后要修改密碼



安裝spine

Shell>tar zxvf   cacti-spine-0.8.8a.tar.gz

Shell>cd cacti-spine-0.8.8a

Shell>./configure  --prefix=/usr/local/spine

Shell>make &&make install

Shell>mv /usr/local/spine/etc/spine.conf.dist   /usr/local/spine/etc/spine.conf

Shell>vim /usr/local/spine/etc/spine.conf

     DB_Host         localhost

     DB_Database     cactidb

     DB_User         cactier

     DB_Pass         123456

     DB_Port         3306

     DB_PreG         0


Shell>ln -s  /tmp/mysql.sock   /var/lib/mysql/mysql.sock


設置spine路徑,Console——Settings——Paths--->>/usr/local/spine/bin/spine


更改cacti輪詢器為spineConsole——Settings——Poller--->>poller type:spine    -->>Poller Interval:every minute   Cron Interval:every minute

Shell>/usr/local/spine/bin/spine



整合ntop monitorcacti

Shell>tar zxvf  ntop-4.0.tar.gz

Shell>cd  ntop-4.0

Shell>./autogen.sh

Shell>./configure --prefix=/usr/local/ntop

Shell>make && make install

Shell>chown -R  ntop.ntop  /usr/local/ntop/share/ntop

Shell>chown -R  ntop.ntop  /usr/local/ntop/var/ntop

配置啟動ntop

Shell>ntop  -A    輸入密碼

Shell>n/usr/local/ntop/bin/top -i eth0 -d -L -u ntop

Shell>echo '/usr/local/ntop/bin/ntop -i eth0 -d -L -u ntop &> /dev/null' >> /etc/rc.local


安裝ntop插件

Shell>tar zxvf  ntop-v0.2-1.tgz  -C  /usr/local/apache/htdocs/cacti/plugins/

Shell>vim /usr/local/apache/htdocs/cacti/include/config.php

    添加$plugins[] = "ntop";


設置cacticonsole---utilities---user managemet---admin---plugin management  view ntop

兩個選項選上,保存   console---configureation---plugin management---啟用ntop


安裝monitor

Shell>tar zxvf  monitor-v1.3-1.tgz  -C  /usr/local/apache/htdocs/cacti/plugins/

Shell>vim /usr/local/apache/htdocs/cacti/include/config.php

   添加$plugins[] = "monitor";

設置cacti:略  (步驟和安裝ntop一樣)



Nagioscacti整合

安裝ndoutils

Shell>tar zxvf    ndoutils-1.5.2.tar.gz

Shell>cd ndoutils-1.5.2

Shell>./configure --prefix=/usr/local/nagios --enable-mysql --disable-pgsql  

   --with-mysql-inc=/usr/local/mysql/include

   --with-mysql-lib=/usr/local/mysql/lib/mysql

Shell>make  && make install

Shell>cp -v src/{ndomod-3x.o,ndo2db-3x,file2sock,log2ndo} /usr/local/nagios/bin/

Shell>./installdb -ucactier -p123456 -hlocalhost -d cactidb

Shell>cp -v config/{ndo2db.cfg-sample,ndomod.cfg-sample} /usr/local/nagios/etc/

Shell>mv /usr/local/nagios/etc/ndo2db.cfg-sample /usr/local/nagios/etc/ndo2db.cfg

Shell>mv /usr/local/nagios/etc/ndomod.cfg-sample /usr/local/nagios/etc/ndomod.cfg

Shell>chown -R nagios.nagios /usr/local/nagios/etc/ndo*

Shell>chown -R nagios.nagios /usr/local/nagios/bin/*

Shell>vim /usr/local/nagios/etc/nagios.cfg添加

        broker_module=/usr/local/nagios/bin/ndomod-3x.o

        config_file=/usr/local/nagios/etc/ndomod.cfg

        event_broker_options=-1

Shell>vim /usr/local/nagios/etc/ndo2db.cfg

    socket_type=tcp  

    db_servertype=mysql  

    db_host=localhost  

    db_port=3306  

    db_name=cactidb  

    db_prefix=nagios_  

    db_user=cactier

    db_pass=123456

Shell>vim /usr/local/nagios/etc/ndomod.cfg

      output_type=tcpsocket  

      output=127.0.0.1

Shell>cp ./daemon-init /etc/init.d/ndo2db

Shell> vi /etc/init.d/ndo2db

# 檢查里面的路徑確保不會出現“//”,并將Ndo2dbBin修改成下面的值:

Ndo2dbBin=/var/www/html/nagios/bin/ndo2db-3x

Shell>chmod +x /etc/init.d/ndo2db

Shell>service ndo2db start

查看是否有錯誤

Shell>tail -f /var/logl/messages   或者    tail -f  /usr/local/nagios/var/nagios.log


安裝npc

Shell> tar zxvf  npc-2.0.4.tar.gz  -C /usr/local/apache/htdocs/cacti/plugins

Shell>vim /usr/local/apache/htdocs/cacti/include/config.php

    添加$plugins[] = 'npc';


安裝npc支持json

Shell>tar zxvf  json-1.2.1.tgz

Shell>cd json-1.2.1

Shell>/usr/local/php/bin/phpize

Shell>./configure

Shell>make && make install

安裝完后會有類似這樣的提示:

Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-non-zts-20050922/

查看是否有導入信息

Shell>/usr/local/php/bin/php -i |grep php.ini  

##Configuration File  Loaded Configuration File  php.ini路徑

Shell>vim  /etc/php.ini

    添加extension = json.so

查看json 是否加載

Shell>/usr/local/php/bin/php -m |grep json  



修改ndo2db.cfg文件

Shell>vim /usr/local/nagios/etc/ndo2db.cfg

     db_prefix=nagios_   修改為db_prefix=npc_


修改cacti npc插件

Console-->settings-->npc -->Remote Commands選項打勾--->輸入nagios command file pathc -->輸入nagios URL -->host icons   service icons選項打勾

-->logging level  選擇DEBUG   保存



修改數據庫表結構:

Shell>/usr/local/mysql/bin/mysql  -uroot -p

Msyql>use cactidb;

Msyql>

ALTER TABLE `npc_hostchecks` ADD COLUMN `long_output` varchar(8192) NOT NULL default '' AFTER `output`;

ALTER TABLE `npc_hoststatus` ADD COLUMN `long_output` varchar(8192) NOT NULL default '' AFTER `output`;

ALTER TABLE `npc_servicechecks` ADD COLUMN `long_output` varchar(8192) NOT NULL default '' AFTER `output`;

ALTER TABLE `npc_servicestatus` ADD COLUMN `long_output` varchar(8192) NOT NULL default '' AFTER `output`;

ALTER TABLE `npc_statehistory` ADD COLUMN `long_output` varchar(8192) NOT NULL default '' AFTER `output`;

ALTER TABLE `npc_eventhandlers` ADD COLUMN `long_output` varchar(8192) NOT NULL default '' AFTER `output`;

ALTER TABLE `npc_systemcommands` ADD COLUMN `long_output` varchar(8192) NOT NULL default '' AFTER `output`;

ALTER TABLE `npc_notifications` ADD COLUMN `long_output` varchar(8192) NOT NULL default '' AFTER `output`;

Mysql>exit


重啟ndo2db nagios 服務

Shell>service  ndo2db  restart

Shell>/usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg


向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

那曲县| 浑源县| 福清市| 科技| 乾安县| 磐安县| 武陟县| 洪湖市| 太仓市| 墨脱县| 长泰县| 宁南县| 巴林左旗| 庆阳市| 康平县| 西贡区| 黄石市| 门源| 慈利县| 油尖旺区| 文登市| 琼海市| 广元市| 扎囊县| 阿城市| 海林市| 漳平市| 民权县| 华容县| 南陵县| 吉水县| 峡江县| 迁安市| 岗巴县| 都昌县| 营口市| 温宿县| 驻马店市| 徐水县| 云阳县| 定远县|