Ad Widget

Collapse

Host monitoring via SSH

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Pepe94
    Junior Member
    • Jan 2018
    • 4

    #1

    Host monitoring via SSH

    Hi guys,

    do you have any solution how to monitor hosts in another network via SSH tunnel? I tried it more ways but still unsuccessfully.
    I will be really grateful for every help.

    Best regards
  • Colttt
    Senior Member
    Zabbix Certified Specialist
    • Mar 2009
    • 878

    #2
    Can you tell man what do you want to archieve?

    You can use zabbix proxy, also zabbix support ssh checks
    Debian-User

    Sorry for my bad english

    Comment

    • aigars.kadikis
      Senior Member
      Zabbix Certified SpecialistZabbix Certified Professional
      • Mar 2018
      • 208

      #3
      For SSH monitoring it is recommended you to establish an passwordless connection between zabbix server and remote host. You have to log in into Zabbix server and install SSH key for user zabbix and distribute this key to each host. Here is the steps to implement this scenario:

      Open zabbix_server.conf:
      vi /etc/zabbix/zabbix_server.conf

      Set SSHKeyLocation in zabbix_server.conf as:
      SSHKeyLocation=/home/zabbix/.ssh

      Make directory for SSH keys
      mkdir -p /home/zabbix/.ssh

      Allow zabbix user to own the dir
      chown -R zabbix:zabbix /home/zabbix

      Restart Zabbix server service:
      systemctl restart zabbix-server

      Open /etc/passwd and make sure zabbix home dir has been set to /home/zabbix
      zabbix:x:1001:1001::/home/zabbix:/usr/sbin/nologin

      Generate the SSH key for user zabbix:
      sudo -u zabbix ssh-keygen -t rsa -b 2048
      This will ask for passphrase. You can enter none

      Copy key to remote host:
      sudo -u zabbix ssh-copy-id [email protected] -p 22
      Note that SSH key will be installed only on user in this command ('root' in my example)

      Test connection:
      Move to user zabbix to test the connection
      su -s /bin/bash zabbix

      Test the login:
      ssh -p '22' '[email protected]'
      Note that now the authorization is passwordless

      exit SSH session

      exit user zabbix session

      Now on the frontend you can test a connection with item. This example uses ssh port 4321 and counts the files and directories in home dir with command 'ls -1 ~ | wc -l'

      Comment

      Working...