Monitor
https://gitlab.com/kb/monitor/
Icon:
<i class="fa fa-chain-broken"></i>
This app has two roles:
Monitor Services e.g. domain name or SSL certificate expiry
Monitor Costings e.g. hosting / storage to make sure we invoice customers correctly.
Configuration
Digital Ocean
For Digital Ocean, create a Personal Access Tokens
API
Applications & API
Tokens
Create A New Personal Access Token with a Read Only scope
Linode
For Linode
My Profile
API Tokens,
create a Personal Access Tokens, Read Only.
Settings
Add the following to settings/base.py:
DIGITAL_OCEAN_TOKEN = get_env_variable("DIGITAL_OCEAN_TOKEN")
LINODE_TOKEN = get_env_variable("LINODE_TOKEN")
MONITOR_COSTINGS_DEFAULT_PILLAR = get_env_variable(
"MONITOR_COSTINGS_DEFAULT_PILLAR"
)
Add the tokens to your environment e.g. .env.fish:
set -x MONITOR_COSTINGS_DEFAULT_PILLAR "yb"
set -x DIGITAL_OCEAN_TOKEN "dop_v1_123"
set -x LINODE_TOKEN "ab123"
Note
If the company default pillar is ~/Private/deploy/pillar-yb/,
then MONITOR_COSTINGS_DEFAULT_PILLAR should be set to yb.
Monitor Services
The monitor app is initialised with a Monitor header record:
Each
Monitorrow is identified using asluge.g.Monitor.DOMAIN_NAME.Each
Monitorrow links to a report class. The report class does the actual checking.The link from the
Monitorto the report class is created using theapp,moduleandreport_classfields.The
Monitorwill initiate a check on the report class by calling theinitialisemethod. This will be followed by a call to themonitormethod for each row on the report class.
Monitor Costings
Management Commands
Parse the Salt pillar to get the domain configuration:
django-admin costing-data-domain
Tip
The dump file is costing-data-domain.json
Read the domain data (costing-data-domain.json) and combine with
hosting information from the Digital Ocean, Linode and CloudSpace APIs:
django-admin costing-data-server
Tip
The dump file is costing-data-server.json
Read the domain data (costing-data-domain.json) and combine with
hosting information from SparkPost API:
django-admin costing-data-mail
Tip
The dump file is costing-data-mail.json
Read the domain data (costing-data-domain.json) and combine with
hosting information from rsync.net:
# WIP (not completed)
django-admin costing-data-backup
Tip
The dump file is costing-data-backup.json
Create the costing summary by contact:
django-admin costing-contact-summary 20
Tip
The parameter is the monthly cost of the SparkPost service.
Tip
The output file is costing-contact-summary.csv
Open costing-contact-summary.csv using LibreOffice.