Proxmox 알림을 Gotify로 수신하는 방법

안녕하세요. 달소입니다.

앞서 소개해드린 오픈소스 메시징 시스템인 Gotify와 지금 구축한 Proxmox와 결합해서

Proxmox에서 생성된 알람을 Gotify로 받아보겠습니다.

기본적으로 Proxmox에서는 email을 통한 알람을 지원하고있지 .forward 를 통해서 다른 시스템과도 결합이 가능합니다.

차근차근 진행해주시면 gotify로 알람을 받을수있으니 잘 따라해주세요

gotify 앱 및 토큰생성

사용하시는 gotify로 가서 CREATE APPLICATION을 통해 Proxmox라는 앱을 만들어주시고 토큰값을 복사해주세요.

image.png.jpg

Proxmox 설정하기

그리고 복사한 토큰값을 아래 쉘에 넣어줍니다. (앱이름도 동일하게)

vi /usr/bin/gotify.sh

#!/bin/bash

ALERTSENDTO="[apps토큰값]"
ALERTSUBJECT="Proxmox"
ALERTMESSAGE="$(grep -P '^SUBJECT:' - | cut -d' ' -f2-)"

curl -X POST "https://gotify.myserver.com/message?token=$ALERTSENDTO" -F "title=$ALERTSUBJECT" -F "message=$ALERTMESSAGE" -F "priority=5" > /dev/null 2>&1

그리고 해당 쉘의 소유자와 권한을 변경해주세요.

chown 0:33 /usr/bin/gotify.sh
chmod 755 /usr/bin/gotify.sh

이제 /root/.forward에 위 쉘스크립트를 실행하는 부분만 추가해주시면 완료입니다.

|/usr/bin/gotify.sh

image.png.jpg

그리고 테스트 명령어를 아래처럼 넣어주시면 테스트가 가능합니다.

echo 'SUBJECT: foo bar' | /usr/sbin/sendmail -bm -N never -f root root@localhost

image.png.jpg

전체적인 흐름은 이게 끝입니다.ㅎ

image.png.jpg

참 쉽죠??

참고 :

Support for Gotifyforum.proxmox.comHellu It would be great to have support for Gotify, so we can have push notifications for updates and/or backups instead of only emails. You only have to execute a `curl` command to push a message.