HomeAssistant monitoring plugin

Hi,

Sorry for the late reply. Something happened that’s called weekend. Anyway, it seems that with the help of Martin you at least got the agent to work.

Now, for my information, what installation type of HA are you running? Are you using HAOS or did you install your own Linux and HA on top of that? I’m running HAOS as a VM inside ProxMox. So in order to get it working here’s basically what I did.

My CheckMK server is called “Hestia” and the site is “Home”. My HA server is called “Ganyu”. So on Ganyu I first installed the add-on “Terminal & ssh”. Then on Hestia, as the Home user, I ran ‘ssh-keygen’ and just hit enter a few times (so no password). This generates 2 files, in the ~/.ssh directory, id_rsa and id_rsa.pub.

Copy the contents of id_rsa.pub and add them in HA to the configuration of “Terminal & ssh”. It should look something like this then:

You can now test this. In my case as OS user Home I should be able to ssh to Ganyu without having to specify a password (note that the first time you may be asked to accept the host key; just do this):

OMD[Home]:~$ ssh root@ganyu

| |  | |                          /\           (_)   | |            | |
| |__| | ___  _ __ ___   ___     /  \   ___ ___ _ ___| |_ __ _ _ __ | |_
|  __  |/ _ \| '_ \ _ \ / _ \   / /\ \ / __/ __| / __| __/ _\ | '_ \| __|
| |  | | (_) | | | | | |  __/  / ____ \\__ \__ \ \__ \ || (_| | | | | |_
|_|  |_|\___/|_| |_| |_|\___| /_/    \_\___/___/_|___/\__\__,_|_| |_|\__|

Welcome to the Home Assistant command line.

System information
  IPv4 addresses for enp0s18: 172.16.0.61/24
  IPv6 addresses for enp0s18: 2a02:a467:2c6:1:3128:eef1:f519:3457/64, fe80::15ef:be49:a3c0:1d75/64

  OS Version:               Home Assistant OS 9.5
  Home Assistant Core:      2023.2.3

  Home Assistant URL:       http://Ganyu.local:8123
  Observer URL:             http://Ganyu.local:4357
[core-ssh ~]$

So, now I’ve established that I can connect password-less, as the site user to my Home Assistant. Just logout and copy the linux agent to HA:

OMD[Home]:~$ scp version/share/check_mk/agents/check_mk_agent.linux root@ganyu:/usr/bin/check_mk_agent

Now, in CheckMK go to “Setup → Agents → Other integrations” . Create a new rule under “Individual program call instead of agent access”. Give your rule a name and use this command:

And tell it to only run on the hosts you want. I my case I use this also on my Router.

Save and activate your rule and you should be ready to go. Here’s a sample of what I get:

Like I said before, since my version of HA is running as a docker container, every time I restart HA I have to copy the agent to it again. Looking for a fixed location to put it. Probably should put is somewhere in the config directory of HA, since that one’s persistant.