Skip to main content

A python based tool to check that a given resource (URL, Certificate and DNS entry) is alive and valid.

Project description

kenkou
======
健康 - kenkou - health

A python based tool to check that a given resource is alive and valid.

It can check on URLs, Certificates and also DNS entries.

All redirects are followed and once the final URL is discovered it is tested for a 2XX result. If a 2XX is returned it is also scanned for mixed-content items if the url is HTTPS. Certificates are verified for any HTTPS site.

Currently it assumes port 443 for TLS and also that the given domain resolves to an IP address.

Designed to be run from a cronjob as often as you want to check the sites.

Note: Kenkou will check to see if the [Certifi](https://certifi.io/en/latest/) Python package is installed, and if so, it will use the CA Bundle from that. If not it will check to see if ```/etc/ssl/certs/ca-certificates.crt``` exists. If neither is found it will exit with an error if a certificate check was requested.

Usage
-----

```
python kenkou.py [-c|--config FILENAME]

Where:
-c --config Configuration file (json format)

The output is a based on the value of the "onevent" configuration key:
"json" (default if not present)
"pagerduty"
"postageapp"
```

Requirements
------------
See requirements.txt for details about what Python modules to install.

Configuration
-------------
Example kenkou.cfg file:

```json
{ "pagerduty": {
"url": "https://events.pagerduty.com/generic/2010-04-15/create_event.json",
"method": "POST",
"params": { "service_key": "secret",
"incident_key": "incident_secret",
"event_type": "trigger",
"description": "FAILURE for production/HTTP"
}
},
"postageapp": {
"api_key": "secret",
"recipients": [ "email@example.com" ]
},
"onevent": [ "postageapp" ],
"checks": "kenkou_check.cfg"
}
```

kenkou_check.cfg:

```json
{ "web": { "url": "https://example.com",
"dns": [ "example.com", "127.0.0.1",
[ "ns1.dnsimple.com", "ns2.dnsimple.com" ]
],
"cert": "example.com"
},
"lb": { "url": "http://lb.example.com",
"dns": [ "lb.example.com", "127.0.0.1",
[ "ns1.dnsimple.com", "ns2.dnsimple.com" ]
],
"cert": "lb.example.com"
}
}
```

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

kenkou-0.5.2.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

kenkou-0.5.2-py2-none-any.whl (14.7 kB view details)

Uploaded Python 2

File details

Details for the file kenkou-0.5.2.tar.gz.

File metadata

  • Download URL: kenkou-0.5.2.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for kenkou-0.5.2.tar.gz
Algorithm Hash digest
SHA256 374695618e6cc43bb711605b0e47ca6cdf7f83bc393dfd7ab5d0249115deaf8e
MD5 2f33c49aaee7001a07ef843abdee3e1d
BLAKE2b-256 08c5aadf80468018d3165bcab5349fbd647817d8061800e99268f22df4dc952f

See more details on using hashes here.

File details

Details for the file kenkou-0.5.2-py2-none-any.whl.

File metadata

File hashes

Hashes for kenkou-0.5.2-py2-none-any.whl
Algorithm Hash digest
SHA256 e3d679f09cc7834f52e82c5b170dd40ae63dfade699f0588871820a4ff065142
MD5 f2e3706c06541590d895c7fa52a02c12
BLAKE2b-256 37e6a1ac5ac1e3b3ae6b87f5c097c3978e63cb113d2c7421366046ade8e4fe7b

See more details on using hashes here.

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