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


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.6.0.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

pymonit-1.6.0-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

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

Hashes for pymonit-1.6.0.tar.gz
Algorithm Hash digest
SHA256 4bacc42d820f8fbf61b4a433ce321b7395a0b62b40d19fc2180a0bb8b3abc179
MD5 5f238c78264d407b15d0cf88aae2ffad
BLAKE2b-256 5f6a8d68701750281505c8fbcab15912a907494cac0b71cecdfc225d6d7bff63

See more details on using hashes here.

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

Hashes for pymonit-1.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 969cdc545c1adb7ce131247c2565af403e8d39d97da57f6766eaf9ee6b383daa
MD5 57a1b66c4fecb41424894e8477a0fe85
BLAKE2b-256 fb1fe2aa349745c90add861c2d069ade544d051f3e89e6584e6ed66dc1890d63

See more details on using hashes here.

Supported by

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