Nagios/nrpe 모니터링을 사용하며, nrpe 클라이언트에서 위와 같은 에러가 발생시에 대응 방법을 찾아보면
https://support.nagios.com/kb/article/nrpe-v3-v4-compatibility-with-previous-versions-516.html
NRPE - v3/v4 Compatibility With Previous Versions
Home » Categories » Multiple Categories NRPE - v3/v4 Compatibility With Previous Versions Article Number: 516 | Rating: 2.5/5 from 4 votes | Last Updated by rspielman on Tue, Nov 16, 2021 at 1:58 PM Overview This KB article discusses NRPE v3/v4 and it's
support.nagios.com
위 공식홈페이지에 설명이 되어있는데, 내용을보면 Nagios메인버젼의 nrpe_Plugin 버젼은 높고 nrpe의 버젼이 낮을 경우에만 설명이 되어있다.
ex) check_nrpe -2 -H {hostip} (2버젼 통신), check_nrpe -3 -H {hostip} (3버젼 통신)
내부적으로 os업데이트작업을 진행중인데, 이와 반대로 nrpe 버젼이높고 nagios 메인서버의 nrpe_plugin버젼이 낮을때 경우가 발생하여 해결 방법을 간단히 적어보려고한다.
nagios_nrpe_plugin version : 3.2.0
nrpe_version : 4.1.0
기존의 모니터링 대상은 check_nrpe 명령어를 통해 모니터링을 하기에 최대한 건드리지 않고 작업을 진행했다.
작업절차 :
1. nagios_nrpe_plugin 4버젼 컴파일설치
2. 설치완료된 파일 커맨드 세팅
3. 재기동
1. nagios_nrpe_plugin 4버젼 컴파일 설치
wget --no-check-certificate -O nrpe.tar.gz https://github.com/NagiosEnterprises/nrpe/archive/nrpe-4.1.0.tar.gz
tar xvzf nrpe.tar.gz
cd nrpe-nrpe-4.1.0
./configure --disable-ssl --enable-command-args
make check_nrpe
make 까지 완료되면 /root/nrpe-nrpe-4.1.0/src 디렉토리내에 check_nrpe 바이너리파일이 생성된다.
2. 설치 완료된 파일 커맨드 세팅
커맨드경로에 맞춰서 해당 파일을 옮겨주고 이름도 변경해준다.
mv /root/nrpe-nrpe-4.1.0/src/check_nrpe /usr/lib64/nagios/plugins/check_nrpe4
옮겨준뒤 command.cfg에 check_nrpe4를 생성해준다.
vi $nagios_home_path/etc/object/command.cfg
define command {
command_name check_nrpe4
command_line /usr/lib64/nagios/plugins/check_nrpe4 -H $HOSTADDRESS$ -c $ARG1$
}
위와 같이 check_nrpe4를 선언해준뒤 해당 클라이언트 파일의 명령어를 변경해준다.
]#vi $nagios_home_path/etc/object/client.cfg
define service{
use local-service
host_name test
check_command check_nrpe!check_disk1 # check_nrpe => check_nrpe4 변경
notifications_enabled 1
}
3. 재기동
service nagios restart
재기동 후 클라이언트 로그에 에러 로그가 안찍힌다면 정상 설정 완료
###추가 내용
단순히 nagios서버에서만 설정을 할 경우 아래와 같은 에러가 발생할수있다.
Error: (!log_opts) Could not complete SSL handshake with $HOSTIP: 1
클라이언트에서 위와 같은 에러가 발생할수있는데, 이는 nagios서버에서는 disable ssl을 진행했으나, 클라이언트 사이드에서 ssl인증을 진행하여 발생하는 에러다. 아래와 같이 작업하여 nagios와 동일하게 nrpe도 disable-ssl을 진행해주자.
vi /etc/sysconfig/nrpe
NRPE_SSL_OPT="-n"
#-n 추가
위와 같이 -n옵션 추가후 nrpe 재기동시 정상적으로 통신되는걸 볼수있다.