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

溫馨提示×

溫馨提示×

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

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

關于nagios_nrpe的參數傳遞

發布時間:2020-07-19 17:48:29 來源:網絡 閱讀:1266 作者:heymra 欄目:移動開發

第一段文檔簡單寫了如何搭建nagios/pnp4nagios/

useradd nagios
groupadd nagcmd
usermod -a -G nagcmd nagios
src=/home/nagios/src
mkdir ${src}
cd ${src}
wget http://ar2.php.net/distributions/php-5.5.9.tar.gz
wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.5.1.tar.gz
wget http://nagios-plugins.org/download/nagios-plugins-2.0.tar.gz
wget http://mirror.bit.edu.cn/apache/httpd/httpd-2.4.7.tar.gz
wget http://mirror.bit.edu.cn/apache//apr/apr-1.5.0.tar.gz
wget http://mirror.bit.edu.cn/apache//apr/apr-util-1.5.3.tar.gz
wget http://jaist.dl.sourceforge.net/project/mysql.mirror/MySQL%205.6.16/mysql-5.6.16.tar.gz
wget http://mirrors.neusoft.edu.cn/epel/6Server/x86_64/epel-release-6-8.noarch.rpm
wget http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.4.8.tar.gz
wget http://cznic.dl.sourceforge.net/project/pnp4nagios/PNP-0.6/pnp4nagios-0.6.21.tar.gz
rpm -ivh epel-release-6-8.noarch.rpm
#FOR RHEL5/CENTOS5x86_64
#DOWNLOAD URL IS http://mirrors.neusoft.edu.cn/epel/5Server/x86_64/epel-release-5-4.noarch.rpm
yum -y install wget mhash mcrypt libmcrypt-devel cmake cpan make autoconf automake curl curl-devel gcc gcc-c++ zlib zlib-devel openssl openssl-devel pcre pcre-devel gd gd-devel kernel keyutils patch perl-core kernel-headers compat* mpfr cpp glibc glibc-common libgomp libstdc++-devel pplcloog-ppl keyutils-libs-devel libcom_err-devel libsepol-devel libselinux-develkrb5-devel libXpm* freetype freetype-devel libjpeg* libpng libpng-devel php-common php-gd ncurses* libtool* libxml2 libxml2-devel
packagelist=`ls ${src}/*.tar.gz`
for package in $packagelist;do tar xvf $package;done
cd cd ${src}/apr-1.5.0
./configure
make && make install
cd ${src}
cd cd ${src}/apr-util-1.5.3
./configure --with-apr=/usr/local/apr
make && make install
cd ${src}
chown -R nagios. ${src}
su - nagios
cd ${src}/httpd-2.4.7
./configure --prefix=/home/nagios/httpd  --enable-ssl=shared --enable-module=most --enable-shared=most --enable-rewrite
make && make install
cd modules/generators/
~/httpd/bin/apxs -i -a -c mod_cgi.c
~/httpd/bin/apxs -i -a -c mod_cgid.c
cd ${src}/mysql-5.6.16
cmake -DCMAKE_INSTALL_PREFIX=/home/nagios/mysql
make && make install
cd /home/nagios/mysql/
./scripts/mysql_install_db -basedir=/home/nagios/mysql -datadir=/home/nagios/mysql/data --user=nagios
/home/nagios/mysql/bin/mysqld_safe &
./bin/mysqladmin -u root password $password
cat >>~/.bash_profile<<EOF
export PATH=$HOME/mysql/bin
EOF
cd ${src}/php-5.5.9
./configure --prefix=/home/nagios/php \
--with-apxs2=/home/nagios/httpd/bin/apxs \
--with-mysql=/home/nagios/mysql \
--with-mysqli=/home/nagios/mysql/bin/mysql_config \
--with-zlib-dir \
--with-gd \
--with-libxml-dir \
--with-freetype-dir \
--with-jpeg-dir \
--with-png-dir \
--with-mhash \
--with-mcrypt \
--with-iconv \
--with-openssl \
--with-gettext \
--enable-bcmath \
--enable-shmop \
--enable-fpm \
--enable-mbstring \
--enable-gd-native-ttf \
--enable-gd-jis-conv \
--enable-static \
--enable-zend-signals \
--enable-inline-optimization \
--enable-sockets \
--enable-soap \
--enable-ftp \
--enable-zip \
--enable-session \
--with-curl \
--disable-ipv6
make && make install
cp php.ini-production ~/php/etc/php.ini
#vim ~/httpd/conf/httpd.conf
#replace User/Group to nagios
#ServerName注釋127.0.0.1
#修改默認80端口
#AddType application/x-httpd-php .php
#<IfModule dir_module>
#    DirectoryIndex index.html index.php
#</IfModule>
rm -rf ~/httpd/htdocs/index.html
cat >>~/httpd/htdocs/index.php<<EOF
<?php
phpinfo();
?>;
EOF
cd ${src}/nagios-4.0.2
./configure --prefix=/home/nagios/nagios --enable-embedded-perl --with-command-group=nagcmd
make all
make install
#must_be_root
make install-init
make install-config
make install-commandmode
cat sample-config/httpd.conf>>~/httpd/conf/httpd.conf
~/httpd/bin/htpasswd -c /home/nagios/nagios/etc/htpasswd.users nagios
cd ${src}/nagios-plugins-1.5
 ./configure --prefix=/home/nagios/nagios/ --with-nagios-user=nagios --with-nagios-group=nagios --enable-libtap --enable-extra-opts --enable-perl-modules
make && make install
sed -i "s/nagiosadmin/nagiosadmin,nagios/g" ~/nagios/etc/cgi.cfg
#啟動nagios:~/nagios/bin/nagios -d ~/nagios/etc/nagios.cfg
exit
echo "#BACK TO ROOOT#"
yum -y install cjkuni*
yum -y install cairo-devel pango pango-devel net-snmp* php-snmp libart_lgpl-devel
#install_rrdtool #must_be_root
cd ${src}/rrdtool-1.4.8
./configure --prefix=/home/nagios/rrdtool --enable-perl-site-install
make && make install
chown -R nagios. /home/nagios/rrdtool
#install pnp4nagios
su - nagios
cd ${src}/pnp4nagios
./configure --prefix=/home/nagios/pnp --with-rrdtool=/home/nagios/rrdtool/bin/rrdtool  --with-base-url=/pnp  --with-httpd-conf=/home/nagios/httpd/conf
make all
make install
make install-webconf
make install-config
echo "include conf/pnp4nagios.conf">>~/httpd/conf/httpd.conf
#vim ~/nagios/etc/objects/templates.cfg
define host {
   name       host-pnp
   action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=_HOST_
   register   0
}
define service {
   name       srv-pnp
   action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=$SERVICEDESC$
   register   0
}
#vim ~/nagios/etc/objects/commands.cfg
define command{
        command_name    process-host-perfdata
        command_line    /usr/bin/perl /home/nagios/pnp/libexec/process_perfdata.pl -d HOSTPERFDATA
        }
define command{
        command_name    process-service-perfdata
        command_line    /usr/bin/perl /home/nagios/pnp/libexec/process_perfdata.pl
        }
mv /home/nagios/pnp/share/install.php /home/nagios/pnp/share/install.php.`date +%Y%m%d`
process_performance_data=1
host_perfdata_command=process-host-perfdata
service_perfdata_command=process-service-perfdata

第二部分關于nrpe的安裝

#!/bin/bash
#INSTALL NRPE DAEMON#
src=/home/nagios/src
nagios_home=/home/nagios/nagios
yum install openssl openssl-devel
useradd nagios
groupadd nagcmd
usermod -a -G nagcmd nagios
echo "5cr8xOW7DF"|passwd --stdin nagios
su - nagios
mkdir ${src}
cd ${src}
wget http://nagios-plugins.org/download/nagios-plugins-2.0.tar.gz
wget http://jaist.dl.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz
echo "##INSTALL NAGIOS-PLUGINS##"
tar xvf nagios-plugins-2.0.tar.gz
cd nagios-plugins-2.0
./configure --prefix=${nagios_home} --enable-perl-modules
make && make install
cd ${src}
echo "##INSTALL NRPE##"
tar xvf nrpe-2.15.tar.gz
cd nrpe-2.15
#編譯啟用參數傳遞
./configure --prefix=${nagios_home} --with-nrpe-user=nagios --with-nrpe-group=nagios --enable-command-args
make all
make install-plugin
make install-daemon
make install-daemon-config
exit
cd ${src}/nrpe-2.15/
make install-xinetd
sed -i 's/127.0.0.1/192.168.28.241/g' /etc/xinetd.d/nrpe
echo "nrpe            5666/tcp        # NRPE" >>/etc/services
chown nagios. /etc/xinetd.d/nrpe
service xinetd restart
lsof -i:5666

nrpe.cfg配置文件簡單如下

log_facility=daemon
pid_file=/var/run/nrpe.pid
server_port=5666
server_address=127.0.0.1
nrpe_user=nagios
nrpe_group=nagios
allowed_hosts=127.0.0.1
                                                                                                                                     
dont_blame_nrpe=1
allow_bash_command_substitution=0
debug=0
command_timeout=60
connection_timeout=300
command[check_users]=/home/nagios/nagios//libexec/check_users -w $ARG1$ -c $ARG2$
command[check_load]=/home/nagios/nagios//libexec/check_load -w $ARG1$ -c $ARG2$
command[check_disk]=/home/nagios/nagios//libexec/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
command[check_procs]=/home/nagios/nagios//libexec/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$

其中server_address/allow_address注意根據實際修改,dont_blame_nrpe=1(默認為0,1為開啟參數傳遞)

nagios server端command.cfg需另外define一個check_remote_nrpe的command

define command{
        command_name    check_remote_nrpe
        command_line    $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -a $ARG2$ $ARG3$ $ARG4$
        }

這樣監控服務,如客戶端環境改變需調整參數的話只需要在nagios服務端修改參數即可,例如

define service{
        use                     linux-service
        hostgroup_name          97f5eafb7a
        service_description     check partition /
        check_command           check_remote_nrpe!check_disk!20%!10%!/
        }

第三部分,如果以后添加新監控點,則需去修改每臺客戶機的nrpe.cfg文件去define command,這樣太麻煩了。所以再添加這樣一個腳本來傳遞整個命令,客戶端如需添加新監控點只需上傳監控腳本,nagios服務端define service即可

#!/bin/sh
while getopts "a:c:" arg
do
        case $arg in
             a)
                arg_a=$OPTARG;
                ;;
             c)
                arg_c=$OPTARG;
                ;;
             ?)
            echo "unkonw argument"
            echo "only -c -a argument"
            exit 1
            ;;
        esac
done
if [[ "$arg_c" =~ "$HOME/" ]];then
    if [ ! -x $arg_c ];then
        echo "[$arg_c] not execute";
        exit 3;
    fi
                                                   
    $arg_c $arg_a;
    exit $?;
else
    echo "cannt execute $arg_c,not allow execute [$HOME] outside scripts";
    exit 3;
fi

nagios的command文件需添加如下

define command{
        command_name    check_nrpe_exec
        command_line    $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -a $ARG2$
        }

客戶端nrpe.cfg配置文件command部分只需要有

command[exec_command]=/home/nagios/nagios//libexec/exec_command -c exec_command -a "$ARG1$"

添加監控點例子,只需修改exec_command后的監控腳本命令

define service{
        use                     linux-service
        host_name               887a34d257
        service_description     check_swap
        check_command           check_nrpe_exec!"/home/nagios/nagios/libexec/check_swap -w 50% -c 30%"
        }


向AI問一下細節

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

AI

肇州县| 墨玉县| 灌南县| 颍上县| 祁东县| 仁化县| 万源市| 金昌市| 普兰县| 潜江市| 马公市| 揭西县| 阳泉市| 桐梓县| 文安县| 犍为县| 阿瓦提县| 高淳县| 大关县| 海南省| 离岛区| 湖北省| 读书| 公主岭市| 南阳市| 鄂托克前旗| 乐至县| 灵台县| 方山县| 邵东县| 扬州市| 太仆寺旗| 寿光市| 昭通市| 靖西县| 宁南县| 阿瓦提县| 汝南县| 荃湾区| 鄂州市| 玛纳斯县|