Programa de monitoramento de código python, desenvolvido para ser utilizado pelas funcionário da Agência de dados
Project description
Monit
Instalação:
pip install pymonit
Atualização:
pip install -U pymonit
Exemplo arquivo .monit:
PROJECT='project_name'
COMPANY='company_name'
DEV='coder'
LOCATION='location_name'
HANDLER_URL='https://example.com'
PHONE='556199999999'
Exemplo de Uso:
Utilização simples
import time
from monit.core import Monitor as monit
def main():
try:
time.sleep(5)
raise ValueError("This is a sample error.")
except Exception as e:
monit.notify_and_exit(e) # para o script
monit.end() # manda sinal de fim sem erros
if __name__ == "__main__":
main()
Utilização avançada
from time import sleep
from monit.core import Monitor as monit
from monit.logger import Logger
from monit.log2file import Log2File
Log2File() # Salva todo o log em um arquivo
log = Logger()
def main():
try:
log.info("Hello, World!")
sleep(2)
raise ValueError("This is a sample error.")
except Exception as e:
monit.msg("Ocorreu um erro, tentando de novo...") # Whatsapp
monit.notify(e) # não para o script
try:
log.info("Tentando novamente...")
sleep(2)
raise ValueError("This is another error.")
except Exception as e:
monit.msg("Script terminou com erros.")
monit.notify_and_exit(e)
monit.end()
if __name__ == "__main__":
main()
Soluções De Problemas
PdhAddEnglishCounterW failed. Performance counters may be disabled.
O erro ocorre porque os contadores de desempenho do Windows estão desativados ou corrompidos, causando a falha da função PdhAddEnglishCounterW. Execute os seguintes comandos em um CMD com privilégios administrativos:
lodctr /r
winmgmt /resyncperf
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pymonit-1.6.0.tar.gz.
File metadata
- Download URL: pymonit-1.6.0.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4bacc42d820f8fbf61b4a433ce321b7395a0b62b40d19fc2180a0bb8b3abc179
|
|
| MD5 |
5f238c78264d407b15d0cf88aae2ffad
|
|
| BLAKE2b-256 |
5f6a8d68701750281505c8fbcab15912a907494cac0b71cecdfc225d6d7bff63
|
File details
Details for the file pymonit-1.6.0-py3-none-any.whl.
File metadata
- Download URL: pymonit-1.6.0-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
969cdc545c1adb7ce131247c2565af403e8d39d97da57f6766eaf9ee6b383daa
|
|
| MD5 |
57a1b66c4fecb41424894e8477a0fe85
|
|
| BLAKE2b-256 |
fb1fe2aa349745c90add861c2d069ade544d051f3e89e6584e6ed66dc1890d63
|