How to monitor Proxmox CPU temp

how do I do that?

in the terminal type rm /config/.ssh/id_rsa if /config/.ssh/id_rsa is where you copied it to.

1 Like

its telling me cant remove. no such file or directory

Then you didn’t follow the command to save the file there (or you did, but the post has a typo and calls it is_rsa rather than id_rsa which is what it should be called.

EDIT: If you followed the commands exactly - then the file you want to delete will be /config/is_rsa

Web capture_12-11-2021_72345_homeassistant.local
I pressed enter twice. I tested sshing to the server and it keeps asking for password

usage sensors:

  - platform: command_line
    name: 'Proxmox CPU'
    command: ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [email protected] top -d 0.5 -b -n2 | grep "Cpu(s)"|tail -n 1 | awk '{printf ("%.0f\n",$2 + $4)}'
    unit_of_measurement: '%'
  - platform: command_line
    name: 'Proxmox RAM'
    command: ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa user@ip free -m | grep Mem | awk '{printf ("%.0f\n",$3*100/$2)}'
    unit_of_measurement: '%'
  - platform: command_line
    name: 'Proxmox SSD'
    command: ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa user@ip df | grep pve-root | awk '{printf ("%.0f\n",$3*100/($3+$4))}'
    unit_of_measurement: '%'
2 Likes

Yes - it’s asking YOU for the password for the proxmox server, it wouldn’t be very secure if anyone could just copy whatever SSH key they liked to any server, without proving to the server that they have an account on the server.

You should type in the root password for the Proxmox server, and then it will copy the key to the Proxmox server. After that whenever you do ssh -i /config/id_rsa [email protected] it will NOT ask for the password anymore.

(Make sure you after you have provided the root password, you then copy the key to /config/id_rsa)

1 Like

Ah so It wont need password when HA calls for the cpu temp from server, right?
sorry I am a total noob here

1 Like

Yes you provide the password once, which is not HA asking for the password, it’s Proxmox asking for you to prove you have permission to access the server. You provide the root password, and Proxmox copies the SSH key to it’s file, and in future because it already trusts the SSH key that is connecting to it, it won’t ask for a password. (Providing you use the -i option with the ssh command, -i means identity)

So to be clear the full list of commands should be:

ssh-keygen
ssh-copy-id root@proxmox-ip-address
**TYPE IN ROOT PASSWORD FOR PROXMOX**
mkdir -p /config/.ssh
cp /root/.ssh/id_rsa /config/.ssh/id_rsa
ssh -i /config/.ssh/id_rsa root@proxmox-ip-address
exit

Copying the ssh file in to the config file is extremely important. Because otherwise HomeAssistant does not have access to it.

1 Like

Thank you so much for sticking with me.
Web capture_12-11-2021_9371_192.168.0.108
what am I doing wrong here please?

update: I got to here


I noticed that warning about the /config/.ssh/id_rsa not accessible though

can you run

ls -lah /root/.ssh

please

in the server itself or through shh addon in home assistant?

The SSH addon, we want to know what SSH keys you have already generated.

You keep forgetting the space. There is a space after -lah and it’s /root/.ssh/ not /root.ssh

sorry yes.
image

Hmm there are no files there at all.
OK try:

ls /root/.ssh

image

OK so the generated file has gone, the add_on was probably restarted or something.
So we need to start from the beginning.

ssh-keygen

When it says what file do you want to save it to, instead of pressing enter, type:

/config/.ssh/id_rsa

and then it will already be saved in the right place, and we won’t need to copy it later.
Let me know when you have done that, and check the file exists by running

ls -lah /config/.ssh

You should see an id_rsa file and an id_rsa.pub file.

will report back. in retrospect, i never pressed enter when it asks me to what file do I want to save it. i always put ssh-copy-id as advised in the op

ok here we go
image

done and i see the files you talked about