Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Telegram Alert Bot

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.

Komutlar

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)

Kurulum

Gereksinimler

  • Go 1.22+
  • Rocky Linux 8.10 (veya uyumlu bir dağıtım)

1. Repoyu klonla

git clone https://github.com/guvenchemy/telegram-alert-bot.git
cd telegram-alert-bot

2. Telegram Bot Oluştur ve Chat ID Al

Bot oluştur:

  1. Telegram'da @BotFather'a git
  2. /newbot yaz ve talimatları takip et
  3. Sana verilen API token'ı not al

Chat ID'ni öğren:

  1. Oluşturduğun bota herhangi bir mesaj gönder
  2. Tarayıcıda şu adrese git:
https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates
  1. JSON çıktısında "chat":{"id":123456789,...} kısmındaki id değerini al (bu senin Chat ID'n)

3. Config dosyasını oluştur

cp opt/telegram-bot/config.json.sample opt/telegram-bot/config.json
nano opt/telegram-bot/config.json
{
    "token": "BOT_TOKEN",
    "allowed_ids": [123456789]
}

4. Derle

cd opt/telegram-bot
go build -o telegram-bot main.go

5. telegrambot kullanıcısını oluştur

sudo 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-raporu

6. Servisi kur

sudo cp etc/systemd/system/telegrambot.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now telegrambot.service

Güvenlik

  • Sadece allowed_ids listesindeki kullanıcılar komut çalıştırabilir
  • /myid komutu herkese açıktır, Chat ID öğrenmek için kullanılır
  • config.json .gitignore ile repo dışında tutulur

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages