Creating the notifications.cfg file

R3dM3at

New Member
Jun 18, 2024
26
4
3
When staging our hardware with proxmox, i have a text file with the notifications.cfg configuration ready to go. Simply copy/paste it into the shell and save it. When I go to the notifications location in the Web GUI I can see that my SMTP and matchers has taken correctly with all the settings. When I run a test email, i get an error "name of my smtp does not exist". If i edit the SMTP profile by disabling it, click OK, then go back in and enable it and click ok, everything works fine.

Is there some command in the shell i need to run after creating the notifications.cfg file to avoid having to disable/enable it?
 
That's interesting!
I think I have a slightly different issue but which seems to have the same root cause.

I use Ansible to bootstrap and setup my PVE instances and when I try to create the `notification.cfg` by copying, I have the following error:
Code:
TASK [Setup notifications configuration] ***************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: PermissionError: [Errno 1] Operation not permitted: b'/etc/pve/.ansible_tmpxhogd5pwnotifications.cfg'
fatal: [masamune]: FAILED! => changed=false
  checksum: 0a9ff4b144c1caa25bc3c04dda92d68ae142e242
  msg: 'Failed to replace file: b''/tmp/ansible-tmp-1741857479.031669-502-134330310211007/.source.cfg'' to /etc/pve/notifications.cfg: [Errno 1] Operation not permitted: b''/etc/pve/.ansible_tmpxhogd5pwnotifications.cfg'''
When I edit the notification config via the WebUI first, it will create the `notification.cfg` file and then I can overwrite it without issue with the changes applied in the console.
 
That's interesting!
I think I have a slightly different issue but which seems to have the same root cause.

I use Ansible to bootstrap and setup my PVE instances and when I try to create the `notification.cfg` by copying, I have the following error:
Code:
TASK [Setup notifications configuration] ***************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: PermissionError: [Errno 1] Operation not permitted: b'/etc/pve/.ansible_tmpxhogd5pwnotifications.cfg'
fatal: [masamune]: FAILED! => changed=false
  checksum: 0a9ff4b144c1caa25bc3c04dda92d68ae142e242
  msg: 'Failed to replace file: b''/tmp/ansible-tmp-1741857479.031669-502-134330310211007/.source.cfg'' to /etc/pve/notifications.cfg: [Errno 1] Operation not permitted: b''/etc/pve/.ansible_tmpxhogd5pwnotifications.cfg'''
When I edit the notification config via the WebUI first, it will create the `notification.cfg` file and then I can overwrite it without issue with the changes applied in the console.
Yes, I have no problems when the file is already configured via the WebUI and I edit with nano. The file does not exist when proxmox is initially installed, I simply took a configured/working file and copied the contents to a new install config file and have the issue. I thought maybe creating it via the Web added some different permissions and that's why disabling/enabling would fix it, but comparing permissions shows a new config and a working one are exactly the same
 
I'm facing same issue.

Initially notifications.cfg is not present.

When I create the file and add same configuration same as other cluster it says that the endpoint is not found when trigger test email.
When creating the same snmp targets and matchers through GUI everything works fine.

Is there any other way around this?

I've managed to update notifications from cli using its api via ansible:

Notification Targets:
pvesh create /cluster/notifications/endpoints/smtp --name <target_id> \
--server <server> \
--port <port number> \
--mode insecure \
--from-address <from email address> \
--mailto-user <mail to email address>

Notification Matchers:
pvesh create /cluster/notifications/matchers --name <matcher_id> \
--mode any \
--target <target_name>
 
Last edited: