I assumed that I followed this tutorial : Linux SSH | Centreon Documentation
- created a ro_ssh_centreon on the hosts that I whant to monitor
- used the centreon-engine user on centreon server
- created the ssh key and then copy the key to the host that I whant to monitor and then get a ssh connexion to , but needed the ro_ssh_centreon user password
So , now I’m not sure if it’s working or not when I try using os-linux-ssh-connection-custom .
From centreon with the perl script:
[centreon-engine@XXXXXXXX ~]$ /usr/lib/centreon/plugins//centreon_linux_ssh.pl --plugin=os::linux::local::plugin --mode=connections --hostname='XX.XXX.X.X' --ssh-backend='libssh' --ssh-username='ro_ssh_centreon' --ssh-port='22' --ssh-priv-key=/var/lib/centreon-engine/.ssh/id_ed25519 --warning='' --critical=''
OK: Total connections: 4 | 'total'=4;;;0; 'con_established'=4;;;0; 'con_synSent'=0;;;0; 'con_synReceived'=0;;;0; 'con_closed'=0;;;0; 'con_timeWait'=0;;;0; 'con_listen'=12;;;0; 'con_finWait2'=0;;;0; 'con_finWait1'=0;;;0; 'con_closing'=0;;;0; 'con_closeWait'=0;;;0; 'con_lastAck'=0;;;0;
From the Host (ssh service):
root@XXXXXXXXX ~ systemctl status sshd
● ssh.service - OpenBSD Secure Shell server
Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2023-05-09 17:00:47 CEST; 1 weeks 6 days ago
Docs: man:sshd(8)
man:sshd_config(5)
Process: 489 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
Process: 457672 ExecReload=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
Process: 457673 ExecReload=/bin/kill -HUP $MAINPID (code=exited, status=0/SUCCESS)
Main PID: 521 (sshd)
Tasks: 1 (limit: 28817)
Memory: 8.1M
CPU: 2min 30.825s
CGroup: /system.slice/ssh.service
└─521 sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups
mai 23 08:26:27 XXXXXXXXXX sshd[476839]: Connection closed by invalid user centreon-engine XX.XXX.X.X port 55246 [preauth]
mai 23 08:31:27 XXXXXXXXXX sshd[476935]: Invalid user centreon-engine from 10.250.1.7 port 48320
mai 23 08:31:27 XXXXXXXXXX sshd[476935]: Connection closed by invalid user centreon-engine XX.XXX.X.X port 48320 [preauth]
mai 23 08:35:29 XXXXXXXXXX sshd[476978]: Accepted password for root from XX.XXX.X.X port 59103 ssh2
mai 23 08:35:29 XXXXXXXXXX sshd[476978]: pam_unix(sshd:session): session opened for user root(uid=0) by (uid=0)
mai 23 08:35:30 XXXXXXXXXX sshd[476981]: Accepted password for root from XX.XXX.X.X port 59104 ssh2
mai 23 08:35:30 XXXXXXXXXX sshd[476981]: pam_unix(sshd:session): session opened for user root(uid=0) by (uid=0)
mai 23 08:35:52 XXXXXXXXXX sshd[477069]: Accepted publickey for ro_ssh_centreon from XX.XXX.X.X port 59394 ssh2: ED25519 SHA256:RqDrE6hrJ51saGe3yCjf+TJuwXSXlrRCLYTzT/jXKIg
mai 23 08:35:52 XXXXXXXXXX sshd[477069]: pam_unix(sshd:session): session opened for user ro_ssh_centreon(uid=1001) by (uid=0)
mai 23 08:35:52 XXXXXXXXXX sshd[477069]: pam_unix(sshd:session): session closed for user ro_ssh_centreon
From centreon WebUI

But I have this in the script perl :

Thx