Petze monitors web sites and services.
It exports prometheus metrics and writes logrus logs. Additionally, petze offers a convenient way to receive notifications via EMail, Slack or SMS, without the need to operate a big enterprise monitoring stack.
One instance of petze is designed to monitor many services at little cost.
While there is a vast amount of monitoring solutions out there I still felt there was something simplistic missing, that would play nicely with prometheus.io, which I have come to appreciate very much.
As of June 2017 we have a first working version and we are trying to get the configs right - feedback and contributions are most welcome!
Petze is configured through a set of yaml configuration files. The path to folder containing the configuration is passed to petze as the first argument on the commandline.
$ petze path/to/petzconf
Take a look at a simple example config: https://github.com/foomo/petze/tree/master/exampleConfig
The configuration file for petze is called: petze.yml. It provides information for the petze service, as well the configuration for your notifications.
# HTTP endpoint for prometheus metrics
address: server-name.net:8080
# optional basic auth
basicauthfile: path/to/basic-auth-file
# optional: running with TLS
tls:
address: server-name:8443
cert: path/to/cert.pem
key: path/to/key.pem
## Notifications
# optional: notification via slack webhooks
slack: https://hooks.slack.com/services/custom-parameters
# optional: configure SMTP notifications
smtp:
server: smtp-relay.yourprovider.com
user: [email protected]
pass: yourpassword
port: 465
from: [email protected]
to: [email protected]
# optional: SMS notifications
sms:
twilioSID: "yourTwilioSID"
twilioToken: "yourTwilioToken"
from: " 49123456789"
to:
- " 491234567891" # person 1
- " 491234567892" # person 2
Any other files with a .yml suffix will be treated as service configurations. It is strongly encouraged to organize them in folder structures. These will be reflected in the service ids.
# the service base URL
endpoint: http://www.bestbytes.de
# interval of the health checks
interval: 5m
# overwrite the default warning of one week before expiry for this service
tlsWarning: 128h
# want to get a heads up once things are back to normal?
# default is false!
# if you set this to true all configured notification providers
# will be used to send a status update once the service checks pass again
notifyIfResolved: true
# service health check sessions
# each session will preserve all cookies that have been set during checks
session:
- uri: "/"
comment: home page visit
check:
- statusCode: 200
- duration: 200ms
- goQuery:
".body div.test":
min: 3
- method: POST
comment: this is how you perform XHR requests
uri: "/path/to/a/rest/service?foo=bar"
contentType: application/json
headers:
"X-Test": ["foo"]
data:
foo: bar
check:
- contentType: application/json
- duration: 100ms
- headers:
"X-Test": "foo"
- jsonPath:
# this is a json path expression
"$[0].product.images ":
min: 1
- uri: "/another/path"
check:
- duration: 100ms
# match the location for checking redirects
- redirect: "https://myservice.com/asdf"
# match the raw response string
- matchReply: "asdf"
You can now get notifications by Mail, all you need to provide is an SMTP server! A summary email with all errors for a service will be generated, in case a check failed.
Add the following to your petze.yml:
# configure SMTP notifications
smtp:
server: smtp-relay.yourprovider.com
user: [email protected]
pass: yourpassword
port: 465
from: [email protected]
# enter multiple emails to notify if desired
to:
- [email protected]
- [email protected]
Using slack incoming webhooks, we can post messages to a slack channel by simply creating a slack app and enabling the incoming webhook: https://api.slack.com/messaging/webhooks
- Add a new App to your Slack workspace
- Go to the Apps Settings and enable Webhooks
- Select a channel to notify and generate a new webhook URL
Then add your newly generated webhook URL to your petze.yml:
slack: https://hooks.slack.com/services/custom-parameters
SMS notifications are also supported, currently we have an integration for twilio and sendinblue.
petze.yml:
sms:
twilioSID: "yourTwilioSID"
twilioToken: "yourTwilioToken"
from: " 49123456789"
to:
- " 491234567891" # person 1
- " 491234567892" # person 2
petze.yml:
sms:
sendInBlueAPIKey: "yourSendInBlueAPIKey"
from: " 49123456789"
to:
- " 491234567891" # person 1
- " 491234567892" # person 2
Prepare your config folder and move it to: /etc/petzconf. The repository contains an example configuration in the exampleConfig folder.
Then pull and start the container, mounting the config folder into the container:
$ docker pull foomo/petze
$ docker run -v /etc/petzconf:/etc/petzconf foomo/petze
Happy monitoring!