Rocket chat hooks via CURL
ບັນທຶກໄວ້ກັນລືມ hooks curl ໄປຫາ rocket chat
ກ່ອນອື່ນກໍຕ້ອງໄປເປີດ hook url ໃນ Rocker chat ທີ່ ເມນູ integration ກ່ອນ
ຫຍັງຈາກໄດ້ ແລ້ວກໍເອົາມາສົ່ງເລີຍ ແບບນີ້ເດີ້
curl -X POST --data-urlencode 'payload={"text": "Start service '${service_arr[i]}' at '$(hostname -i)' ", "channel": "#monitoring", "username": "os-bot", "icon_emoji": ":penguin:"}' https://rocketchatserver.laoitdev.com/hooks/kK6xHudkljdsfew/vZwioZvDrLUJSDYWBdlpoeiwropiweyuyuweyury &> /dev/null
ຈາກນັ້ນກໍເອົາໄປປະຍຸກໃຊ້ກັບ Service monitor ໄດ້ເລີຍ
ໂຕຢ່າງ ການເອົາໄປໃຊ້ແຈ້ງເຕືອນ ssh login
ເລີ່ມຈາກສ້າງ shell script ກ່ອນ
sudo nano /etc/ssh/sshnotify.sh
!/bin/sh
if [ "$PAM_TYPE" != "close_session" ]; then
curl -X POST --data-urlencode 'payload={"text": "SSH user '$PAM_USER' from IP '$PAM_RHOST' sucessful login at '$(hostname -i)' ", "channel": "#monitoring", "username": "os-bot", "icon_emoji": ":penguin:"}' https:/rocketchatserver.laoitdev.com/hooks/kK6sdsdfsd
fi
ແລ້ວກໍໄປເພີ່ມ
session optional pam_exec.so seteuid /etc/ssh/sshnotify.sh
ໄວ້ແຖວສຸດທ້າຍຂອງໄຟລ nano /etc/pam.d/sshd
ຖືວ່າຈົບພິທີການ