Skip to main content

A Python client for Cronus alerts

Project description

cronus-alert

The easiest way to get push notifications for events that you define

This repo contains the cronus-alert package in

  1. Javascript
  2. Go
  3. Python

All packages require an API key from cronusmonitoring.com

Javascript

1. Install

npm i cronus-alert

2. Example usage

function main() {
  // Set API Key to an environment variable
  const cronusAlert = new CronusAlert(process.env.CRONUS_API_TOKEN);

  cronusAlert
    .FireAlert(
      "The system is down", // Summary
      "Someone forgot to lock the gate", // Description
      Status.Firing // Optional status
    )
    .then((resp) => {
      console.log(resp.data); // API response
    })
    .catch((err) => {
      console.error(err); // network error
    });
}

main();

Go

1. Install

go get github.com/mperkins808/cronus-alert/go/pkg/cronusalert

2. Example usage

func main() {

  client := cronusalert.NewCronusAlertClient(os.Getenv("CRONUS_API_KEY"))
  alert := cronusalert.Alert{
      Summary:     "Issue detected in server",
      Description: "Failing to read database transactions",
      Status:      cronusalert.FIRING,
    }

  err := client.Fire(alert)
  if err != nil {
      // handle error
  }

}

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

cronusalert-0.1.0.tar.gz (2.3 kB view hashes)

Uploaded Source

Built Distribution

cronusalert-0.1.0-py3-none-any.whl (2.6 kB view hashes)

Uploaded Python 3

Supported by

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