uptimerobot chart

This commit is contained in:
Jeff Billimek 2018-06-24 10:34:16 -04:00
parent 29f65c1a63
commit a26cb4ac2f
9 changed files with 244 additions and 0 deletions

23
uptimerobot/.helmignore Normal file
View File

@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
# OWNERS file for Kubernetes
OWNERS

15
uptimerobot/Chart.yaml Normal file
View File

@ -0,0 +1,15 @@
apiVersion: v1
name: uptimerobot
version: 1.0.0
appVersion: 1.0.0
description: A tool to get statistics from Uptime Robot and log it into InfluxDB
keywords:
- uptimerobot
- influxdb
home: https://github.com/billimek/node-influx-uptimerobot
sources:
- https://github.com/billimek/node-influx-uptimerobot
- https://github.com/billimek/billimek-charts
maintainers:
- name: billimek
email: jeff@billimek.com

4
uptimerobot/OWNERS Normal file
View File

@ -0,0 +1,4 @@
approvers:
- billimek
reviewers:
- billimek

70
uptimerobot/README.md Normal file
View File

@ -0,0 +1,70 @@
# A tool to get statistics from Uptime Robot and log it into InfluxDB
![Screenshot](https://github.com/billimek/node-influx-uptimerobot/blob/master/docs/dashboard.png)
This tool allows you to run periodic uptimerobot data usage checks and save the results to Influxdb
## TL;DR;
```console
$ helm repo add billimek https://raw.githubusercontent.com/billimek/helm-repo/master
$ helm install billimek/uptimerobot
```
## Introduction
This code is adopted from [this original repo](https://github.com/trojanc/node-influx-uptimerobot)
## Installing the Chart
To install the chart with the release name `my-release`:
```console
$ helm install --name my-release billimek/uptimerobot
```
## Uninstalling the Chart
To uninstall/delete the `my-release` deployment:
```console
$ helm delete my-release --purge
```
The command removes all the Kubernetes components associated with the chart and deletes the release.
## Configuration
The configuration is set as a block of text through a configmap and mouted as a file in /src/config.ini Any value in this text block should match the defined uptimerobot configuration. There are several values here that will have to match our kubernetes configuration.
## Configuration
The following tables lists the configurable parameters of the Sentry chart and their default values.
| Parameter | Description | Default |
| ------------------------------- | ------------------------------- | ---------------------------------------------------------- |
| `image.repository` | uptimerobot image | `billimek/uptimerobotusage-for-influxdb` |
| `image.tag` | uptimerobot image tag | `latest` |
| `image.pullPolicy` | uptimerobot image pull policy | `IfNotPresent` |
| `delay` | number of seconds to wait between collections | `300` |
| `config.delay` | how many seconds to wait between checks | `3600` |
| `config.influxdb.host` | InfluxDB hostname | `influxdb-influxdb` |
| `config.influxdb.port` | InfluxDB port | `8086` |
| `config.influxdb.database` | InfluxDB database | `uptimerobot` |
| `config.influxdb.protocol` | InfluxDB protocol | `http` |
| `config.uptimerobot.apikey` | uptimerobot API key (REQUIRED) | `someapikey` |
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
```console
$ helm install --name my-release \
--set config.uptimerobot.apikey=thisismyapikey \
billimek/uptimerobot
```
Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart. For example,
```console
$ helm install --name my-release -f values.yaml billimek/uptimerobot
```
Read through the [values.yaml](values.yaml) file. It has several commented out suggested values.

View File

@ -0,0 +1,7 @@
You can connect to the container running uptimerobot. To open a shell session in the pod run the following:
- kubectl exec -i -t --namespace {{ .Release.Namespace }} $(kubectl get pods --namespace {{ .Release.Namespace }} -l app={{ template "uptimerobot.fullname" . }} -o jsonpath='{.items[0].metadata.name}') /bin/sh
To trail the logs for the uptimerobot pod run the following:
- kubectl logs -f --namespace {{ .Release.Namespace }} $(kubectl get pods --namespace {{ .Release.Namespace }} -l app={{ template "uptimerobot.fullname" . }} -o jsonpath='{ .items[0].metadata.name }')

View File

@ -0,0 +1,27 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "uptimerobot.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "uptimerobot.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}

View File

@ -0,0 +1,22 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "uptimerobot.fullname" . }}
labels:
app: {{ template "uptimerobot.name" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
data:
config.json: |
{
"uptimerobot" : {
"apikey" : "{{ .Values.config.uptimerobot.apikey }}"
},
"influx" : {
"host" : "{{ .Values.config.influxdb.host }}",
"port" : {{ .Values.config.influxdb.port }},
"protocol" : "{{ .Values.config.influxdb.protocol }}",
"database" : "{{ .Values.config.influxdb.database }}"
}
}

View File

@ -0,0 +1,45 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: {{ template "uptimerobot.fullname" . }}
labels:
app: {{ template "uptimerobot.name" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
selector:
matchLabels:
app: {{ template "uptimerobot.name" . }}
release: {{ .Release.Name }}
replicas: {{ default 1 .Values.replicas }}
template:
metadata:
labels:
app: {{ template "uptimerobot.name" . }}
release: {{ .Release.Name }}
spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
- name: DELAY
value: "{{ .Values.delay }}"
resources:
{{ toYaml .Values.resources | indent 12 }}
volumeMounts:
- name: {{ template "uptimerobot.name" . }}
mountPath: /usr/src/node-influx-uptimerobot/config.json
subPath: config.json
{{- if .Values.nodeSelector }}
nodeSelector:
{{ toYaml .Values.nodeSelector | indent 8 }}
{{- end }}
volumes:
- name: {{ template "uptimerobot.name" . }}
configMap:
name: {{ template "uptimerobot.fullname" . }}
items:
- key: config.json
path: config.json

31
uptimerobot/values.yaml Normal file
View File

@ -0,0 +1,31 @@
# Default values for comcast.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
replicaCount: 1
image:
repository: billimek/uptimerobot-influxdb
tag: latest
pullPolicy: IfNotPresent
resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
nodeSelector: {}
delay: 300 # number of seconds to wait between collections
config:
influxdb:
# host/port/database are mandatory - change as needed
host: influxdb-influxdb
port: 8086
protocol: http
database: uptimerobot
uptimerobot:
# API key is mandatory and must be populated
apikey: someapikey