Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
root@myserver:/root# su - nagios
nagios@myserver:~$ ssh-keygen -t rsa -b 1024
Generating public/private rsa key pair.
Enter file in which to save the key (/home/nagios/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/nagios/.ssh/id_rsa.
Your public key has been saved in /home/nagios/.ssh/id_rsa.pub.
The key fingerprint is:
4a:02:d5:40:....:b9:26:46 nagios@myserver
The key's randomart image is:
+--[ RSA 1024]----+
|ooo++o           |
...
|=+.              |
+-----------------+

nagios@myserver:~$ Den Inhalt der Datei .ssh/id_rsa.pub --- kopieren -----> Zielserver, Zielaccount --> $HOME/.ssh/authorized_keys
!!!!!!!!!!!!!!!!!!!
Mindestens 1x manuell anmelden um den Fingerabdruck zu bestätigen.
!!!!!!!!!!!!!!!!!!!
nagios@myserver:~$ ssh Zielaccount@Zielserver

The authenticity of host '[Zielserver]:22 ([IP-Adresse]:22)' can't be established.
ECDSA key fingerprint is 80:70:62:14:1a:.....:63:54:1a:27:97.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[Zielserver]:22,[IP-Adresse]:22' (ECDSA) to the list of known hosts.
Welcome to Ubuntu 12.04.5 LTS (GNU/Linux 2.6.32-042stab120.6 i686)

 * Documentation:  https://help.ubuntu.com/

Last login: Sun Jan  1 14:03:57 2017 from MYSERVER

Zielaccount@Zielserver:~# logout

Connection to Zielserver closed.

nagios@myserver:~$ logout

Nun noch den Service konfigurieren

Code Block
title/usr/local/nagios/etc/objects/commands.cfg
# 'check_by_ssh' command definition
define command{
        command_name    check_by_ssh
        command_line    $USER1$/check_by_ssh -H $HOSTADDRESS$ -p $ARG1$ -l $ARG2$ $ARG3$
        } 

und für den Server

Code Block
title/usr/local/nagios/etc/objects/bpi.cfg
 define service{
        use                             local-service         ; Name of service template to use
        host_name                       bpi
        service_description             Confluence-Service
        check_command                   check_by_ssh!22!Zielaccount!/etc/init.d/wiki status
        notifications_enabled           0
        }