Rocky Linux 8.10 sunucu yönetimi için Go ile yazılmış Telegram botu. Sunucuya SSH bağlanmadan Telegram üzerinden anlık durum sorgulayabilirsiniz.
| Komut | Açıklama |
|---|---|
/durum |
RAM, disk, CPU ve servis durumunu gösterir |
/disk |
Disk bölümlerinin doluluk oranını gösterir |
/servisler |
Çalışan servislerin listesini gösterir |
/myid |
Telegram Chat ID'nizi gösterir (yetki gerekmez) |
- Go 1.22+
- Rocky Linux 8.10 (veya uyumlu bir dağıtım)
git clone https://github.com/guvenchemy/telegram-alert-bot.git
cd telegram-alert-botBot oluştur:
- Telegram'da @BotFather'a git
/newbotyaz ve talimatları takip et- Sana verilen API token'ı not al
Chat ID'ni öğren:
- Oluşturduğun bota herhangi bir mesaj gönder
- Tarayıcıda şu adrese git:
https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates
- JSON çıktısında
"chat":{"id":123456789,...}kısmındaki id değerini al (bu senin Chat ID'n)
cp opt/telegram-bot/config.json.sample opt/telegram-bot/config.json
nano opt/telegram-bot/config.json{
"token": "BOT_TOKEN",
"allowed_ids": [123456789]
}cd opt/telegram-bot
go build -o telegram-bot main.gosudo useradd -r -s /sbin/nologin telegrambot
sudo chown -R telegrambot:telegrambot /opt/telegram-bot
sudo chown telegrambot:telegrambot /usr/local/bin/sunucu-durumu
sudo chown telegrambot:telegrambot /usr/local/bin/disk-raporusudo cp etc/systemd/system/telegrambot.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now telegrambot.service- Sadece
allowed_idslistesindeki kullanıcılar komut çalıştırabilir /myidkomutu herkese açıktır, Chat ID öğrenmek için kullanılırconfig.json.gitignoreile repo dışında tutulur