Skip to main content

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 monit-agd

Exemplo arquivo .monit:

# Project info
# Informações obrigatórias
PROJECT=sample_project
COMPANY=acme
DEV=coder

# Database info
# Informações obrigatórias
DB_USER=user
DB_PASSWORD=p@ssw0rd
DB_HOST=localhost
DB_DATABASE=teste

# Email info
# Deixe em branco para desativar o envio de e-mails
EMAIL=
EMAIL_PASSWORD=

Exemplo de Uso:

Utilização do Monit para notificação de erros

import time

from monit.core import Monitor as monit
from monit.error import SetupError

def main():

    try:
        time.sleep(5)
        raise ValueError("This is a sample error.")

    except Exception as e:
        print("Erro: Ocorreu um erro inesperado.")
        monit.notify_and_exit(SetupError, e)


if __name__ == "__main__":
    main()

Utilização do Monit para notificação de erros que não são grandes o suficientes para exigir que o processo seja interrompido.

# sample.py
import time

from monit.core import Monitor
from monit.error import SetupError
# from monit.logger import Logger
# from monit.log2file import Log2File

def main():
    # Initialize the Monitor
    monit = Monitor()

    # Log2File()
    # log = Logger()

    try:
        # Your code that might raise exceptions
        time.sleep(5)
        raise ValueError("This is a sample error.")

    except Exception as e:
        print("Erro: Ocorreu um erro inesperado.")
        monit.notify(SetupError, e)
        # monit.notify_and_exit(SetupError, e)

    monit.end()


if __name__ == "__main__":
    main()

Tipos de erros:

SetupError
DatabaseError
HTTPError
FileError
FolderError
TooManyRequests
DataCreateError
DataUpdateError

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

monit-agd-1.3.10.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

monit_agd-1.3.10-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file monit-agd-1.3.10.tar.gz.

File metadata

  • Download URL: monit-agd-1.3.10.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for monit-agd-1.3.10.tar.gz
Algorithm Hash digest
SHA256 ae062760b18aab84007d2f28c082dca7ce9f1682d45d4b8bb7802e30cfa70478
MD5 8b3af9e75552a2f387af80b27d79c9e8
BLAKE2b-256 b621c05acde6fa59f006b9ccf457f6ccbce08589b66f547e4b0561d875440c8c

See more details on using hashes here.

File details

Details for the file monit_agd-1.3.10-py3-none-any.whl.

File metadata

  • Download URL: monit_agd-1.3.10-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for monit_agd-1.3.10-py3-none-any.whl
Algorithm Hash digest
SHA256 8a816dd411223bcc13cd5897910f673a42071643662fcbfdbc59ed7a60333a1c
MD5 680d27288ad657aa26611b19d6096a21
BLAKE2b-256 7749aafb6449fc8b469790246779d228ae547dcc07527563e462d22e4b52c613

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page