19/09/2012
Installazione agente Nagios nrpe tramite yum
Partiamo dal presupposto che Nagios è:
- figo
- utile
- indispensabile
- funzionale
L’accoppiata Nagios + nrpe poi diventa una vera manna dal cielo in tutte quelle occasioni dove per problemi di rete o per esigenze particolari un check passivo non è possibile o quantomeno non è così utile.
L’installazione del package nagios-nrpe è relativamente semplice, occorre soltanto soddisfare qualche dipendenza, se però occorre configurare diverse macchine diventa molto utile poterlo fare tramite yum.
Per far questo viene in aiuto il sempreverde respository di RPMForge, installando gli rpm disponibili alla pagina di download, scaricate l’rpm relativo alla vostra distribuzione RedHat based (cat /etc/redhat-release) e architettura (uname -a) e installatelo usando il comando rpm -ivh, es:
[root@drakaris ~]# rpm -ivh rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm Preparazione in corso... ######################## [100%] 1:rpmforge-release ######################## [100%]
Una volta fatto questo potete cercare il package corretto tramite il comando yum search:
[root@drakaris yum.repos.d]# yum search nagios-nrpe Loaded plugins: katello, product-id, security, subscription-manager Updating certificate-based repositories. Unable to read consumer identity rpmforge | 1.9 kB 00:00 rpmforge/primary_db | 6.9 MB 00:01 === Matched: nagios-nrpe === nagios-nrpe.x86_64 : Nagios Remote Plug-ins Execution daemon
A questo punto lanciate il comando yum per installare il package:
[root@drakaris yum.repos.d]# yum install nagios-nrpe Loaded plugins: katello, product-id, security, subscription-manager Updating certificate-based repositories. Unable to read consumer identity rpmforge | 1.9 kB 00:00 rpmforge/primary_db | 6.9 MB 00:01 Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package nagios-nrpe.x86_64 0:2.12-1.el5.rf set to be updated --> Processing Dependency: nagios-plugins for package: nagios-nrpe --> Running transaction check ---> Package nagios-plugins.x86_64 0:1.4.16-1.el5.rf set to be updated --> Processing Dependency: fping for package: nagios-plugins --> Processing Dependency: perl(Net::SNMP) for package: nagios-plugins --> Running transaction check ---> Package fping.x86_64 0:3.3-1.el5.rf set to be updated ---> Package perl-Net-SNMP.noarch 0:5.2.0-1.2.el5.rf set to be updated --> Processing Dependency: perl(Socket6) >= 0.19 for package: perl-Net-SNMP --> Processing Dependency: perl(Digest::HMAC) for package: perl-Net-SNMP --> Processing Dependency: perl(Crypt::DES) for package: perl-Net-SNMP --> Processing Dependency: perl(Digest::SHA1) for package: perl-Net-SNMP --> Running transaction check ---> Package perl-Crypt-DES.x86_64 0:2.05-3.2.el5.rf set to be updated ---> Package perl-Net-SNMP.noarch 0:5.2.0-1.2.el5.rf set to be updated --> Processing Dependency: perl(Socket6) >= 0.19 for package: perl-Net-SNMP --> Processing Dependency: perl(Digest::HMAC) for package: perl-Net-SNMP --> Processing Dependency: perl(Digest::SHA1) for package: perl-Net-SNMP --> Finished Dependency Resolution perl-Net-SNMP-5.2.0-1.2.el5.rf.noarch from rpmforge has depsolving problems --> Missing Dependency: perl(Socket6) >= 0.19 is needed by package perl-Net-SNMP-5.2.0-1.2.el5.rf.noarch (rpmforge) perl-Net-SNMP-5.2.0-1.2.el5.rf.noarch from rpmforge has depsolving problems --> Missing Dependency: perl(Digest::HMAC) is needed by package perl-Net-SNMP-5.2.0-1.2.el5.rf.noarch (rpmforge) perl-Net-SNMP-5.2.0-1.2.el5.rf.noarch from rpmforge has depsolving problems --> Missing Dependency: perl(Digest::SHA1) is needed by package perl-Net-SNMP-5.2.0-1.2.el5.rf.noarch (rpmforge) Error: Missing Dependency: perl(Socket6) >= 0.19 is needed by package perl-Net-SNMP-5.2.0-1.2.el5.rf.noarch (rpmforge) Error: Missing Dependency: perl(Digest::SHA1) is needed by package perl-Net-SNMP-5.2.0-1.2.el5.rf.noarch (rpmforge) Error: Missing Dependency: perl(Digest::HMAC) is needed by package perl-Net-SNMP-5.2.0-1.2.el5.rf.noarch (rpmforge) You could try using --skip-broken to work around the problem You could try running: package-cleanup --problems package-cleanup --dupes rpm -Va --nofiles --nodigest
Ahi ahi pare ci siano problemi con le dipendenze, i package perl-Digest-HMAC, perl-Digest-SHA1 e perl-Socket6 sono richiesti per l’installazione di nagios-nrpe.
In condizioni ideali (ovvero server in grado di raggiungere i repository pubblici di yum o registrato su RedHat Network con subscription attiva) il problema non si porrebbe, yum andrebbe a recuperare gli rpm necessari e soddisferebbe le dipendenze.
Se invece il vostro server non è in grado di scaricare i package rpm in automatico potete sempre utilizzare la iso del dvd di installazione come repository per yum.
Copiate la iso in locale o montate una risorsa di rete che la contenga (nell’esempio si trova in /mnt/nfs/rhel-server-5.8-x86_64-dvd.iso) e montate la iso con il comando:
[root@infraced239 ~]# mount -t iso9660 -o loop /mnt/nfs/rhel-server-5.8-x86_64-dvd.iso /mnt/iso
Ora create un nuovo file in /etc/yum.repos.d (es /etc/yum.repos.d/dvd.repo) contenente la seguente sintassi (il parametro baseurl deve corrispondere al percorso degli rpm presenti nella iso che avete montato in precedenza):
[rhel-cd] name=Red Hat Enterprise Linux $releasever - $basearch - CD baseurl=file:///mnt/iso/Server/ enabled=1 gpgcheck=0
A questo punto ripetete il comando yum install nagios-nrpe:
[root@drakaris yum.repos.d]# yum install nagios-nrpe Loaded plugins: katello, product-id, security, subscription-manager Updating certificate-based repositories. Unable to read consumer identity Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package nagios-nrpe.x86_64 0:2.12-1.el5.rf set to be updated --> Processing Dependency: nagios-plugins for package: nagios-nrpe --> Running transaction check ---> Package nagios-plugins.x86_64 0:1.4.16-1.el5.rf set to be updated --> Processing Dependency: fping for package: nagios-plugins --> Processing Dependency: perl(Net::SNMP) for package: nagios-plugins --> Running transaction check ---> Package fping.x86_64 0:3.3-1.el5.rf set to be updated ---> Package perl-Net-SNMP.noarch 0:5.2.0-1.2.el5.rf set to be updated --> Processing Dependency: perl(Socket6) >= 0.19 for package: perl-Net-SNMP --> Processing Dependency: perl(Digest::HMAC) for package: perl-Net-SNMP --> Processing Dependency: perl(Crypt::DES) for package: perl-Net-SNMP --> Processing Dependency: perl(Digest::SHA1) for package: perl-Net-SNMP --> Running transaction check ---> Package perl-Crypt-DES.x86_64 0:2.05-3.2.el5.rf set to be updated ---> Package perl-Digest-HMAC.noarch 0:1.01-15 set to be updated ---> Package perl-Digest-SHA1.x86_64 0:2.11-1.2.1 set to be updated ---> Package perl-Socket6.x86_64 0:0.19-3.fc6 set to be updated --> Finished Dependency Resolution
Dependencies Resolved
============================================================================================================================== Package Arch Version Repository Size ============================================================================================================================== Installing: nagios-nrpe x86_64 2.12-1.el5.rf rpmforge 35 k Installing for dependencies: fping x86_64 3.3-1.el5.rf rpmforge 62 k nagios-plugins x86_64 1.4.16-1.el5.rf rpmforge 1.9 M perl-Crypt-DES x86_64 2.05-3.2.el5.rf rpmforge 37 k perl-Digest-HMAC noarch 1.01-15 rhel-cd 12 k perl-Digest-SHA1 x86_64 2.11-1.2.1 rhel-cd 49 k perl-Net-SNMP noarch 5.2.0-1.2.el5.rf rpmforge 96 k perl-Socket6 x86_64 0.19-3.fc6 rhel-cd 21 k
Transaction Summary ============================================================================================================================== Install 8 Package(s) Upgrade 0 Package(s)
Total download size: 2.2 M Is this ok [y/N]: y Downloading Packages: (1/8): nagios-nrpe-2.12-1.el5.rf.x86_64.rpm | 35 kB 00:00 (2/8): perl-Crypt-DES-2.05-3.2.el5.rf.x86_64.rpm | 37 kB 00:00 (3/8): fping-3.3-1.el5.rf.x86_64.rpm | 62 kB 00:00 (4/8): perl-Net-SNMP-5.2.0-1.2.el5.rf.noarch.rpm | 96 kB 00:00 (5/8): nagios-plugins-1.4.16-1.el5.rf.x86_64.rpm | 1.9 MB 00:00 ------------------------------------------------------------------------------------------------------------------------------ Total 1.5 MB/s | 2.2 MB 00:01 Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Installing : perl-Digest-SHA1 1/8 Installing : perl-Socket6 2/8 Installing : fping 3/8 Installing : perl-Crypt-DES 4/8 Installing : perl-Digest-HMAC 5/8 Installing : perl-Net-SNMP 6/8 Installing : nagios-plugins 7/8 Installing : nagios-nrpe 8/8 rhel-cd/productid | 1.7 kB 00:00 Installed products updated.
Installed: nagios-nrpe.x86_64 0:2.12-1.el5.rf
Dependency Installed: fping.x86_64 0:3.3-1.el5.rf nagios-plugins.x86_64 0:1.4.16-1.el5.rf perl-Crypt-DES.x86_64 0:2.05-3.2.el5.rf perl-Digest-HMAC.noarch 0:1.01-15 perl-Digest-SHA1.x86_64 0:2.11-1.2.1 perl-Net-SNMP.noarch 0:5.2.0-1.2.el5.rf perl-Socket6.x86_64 0:0.19-3.fc6
Complete!
GOTCHA!