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)
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.notify(e)
monit.msg("O Script terminou com sucesso.") # whatsapp
monit.end() # manda sinal de fim sem erros
if __name__ == "__main__":
main()
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
pymonit-1.4.7.tar.gz
(5.9 kB
view hashes)