Merhaba,
Sizlerle Sisteminizdeki ESXi serverlarinizin CPU.Memory ve durumlarini kontrol eden bir python kodu paylasmak isterim. Zaman buldukca kodu gelistirmek istiyorum.
Bu scripti istediginiz gibi gelistirebilirsiniz. Boylece size uygun hale getirebilirsiniz.
Gereksinimler:
- Linux sunucu Bu sunucu telegram adresine erisebilmeli.
- Python
- Gerekli paketler: 3.1 python telebot paketi 3.2 python pyVim 3.3 python pyVmomi
Code Hakkinda kisa bilgi:
- log dosyasinin nereye kayit etmesini istiyorsaniz "log Parameterleri" kisminda bulunan "logFileName" path'ini deigistirmeniz yeterli.
- Telegram'a mesaj gonderebilmek icin TOKEN ve Chat ID yenigtiyaciniz var. Bu bilgileri telegramdan elde edebilirsiniz.
- Vcenter bilgilerini "vcs" listesine eklemelisiniz. Ben ornek olarak ESX1_FQDN seklinde yazdim.
- Python scriptinin calisacagi Linux sunucu ile Vcenterlar ve ESX ler arasinda rest api portlari acik olmalidir.
- cpu_threshold ve memory_threshold degerlerini degistirerek esik degerleri belirleye bilirisiniz.
#ENGLISH Hello,
I would like to share with you a python code that checks the CPU.Memory and status of your ESXi servers in your system. I want to improve the code when I find time.
You can develop this script as you want. So you can make it suitable for you.
Requirements:
- Linux server This server should be able to access the telegram address.
- Python
- Required packages: 3.1 python telebot package 3.2 python pyVim 3.3 python pyVmomi
Information about Code:
- if you want the log file to save where you want it to save, just change the “logFileName” path in the “log Parameters” section.
- You need a TOKEN and a Chat ID to send a message to Telegram. You can get this information from telegram.
- You need to add the Vcenter information to the “vcs” list. I wrote ESX1_FQDN as an example.
- The rest api ports must be open between the Linux server where the Python script will run and the Vcenters and ESXs.
- You can set threshold values by changing the cpu_threshold and memory_threshold values.