ƒŠƒ‚[ƒgƒzƒXƒgƒT[ƒrƒXŠÄŽ‹(Nagios+nrpe)

ÅIXV“úF 2017.05.24

<<ƒgƒbƒvƒy[ƒW <<V’…î•ņ <<‹tˆø‚ŦW <<ƒŠƒ“ƒNW <<ƒTƒCƒg“āŒŸõ <<ƒƒ‹ƒ}ƒK <<Scientific Linux‚ÅŽĐ‘îƒT[ƒo[\’z <<Fedora‚ÅŽĐ‘îƒT[ƒo[\’z

ĄŠT—v

Nagios‚ĖƒAƒhƒIƒ“nrpe‚Å‘žƒT[ƒo[‚ĖƒT[ƒrƒX‚ðŠÄŽ‹‚·‚éB

ĶNagios“ą“üÏ‚Å‚ ‚é‚ą‚Æ


ĄnrpeƒCƒ“ƒXƒg[ƒ‹

i‚PjNagiosƒT[ƒo[‘Ī
[root@centos ~]# wget https://downloads.sourceforge.net/project/nagios/nrpe-3.x/nrpe-3.1.0.tar.gz@Đ@nrpeƒ_ƒEƒ“ƒ[ƒh

ĶÅV”Å‚ĖURL‚̓_ƒEƒ“ƒ[ƒhƒy[ƒW‚ÅŠm”F‚·‚é‚ą‚Æ

[root@centos ~]# tar zxvf nrpe-3.1.0.tar.gz@Đ@nrpe“WŠJ

[root@centos ~]# cd nrpe-3.1.0@Đ@nrpe“WŠJæƒfƒBƒŒƒNƒgƒŠ‚ÖˆÚ“Ū

[root@centos nrpe-3.1.0]# ./configure && make check_nrpe && make install-plugin@Đ@nrpeƒvƒ‰ƒOƒCƒ“ƒCƒ“ƒXƒg[ƒ‹

[root@centos nrpe-3.1.0]# cd@Đ@nrpe“WŠJæƒfƒBƒŒƒNƒgƒŠ‚ð”ē‚Ŋ‚é

[root@centos ~]# rm -rf nrpe-3.1.0@Đ@nrpe“WŠJæƒfƒBƒŒƒNƒgƒŠ‚ðíœ

[root@centos ~]# rm -f nrpe-3.1.0.tar.gz@Đ@ƒ_ƒEƒ“ƒ[ƒh‚ĩ‚―ƒtƒ@ƒCƒ‹‚ðíœ

i‚QjŠÄŽ‹‘ΏۃT[ƒo[‘Ī

[root@fedora ~]# yum -y install openssl-devel@Đ@nrpeƒCƒ“ƒXƒg[ƒ‹‚É•K—v‚ČƒpƒbƒP[ƒW‚ðƒCƒ“ƒXƒg[ƒ‹

[root@fedora ~]# useradd -d /usr/local/nagios/ -M nagios@Đ@nagiosƒ†[ƒU[ėŽ

[root@fedora ~]# mkdir /usr/local/nagios@Đ@nrpeƒCƒ“ƒXƒg[ƒ‹æƒfƒBƒŒƒNƒgƒŠėŽ

[root@fedora ~]# chown nagios:nagios /usr/local/nagios/@Đ@nrpeƒCƒ“ƒXƒg[ƒ‹æƒfƒBƒŒƒNƒgƒŠŠ—LŽŌ•ÏX

[root@fedora ~]# git clone https://github.com/NagiosEnterprises/nrpe.git@Đ@nrpeƒ_ƒEƒ“ƒ[ƒh

[root@fedora ~]# cd nrpe/@Đ@nrpeƒ_ƒEƒ“ƒ[ƒhæƒfƒBƒŒƒNƒgƒŠ‚ÖˆÚ“Ū

[root@fedora nrpe]# ./configure && make nrpe && make install-daemon && make install-config && make install-init@Đ@nrpeƒCƒ“ƒXƒg[ƒ‹

[root@fedora nrpe]# cd@Đ@nrpeƒ_ƒEƒ“ƒ[ƒhæƒfƒBƒŒƒNƒgƒŠ‚ð”ē‚Ŋ‚é

[root@fedora ~]# rm -rf nrpe@Đ@nrpeƒ_ƒEƒ“ƒ[ƒhæƒfƒBƒŒƒNƒgƒŠ‚ðíœ

[root@fedora ~]# yum -y install mysql-devel@Đ@mysql-develƒCƒ“ƒXƒg[ƒ‹ĶMySQL‚ĖŠÄŽ‹‚ðs‚Č‚Īę‡‚Ė‚Ý

[root@fedora ~]# wget https://nagios-plugins.org/download/nagios-plugins-2.2.1.tar.gz@Đ@Nagiosƒvƒ‰ƒOƒCƒ“ƒ_ƒEƒ“ƒ[ƒh

ĶÅV”Å‚ĖURL‚̓_ƒEƒ“ƒ[ƒhƒy[ƒW‚ÅŠm”F‚·‚é‚ą‚Æ

[root@fedora ~]# tar zxvf nagios-plugins-2.2.1.tar.gz@Đ@Nagiosƒvƒ‰ƒOƒCƒ““WŠJ

[root@fedora ~]# cd nagios-plugins-2.2.1@Đ@Nagiosƒvƒ‰ƒOƒCƒ““WŠJæƒfƒBƒŒƒNƒgƒŠ‚ÖˆÚ“Ū

[root@fedora nagios-plugins-2.2.1]# ./configure && make && make install@Đ@Nagiosƒvƒ‰ƒOƒCƒ“ƒCƒ“ƒXƒg[ƒ‹

[root@fedora nagios-plugins-2.2.1]# cd@Đ@Nagiosƒvƒ‰ƒOƒCƒ““WŠJæƒfƒBƒŒƒNƒgƒŠ‚ð”ē‚Ŋ‚é

[root@fedora ~]# rm -rf nagios-plugins-2.2.1@Đ@Nagiosƒvƒ‰ƒOƒCƒ““WŠJæƒfƒBƒŒƒNƒgƒŠ‚ðíœ

[root@fedora ~]# rm -f nagios-plugins-2.2.1.tar.gz@Đ@ƒ_ƒEƒ“ƒ[ƒh‚ĩ‚―ƒtƒ@ƒCƒ‹‚ðíœ

ĄnrpeÝ’č

i‚PjNagiosƒT[ƒo[‘Ī
[root@centos ~]# vi /usr/local/nagios/etc/objects/commands.cfg@Đ@commands.cfg•ŌW
ˆČ‰š‚ðÅIs‚Ö’Į‰Á
# 'check_nrpe' command definition
define command{
        command_name    check_nrpe
        command_line    $USER1$/check_nrpe -n -H $HOSTADDRESS$ -c $ARG1$
        }

[root@centos ~]# systemctl restart nagios@Đ@NagiosÄ‹N“ŪĶCentOS7‚Ėę‡
[root@centos ~]# /etc/rc.d/init.d/nagios restart@Đ@NagiosÄ‹N“ŪĶCentOS6‚Ėę‡

i‚QjŠÄŽ‹‘ΏۃT[ƒo[‘Ī
[root@fedora ~]# echo "nrpe 5666/tcp # NRPE" >> /etc/services@Đ@TCP5666‚ðnrpe‚ĖƒT[ƒrƒXƒ|[ƒg‚Æ‚ĩ‚Ä’Į‰Á

[root@fedora ~]# vi /usr/local/nagios/etc/nrpe.cfg@Đ@nrpeÝ’čƒtƒ@ƒCƒ‹•ŌW
allowed_hosts=127.0.0.1,::1,192.168.1.30@Đ@NagiosƒT[ƒo[‚ĖIPƒAƒhƒŒƒX(—á:192.168.1.30)‚ð’Į‰Á

Ąnrpe‹N“Ū

i‚PjŠÄŽ‹‘ΏۃT[ƒo[‘Ī
[root@fedora ~]# vi /usr/lib/systemd/system/nrpe.service@Đ@nrpe‹N“ŪÝ’čƒtƒ@ƒCƒ‹•ŌW
ExecStart=/usr/local/nagios/bin/nrpe -n -c /usr/local/nagios/etc/nrpe.cfg -f@Đ@u-nv‚ð’Į‰Á‚ĩ‚ÄSSL–ģŒø‰ŧ

[root@fedora ~]# systemctl daemon-reload@Đ@nrpe‹N“ŪÝ’čƒtƒ@ƒCƒ‹•ŌW”―‰f

[root@fedora ~]# systemctl start nrpe@Đ@nrpe‹N“Ū

[root@fedora ~]# systemctl enable nrpe@Đ@nrpeŽĐ“Ū‹N“ŪÝ’č



ĄŠÄŽ‹ƒT[ƒrƒX’Į‰Á

—á‚Æ‚ĩ‚ăzƒXƒg–žfedora‚ĖŠÄŽ‹ƒT[ƒrƒX‚ð’Į‰Á‚·‚éB
ĶƒzƒXƒg–žfedora‚ÍŠÄŽ‹ƒzƒXƒg‚Æ‚ĩ‚Ä’Į‰ÁÏ‚Å‚ ‚é‚ą‚Ɓ˓‡ŠÄŽ‹ƒVƒXƒeƒ€\’z(Nagios)‚ĖuĄŠÄŽ‹ƒzƒXƒg’Į‰ÁvŽQÆ

i‚PjCPU•‰‰Ũ
[root@fedora ~]# vi /usr/local/nagios/etc/nrpe.cfg@Đ@nrpe.cfg•ŌWĶŠÄŽ‹‘ΏۃT[ƒo[‘Ī
command[check_load]=/usr/local/nagios/libexec/check_load -w 9.0,7.0,6.0 -c 10.0,8.0,7.0@Đ@ƒ[ƒhƒAƒxƒŒ[ƒW‚Š9.0,7.0,6.0‚ÅŒxA10.0,8.0,7.0‚ňŲí‚Æ‚·‚é

[root@centos ~]# vi /usr/local/nagios/etc/objects/commands.cfg@Đ@commands.cfg•ŌWĶNagiosƒT[ƒo[‘Ī
ˆČ‰š‚ðÅIs‚Ö’Į‰Á
define command{
        command_name    check_remote_load
        command_line    $USER1$/check_nrpe -n -H $HOSTADDRESS$ -c check_load
        }

[root@centos ~]# vi /usr/local/nagios/etc/servers/fedora.cfg@Đ@fedora.cfg•ŌWĶNagiosƒT[ƒo[‘Ī
ˆČ‰š‚ðÅIs‚Ö’Į‰Á
define service{
        use                             generic-service
        host_name                       fedora
        service_description             Current Load
        check_command                   check_remote_load
        }

[root@centos ~]# ln -s /usr/local/pnp4nagios/share/templates.dist/check_load.php /usr/local/pnp4nagios/share/templates.dist/check_remote_load.php@Đ@PNP—pƒeƒ“ƒvƒŒ[ƒgƒŠƒ“ƒNÝ’čĶNagiosƒT[ƒo[‘ĪĶPNP“ą“üÏ‚Ėę‡‚Ė‚Ý

[root@centos ~]# systemctl restart nagios@Đ@NagiosÄ‹N“ŪĶCentOS7‚Ėę‡
[root@centos ~]# /etc/rc.d/init.d/nagios restart@Đ@NagiosÄ‹N“ŪĶCentOS6‚Ėę‡

i‚QjƒfƒBƒXƒN‹ó‚Ŧó‹ĩ
[root@fedora ~]# vi /usr/local/nagios/etc/nrpe.cfg@Đ@nrpe.cfg•ŌWĶŠÄŽ‹‘ΏۃT[ƒo[‘Ī
ˆČ‰š‚ðÅIs‚Ö’Į‰Á
command[check_disk]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /@Đ@/(ƒ‹[ƒg)ƒp[ƒeƒBƒVƒ‡ƒ“‚Ė‹ó‚Ŧ‚Š20%‚ÅŒxA10%‚ňŲí‚Æ‚·‚é

[root@centos ~]# vi /usr/local/nagios/etc/objects/commands.cfg@Đ@commands.cfg•ŌWĶNagiosƒT[ƒo[‘Ī
ˆČ‰š‚ðÅIs‚Ö’Į‰Á
define command{
        command_name    check_remote_disk
        command_line    $USER1$/check_nrpe -n -H $HOSTADDRESS$ -c check_disk
        }

[root@centos ~]# vi /usr/local/nagios/etc/servers/fedora.cfg@Đ@fedora.cfg•ŌWĶNagiosƒT[ƒo[‘Ī
ˆČ‰š‚ðÅIs‚Ö’Į‰Á
define service{
        use                             generic-service
        host_name                       fedora
        service_description             Root Partition
        check_command                   check_remote_disk
        }

[root@centos ~]# ln -s /usr/local/pnp4nagios/share/templates.dist/check_disk.php /usr/local/pnp4nagios/share/templates.dist/check_remote_disk.php@Đ@PNP—pƒeƒ“ƒvƒŒ[ƒgƒŠƒ“ƒNÝ’čĶNagiosƒT[ƒo[‘ĪĶPNP“ą“üÏ‚Ėę‡‚Ė‚Ý

[root@centos ~]# systemctl restart nagios@Đ@NagiosÄ‹N“ŪĶCentOS7‚Ėę‡
[root@centos ~]# /etc/rc.d/init.d/nagios restart@Đ@NagiosÄ‹N“ŪĶCentOS6‚Ėę‡

i‚Rjƒƒ‚ƒŠŽg—pó‹ĩ
Nagiosƒvƒ‰ƒOƒCƒ“‚Ėcheck_mem”z•zƒTƒCƒg‚Ńvƒ‰ƒOƒCƒ“‚ðƒ_ƒEƒ“ƒ[ƒh‚ĩ‚ÄWinSCP‚ÅŠÄŽ‹‘ΏۃT[ƒo[‚ÖƒAƒbƒvƒ[ƒh‚·‚éB
[root@fedora ~]# /bin/mv check_mem /usr/local/nagios/libexec/@Đ@check_memƒvƒ‰ƒOƒCƒ“‚ðŠ’č‚ĖƒfƒBƒŒƒNƒgƒŠ‚ÖˆÚ“ŪĶŠÄŽ‹‘ΏۃT[ƒo[‘Ī

[root@fedora ~]# chmod +x /usr/local/nagios/libexec/check_mem@Đ@check_memƒvƒ‰ƒOƒCƒ“‚ÉŽĀsŒ ŒĀ•t‰ÁĶŠÄŽ‹‘ΏۃT[ƒo[‘Ī

[root@fedora ~]# vi /usr/local/nagios/etc/nrpe.cfg@Đ@nrpe.cfg•ŌWĶŠÄŽ‹‘ΏۃT[ƒo[‘Ī
ˆČ‰š‚ðÅIs‚Ö’Į‰Á
command[check_mem]=/usr/local/nagios/libexec/check_mem -w 80 -c 90 -W 80 -C 90@Đ@•Ļ—ƒƒ‚ƒŠŽg—p—Ķ‚Š80%‚ÅŒxA90%‚ňŲíA‰ž‘zƒƒ‚ƒŠŽg—p—Ķ‚Š80%‚ÅŒxA90%‚ňŲí‚Æ‚·‚é

[root@centos ~]# vi /usr/local/nagios/etc/objects/commands.cfg@Đ@commands.cfg•ŌWĶNagiosƒT[ƒo[‘Ī
ˆČ‰š‚ðÅIs‚Ö’Į‰Á
define command{
        command_name    check_remote_mem
        command_line    $USER1$/check_nrpe -n -H $HOSTADDRESS$ -c check_mem
        }

[root@centos ~]# vi /usr/local/nagios/etc/servers/fedora.cfg@Đ@fedora.cfg•ŌWĶNagiosƒT[ƒo[‘Ī
ˆČ‰š‚ðÅIs‚Ö’Į‰Á
define service{
        use                             generic-service
        host_name                       fedora
        service_description             Memory Usage
        check_command                   check_remote_mem
        }

[root@centos ~]# ln -s /usr/local/pnp4nagios/share/templates.dist/check_mem.php /usr/local/pnp4nagios/share/templates.dist/check_remote_mem.php@Đ@PNP—pƒeƒ“ƒvƒŒ[ƒgƒŠƒ“ƒNÝ’čĶNagiosƒT[ƒo[‘ĪĶPNP“ą“üÏ‚Ėę‡‚Ė‚Ý

[root@centos ~]# systemctl restart nagios@Đ@NagiosÄ‹N“ŪĶCentOS7‚Ėę‡
[root@centos ~]# /etc/rc.d/init.d/nagios restart@Đ@NagiosÄ‹N“ŪĶCentOS6‚Ėę‡

i‚SjƒvƒƒZƒX”
[root@fedora ~]# vi /usr/local/nagios/etc/nrpe.cfg@Đ@nrpe.cfg•ŌWĶŠÄŽ‹‘ΏۃT[ƒo[‘Ī
command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 250 -c 400 -s RSZDT@Đ@ƒvƒƒZƒX”‚Š250‚ÅŒxA400‚ňŲí‚Æ‚·‚é

[root@centos ~]# vi /usr/local/nagios/etc/servers/fedora.cfg@Đ@fedora.cfg•ŌWĶNagiosƒT[ƒo[‘Ī
ˆČ‰š‚ðÅIs‚Ö’Į‰Á
define service{
        use                             generic-service
        host_name                       fedora
        service_description             Total Processes
        check_command                   check_nrpe!check_total_procs
        }

[root@centos ~]# systemctl restart nagios@Đ@NagiosÄ‹N“ŪĶCentOS7‚Ėę‡
[root@centos ~]# /etc/rc.d/init.d/nagios restart@Đ@NagiosÄ‹N“ŪĶCentOS6‚Ėę‡

i‚TjƒƒOƒCƒ“ƒ†[ƒU[”
[root@fedora ~]# vi /usr/local/nagios/etc/nrpe.cfg@Đ@nrpe.cfg•ŌWĶŠÄŽ‹‘ΏۃT[ƒo[‘Ī
command[check_users]=/usr/local/nagios/libexec/check_users -w 3 -c 5@Đ@ƒƒOƒCƒ“ƒ†[ƒU[”‚Š3‚ÅŒxA5‚ňŲí‚Æ‚·‚é

[root@centos ~]# vi /usr/local/nagios/etc/servers/fedora.cfg@Đ@fedora.cfg•ŌWĶNagiosƒT[ƒo[‘Ī
ˆČ‰š‚ðÅIs‚Ö’Į‰Á
define service{
        use                             generic-service
        host_name                       fedora
        service_description             Current Users
        check_command                   check_nrpe!check_users
        }

[root@centos ~]# systemctl restart nagios@Đ@NagiosÄ‹N“ŪĶCentOS7‚Ėę‡
[root@centos ~]# /etc/rc.d/init.d/nagios restart@Đ@NagiosÄ‹N“ŪĶCentOS6‚Ėę‡

i‚UjSSH
[root@fedora ~]# vi /usr/local/nagios/etc/nrpe.cfg@Đ@nrpe.cfg•ŌWĶŠÄŽ‹‘ΏۃT[ƒo[‘Ī
ˆČ‰š‚ðÅIs‚Ö’Į‰Á
command[check_ssh]=/usr/local/nagios/libexec/check_ssh -H 127.0.0.1

[root@centos ~]# vi /usr/local/nagios/etc/servers/fedora.cfg@Đ@fedora.cfg•ŌWĶNagiosƒT[ƒo[‘Ī
ˆČ‰š‚ðÅIs‚Ö’Į‰Á
define service{
        use                             generic-service
        host_name                       fedora
        service_description             SSH
        check_command                   check_nrpe!check_ssh
        }

[root@centos ~]# systemctl restart nagios@Đ@NagiosÄ‹N“ŪĶCentOS7‚Ėę‡
[root@centos ~]# /etc/rc.d/init.d/nagios restart@Đ@NagiosÄ‹N“ŪĶCentOS6‚Ėę‡

i‚VjNTP
[root@fedora ~]# vi /usr/local/nagios/etc/nrpe.cfg@Đ@nrpe.cfg•ŌWĶŠÄŽ‹‘ΏۃT[ƒo[‘Ī
ˆČ‰š‚ðÅIs‚Ö’Į‰Á
command[check_ntp]=/usr/local/nagios/libexec/check_ntp -H ntp.nict.jp -w 1 -c 2@Đ@ntp.nict.jp‚ÆŽžŠÔ‚Š1•b‚ļ‚ę‚Ä‚Ē‚―‚įŒxA2•b‚ļ‚ę‚Ä‚Ē‚―‚įˆŲí‚Æ‚·‚é

[root@centos ~]# vi /usr/local/nagios/etc/servers/fedora.cfg@Đ@fedora.cfg•ŌWĶNagiosƒT[ƒo[‘Ī
ˆČ‰š‚ðÅIs‚Ö’Į‰Á
define service{
        use                             generic-service
        host_name                       fedora
        service_description             NTP
        check_command                   check_nrpe!check_ntp
        }

[root@centos ~]# systemctl restart nagios@Đ@NagiosÄ‹N“ŪĶCentOS7‚Ėę‡
[root@centos ~]# /etc/rc.d/init.d/nagios restart@Đ@NagiosÄ‹N“ŪĶCentOS6‚Ėę‡

i‚WjclamdĶŠÄŽ‹‘ΏۃT[ƒo[‘Ī‚ÉClam AntiVirus“ą“üÏ‚Ėę‡‚Ė‚Ý
[root@fedora ~]# vi /usr/local/nagios/etc/nrpe.cfg@Đ@nrpe.cfg•ŌWĶŠÄŽ‹‘ΏۃT[ƒo[‘Ī
ˆČ‰š‚ðÅIs‚Ö’Į‰Á
command[check_clamd]=/usr/local/nagios/libexec/check_clamd -H /var/run/clamav/clamd.sock@Đ@/var/run/clamav/clamd.sock‚Íclamd.conf‚ĖLocalSocketƒIƒvƒVƒ‡ƒ“‚ÅŽw’č‚ĩ‚―’l

[root@fedora ~]# chmod u+s /usr/local/nagios/libexec/check_clamd@Đ@clamdƒ\ƒPƒbƒgƒtƒ@ƒCƒ‹‚֐ڑą‚Å‚Ŧ‚é‚æ‚Ī‚É‚·‚éĶŠÄŽ‹‘ΏۃT[ƒo[‘Ī

[root@centos ~]# vi /usr/local/nagios/etc/servers/fedora.cfg@Đ@fedora.cfg•ŌWĶNagiosƒT[ƒo[‘Ī
ˆČ‰š‚ðÅIs‚Ö’Į‰Á
define service{
        use                             generic-service
        host_name                       fedora
        service_description             clamd
        check_command                   check_nrpe!check_clamd
        }

[root@centos ~]# systemctl restart nagios@Đ@NagiosÄ‹N“ŪĶCentOS7‚Ėę‡
[root@centos ~]# /etc/rc.d/init.d/nagios restart@Đ@NagiosÄ‹N“ŪĶCentOS6‚Ėę‡

i‚XjDNSĶŠÄŽ‹‘ΏۃT[ƒo[‘Ī‚ÉBIND“ą“üÏ‚Ėę‡‚Ė‚Ý
[root@fedora ~]# vi /usr/local/nagios/etc/nrpe.cfg@Đ@nrpe.cfg•ŌWĶŠÄŽ‹‘ΏۃT[ƒo[‘Ī
ˆČ‰š‚ðÅIs‚Ö’Į‰Á
command[check_dig]=/usr/local/nagios/libexec/check_dig -H 127.0.0.1 -l fedorasrv.com@Đ@–ž‘O‰ðŒˆƒzƒXƒg–ž‚ÉŠÄŽ‹‘ΏۃT[ƒo[‚ĖƒhƒƒCƒ“–ž‚ðŽw’č

[root@centos ~]# vi /usr/local/nagios/etc/servers/fedora.cfg@Đ@fedora.cfg•ŌWĶNagiosƒT[ƒo[‘Ī
ˆČ‰š‚ðÅIs‚Ö’Į‰Á
define service{
        use                             generic-service
        host_name                       fedora
        service_description             DNS
        check_command                   check_nrpe!check_dig
        }

[root@centos ~]# systemctl restart nagios@Đ@NagiosÄ‹N“ŪĶCentOS7‚Ėę‡
[root@centos ~]# /etc/rc.d/init.d/nagios restart@Đ@NagiosÄ‹N“ŪĶCentOS6‚Ėę‡

i‚P‚OjHTTPĶŠÄŽ‹‘ΏۃT[ƒo[‘Ī‚ÉApache“ą“üÏ‚Ėę‡‚Ė‚Ý
[root@fedora ~]# vi /usr/local/nagios/etc/nrpe.cfg@Đ@nrpe.cfg•ŌWĶŠÄŽ‹‘ΏۃT[ƒo[‘Ī
ˆČ‰š‚ðÅIs‚Ö’Į‰Á
command[check_http]=/usr/local/nagios/libexec/check_http -H 127.0.0.1

[root@centos ~]# vi /usr/local/nagios/etc/objects/commands.cfg@Đ@commands.cfg•ŌWĶNagiosƒT[ƒo[‘Ī
ˆČ‰š‚ðÅIs‚Ö’Į‰Á
define command{
        command_name    check_remote_http
        command_line    $USER1$/check_nrpe -n -H $HOSTADDRESS$ -c check_http
        }

[root@centos ~]# vi /usr/local/nagios/etc/servers/fedora.cfg@Đ@fedora.cfg•ŌWĶNagiosƒT[ƒo[‘Ī
ˆČ‰š‚ðÅIs‚Ö’Į‰Á
define service{
        use                             generic-service
        host_name                       fedora
        service_description             HTTP
        check_command                   check_remote_http
        }

[root@centos ~]# ln -s /usr/local/pnp4nagios/share/templates.dist/check_http.php /usr/local/pnp4nagios/share/templates.dist/check_remote_http.php@Đ@PNP—pƒeƒ“ƒvƒŒ[ƒgƒŠƒ“ƒNÝ’čĶNagiosƒT[ƒo[‘ĪĶPNP“ą“üÏ‚Ėę‡‚Ė‚Ý

[root@centos ~]# systemctl restart nagios@Đ@NagiosÄ‹N“ŪĶCentOS7‚Ėę‡
[root@centos ~]# /etc/rc.d/init.d/nagios restart@Đ@NagiosÄ‹N“ŪĶCentOS6‚Ėę‡

i‚P‚PjSMTPĶŠÄŽ‹‘ΏۃT[ƒo[‘Ī‚Ƀ[ƒ‹ƒT[ƒo[“ą“üÏ‚Ėę‡‚Ė‚Ý
[root@fedora ~]# vi /usr/local/nagios/etc/nrpe.cfg@Đ@nrpe.cfg•ŌWĶŠÄŽ‹‘ΏۃT[ƒo[‘Ī
ˆČ‰š‚ðÅIs‚Ö’Į‰Á
command[check_smtp]=/usr/local/nagios/libexec/check_smtp -H 127.0.0.1

[root@centos ~]# vi /usr/local/nagios/etc/objects/commands.cfg@Đ@commands.cfg•ŌWĶNagiosƒT[ƒo[‘Ī
ˆČ‰š‚ðÅIs‚Ö’Į‰Á
define command{
        command_name    check_remote_smtp
        command_line    $USER1$/check_nrpe -n -H $HOSTADDRESS$ -c check_smtp
        }

[root@centos ~]# vi /usr/local/nagios/etc/servers/fedora.cfg@Đ@fedora.cfg•ŌWĶNagiosƒT[ƒo[‘Ī
ˆČ‰š‚ðÅIs‚Ö’Į‰Á
define service{
        use                             generic-service
        host_name                       fedora
        service_description             SMTP
        check_command                   check_nrpe!check_smtp
        }

[root@centos ~]# ln -s /usr/local/pnp4nagios/share/templates.dist/check_smtp.php /usr/local/pnp4nagios/share/templates.dist/check_remote_smtp.php@Đ@PNP—pƒeƒ“ƒvƒŒ[ƒgƒŠƒ“ƒNÝ’čĶNagiosƒT[ƒo[‘ĪĶPNP“ą“üÏ‚Ėę‡‚Ė‚Ý

[root@centos ~]# systemctl restart nagios@Đ@NagiosÄ‹N“ŪĶCentOS7‚Ėę‡
[root@centos ~]# /etc/rc.d/init.d/nagios restart@Đ@NagiosÄ‹N“ŪĶCentOS6‚Ėę‡

i‚P‚QjPOPĶŠÄŽ‹‘ΏۃT[ƒo[‘Ī‚Ƀ[ƒ‹ƒT[ƒo[“ą“üÏ‚Ėę‡‚Ė‚Ý
[root@fedora ~]# vi /usr/local/nagios/etc/nrpe.cfg@Đ@nrpe.cfg•ŌWĶŠÄŽ‹‘ΏۃT[ƒo[‘Ī
ˆČ‰š‚ðÅIs‚Ö’Į‰Á
command[check_pop]=/usr/local/nagios/libexec/check_pop -H 127.0.0.1

[root@centos ~]# vi /usr/local/nagios/etc/servers/fedora.cfg@Đ@fedora.cfg•ŌWĶNagiosƒT[ƒo[‘Ī
ˆČ‰š‚ðÅIs‚Ö’Į‰Á
define service{
        use                             generic-service
        host_name                       fedora
        service_description             POP
        check_command                   check_nrpe!check_pop
        }

[root@centos ~]# systemctl restart nagios@Đ@NagiosÄ‹N“ŪĶCentOS7‚Ėę‡
[root@centos ~]# /etc/rc.d/init.d/nagios restart@Đ@NagiosÄ‹N“ŪĶCentOS6‚Ėę‡

i‚P‚RjIMAPĶŠÄŽ‹‘ΏۃT[ƒo[‘Ī‚Ƀ[ƒ‹ƒT[ƒo[“ą“üÏ‚Ėę‡‚Ė‚Ý
[root@fedora ~]# vi /usr/local/nagios/etc/nrpe.cfg@Đ@nrpe.cfg•ŌWĶŠÄŽ‹‘ΏۃT[ƒo[‘Ī
ˆČ‰š‚ðÅIs‚Ö’Į‰Á
command[check_imap]=/usr/local/nagios/libexec/check_imap -H 127.0.0.1 -p 143

[root@centos ~]# vi /usr/local/nagios/etc/servers/fedora.cfg@Đ@fedora.cfg•ŌWĶNagiosƒT[ƒo[‘Ī
ˆČ‰š‚ðÅIs‚Ö’Į‰Á
define service{
        use                             generic-service
        host_name                       fedora
        service_description             IMAP
        check_command                   check_nrpe!check_imap
        }

[root@centos ~]# systemctl restart nagios@Đ@NagiosÄ‹N“ŪĶCentOS7‚Ėę‡
[root@centos ~]# /etc/rc.d/init.d/nagios restart@Đ@NagiosÄ‹N“ŪĶCentOS6‚Ėę‡

i‚P‚SjamavisdĶŠÄŽ‹‘ΏۃT[ƒo[‘Ī‚Éamavisd“ą“üÏ‚Ėę‡‚Ė‚Ý
[root@fedora ~]# vi /usr/local/nagios/etc/nrpe.cfg@Đ@nrpe.cfg•ŌWĶŠÄŽ‹‘ΏۃT[ƒo[‘Ī
ˆČ‰š‚ðÅIs‚Ö’Į‰Á
command[check_amavisd]=/usr/local/nagios/libexec/check_tcp -H 127.0.0.1 -p 10024

[root@centos ~]# vi /usr/local/nagios/etc/servers/fedora.cfg@Đ@fedora.cfg•ŌWĶNagiosƒT[ƒo[‘Ī
ˆČ‰š‚ðÅIs‚Ö’Į‰Á
define service{
        use                             generic-service
        host_name                       fedora
        service_description             amavisd
        check_command                   check_nrpe!check_amavisd
        }

[root@centos ~]# systemctl restart nagios@Đ@NagiosÄ‹N“ŪĶCentOS7‚Ėę‡
[root@centos ~]# /etc/rc.d/init.d/nagios restart@Đ@NagiosÄ‹N“ŪĶCentOS6‚Ėę‡

i‚P‚TjspamdĶŠÄŽ‹‘ΏۃT[ƒo[‘Ī‚ÉSpamAssassin“ą“üÏ‚Ėę‡‚Ė‚Ý
[root@fedora ~]# vi /usr/local/nagios/etc/nrpe.cfg@Đ@nrpe.cfg•ŌWĶŠÄŽ‹‘ΏۃT[ƒo[‘Ī
ˆČ‰š‚ðÅIs‚Ö’Į‰Á
command[check_spamd]=/usr/local/nagios/libexec/check_tcp -H 127.0.0.1 -p 783

[root@centos ~]# vi /usr/local/nagios/etc/servers/fedora.cfg@Đ@fedora.cfg•ŌWĶNagiosƒT[ƒo[‘Ī
ˆČ‰š‚ðÅIs‚Ö’Į‰Á
define service{
        use                             generic-service
        host_name                       fedora
        service_description             spamd
        check_command                   check_nrpe!check_spamd
        }

[root@centos ~]# systemctl restart nagios@Đ@NagiosÄ‹N“ŪĶCentOS7‚Ėę‡
[root@centos ~]# /etc/rc.d/init.d/nagios restart@Đ@NagiosÄ‹N“ŪĶCentOS6‚Ėę‡

i‚P‚UjSambaĶŠÄŽ‹‘ΏۃT[ƒo[‘Ī‚ÉSamba“ą“üÏ‚Ėę‡‚Ė‚Ý
[root@fedora ~]# yum -y install samba-client@Đ@samba-clientƒCƒ“ƒXƒg[ƒ‹

[root@fedora ~]# vi /usr/local/nagios/libexec/check_disk_smb@Đ@check_disk_smbƒvƒ‰ƒOƒCƒ“•ŌW
my $smbclient= "/usr/bin/smbclient" ;@Đ@smbclientƒRƒ}ƒ“ƒhƒpƒXÝ’č

[root@fedora ~]# echo SambaƒT[ƒo[IPƒAƒhƒŒƒXĶ SambaƒT[ƒo[ƒzƒXƒg–ž >> /etc/samba/lmhosts
@Đ@lmhosts‚ÖSambaƒT[ƒo[‚ĖIPƒAƒhƒŒƒX^ƒzƒXƒg–ž‚ð’Į‰Á‚·‚é
ĶSambaƒT[ƒo[IPƒAƒhƒŒƒX‚Ƀ‹[ƒvƒoƒbƒNƒAƒhƒŒƒX(127.0.0.1)‚ÍŽw’č‚Å‚Ŧ‚Č‚Ē

[root@fedora ~]# vi /usr/local/nagios/etc/nrpe.cfg@Đ@nrpe.cfg•ŌWĶŠÄŽ‹‘ΏۃT[ƒo[‘Ī
ˆČ‰š‚ðÅIs‚Ö’Į‰Á
command[check_samba]=/usr/local/nagios/libexec/check_disk_smb -H SambaƒT[ƒo[ƒzƒXƒg–ž -s Samba‹Ī—L–ž -W Sambaƒ[ƒNƒOƒ‹[ƒv–ž -u Sambaƒ†[ƒU[–ž -p Sambaƒ†[ƒU[ƒpƒXƒ[ƒh

[root@centos ~]# vi /usr/local/nagios/etc/objects/commands.cfg@Đ@commands.cfg•ŌWĶNagiosƒT[ƒo[‘Ī
ˆČ‰š‚ðÅIs‚Ö’Į‰Á
define command{
        command_name    check_remote_samba
        command_line    $USER1$/check_nrpe -n -H $HOSTADDRESS$ -c check_samba
        }

[root@centos ~]# vi /usr/local/nagios/etc/servers/fedora.cfg@Đ@fedora.cfg•ŌWĶNagiosƒT[ƒo[‘Ī
ˆČ‰š‚ðÅIs‚Ö’Į‰Á
define service{
        use                             generic-service
        host_name                       fedora
        service_description             Samba
        check_command                   check_nrpe!check_samba
        }

[root@centos ~]# ln -s /usr/local/pnp4nagios/share/templates.dist/check_samba.php /usr/local/pnp4nagios/share/templates.dist/check_remote_samba.php@Đ@PNP—pƒeƒ“ƒvƒŒ[ƒgƒŠƒ“ƒNÝ’čĶNagiosƒT[ƒo[‘ĪĶPNP“ą“üÏ‚Ėę‡‚Ė‚Ý

[root@centos ~]# systemctl restart nagios@Đ@NagiosÄ‹N“ŪĶCentOS7‚Ėę‡
[root@centos ~]# /etc/rc.d/init.d/nagios restart@Đ@NagiosÄ‹N“ŪĶCentOS6‚Ėę‡

i‚P‚VjMySQLĶŠÄŽ‹‘ΏۃT[ƒo[‘Ī‚ÉMySQL“ą“üÏ‚Ėę‡‚Ė‚Ý
[root@fedora ~]# vi /usr/local/nagios/etc/nrpe.cfg@Đ@nrpe.cfg•ŌWĶŠÄŽ‹‘ΏۃT[ƒo[‘Ī
ˆČ‰š‚ðÅIs‚Ö’Į‰Á
command[check_mysql]=/usr/local/nagios/libexec/check_mysql -H 127.0.0.1 -u root -p MySQL‚Ėrootƒ†[ƒU[ƒpƒXƒ[ƒh

[root@centos ~]# vi /usr/local/nagios/etc/servers/fedora.cfg@Đ@fedora.cfg•ŌWĶNagiosƒT[ƒo[‘Ī
ˆČ‰š‚ðÅIs‚Ö’Į‰Á
define service{
        use                             generic-service
        host_name                       fedora
        service_description             MySQL
        check_command                   check_nrpe!check_mysql
        }

[root@centos ~]# systemctl restart nagios@Đ@NagiosÄ‹N“ŪĶCentOS7‚Ėę‡
[root@centos ~]# /etc/rc.d/init.d/nagios restart@Đ@NagiosÄ‹N“ŪĶCentOS6‚Ėę‡

ĄŠÄŽ‹ƒT[ƒrƒX’Į‰ÁŠm”F

http://ƒT[ƒo[–ž/nagios/‚ÖƒAƒNƒZƒX‚ĩAuƒT[ƒrƒX‰Ō“Ūó‘ԁv‚Å’Į‰Á‚ĩ‚―ƒT[ƒrƒX‚Š•\ŽĶ‚ģ‚ę‚é‚ą‚Æ‚ðŠm”FB






Ģ‚ą‚Ėƒy[ƒW‚Ėƒgƒbƒv‚Ö–ß‚é

LPIƒƒS Copyright© 2005-2017 fallenangels, All rights reserved.
‚ēŽĐ—R‚ɃŠƒ“ƒN‚ĩ‚Ä‚­‚ū‚ģ‚Ē(˜A—‚Í•s—v‚Å‚·)
–{ƒy[ƒW‚Ö‚Ė‚ēˆÓŒĐE‚ē—v–]AŒëŽšE’EŽšEƒŠƒ“ƒNØ‚ę“™‚Ė‚ē˜A—‚Í‚ą‚ŋ‚į‚Đ‚į‚ĻŠč‚Ē‚ĩ‚Ü‚·