Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions grafana/grafana-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: grafana-datasources
namespace: #namespace_name#
data:
prometheus.yaml: |-
{
"apiVersion": 1,
"datasources": [
{
"access":"proxy",
"editable": true,
"name": "prometheus",
"orgId": 1,
"type": "prometheus",
"url": "http://prometheus-service.monitoring.svc:8080",
"version": 1
}
]
}
49 changes: 49 additions & 0 deletions grafana/grafana-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: grafana
namespace: #namespace_name#
spec:
replicas: 1
selector:
matchLabels:
app: grafana
template:
metadata:
name: grafana
labels:
app: grafana
spec:
containers:
- name: grafana
image: grafana/grafana:9.3.6
ports:
- name: grafana
containerPort: 3000
resources:
limits:
memory: "1Gi"
cpu: "1000m"
requests:
memory: 500M
cpu: "500m"
volumeMounts:
- mountPath: /var/lib/grafana
name: grafana-storage
- mountPath: /etc/grafana/provisioning/datasources
name: grafana-datasources
readOnly: false
volumes:
- name: grafana-storage
persistentVolumeClaim:
claimName: grafana-storage
- name: grafana-datasources
persistentVolumeClaim:
claimName: grafana-datasources
initContainers:
- name: volume-mount-hack
image: busybox
command: ["sh", "-c", "chown -R 472:472 /var/lib/grafana"]
volumeMounts:
- name: grafana-storage
mountPath: /var/lib/grafana
19 changes: 19 additions & 0 deletions grafana/grafana-ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: grafana
namespace: #namespace_name#
annotations:
kubernetes.io/ingress.class: "nginx"
spec:
rules:
- host: grafana.mybento.local
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: grafana
port:
number: 3000
25 changes: 25 additions & 0 deletions grafana/grafana-pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: grafana-storage
namespace: #namespace_name#
spec:
storageClassName: longhorn
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: grafana-datasources
namespace: #namespace_name#
spec:
storageClassName: longhorn
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
16 changes: 16 additions & 0 deletions grafana/grafana-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: grafana
namespace: #namespace_name#
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "3000"
spec:
selector:
app: grafana
type: NodePort
ports:
- port: 3000
targetPort: 3000
nodePort: 32309
16 changes: 16 additions & 0 deletions grafana/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "grafana",
"display_name": "grafana",
"description": "grafana",
"parameters": [],
"main": "grafana/run.sh",
"dependencies": [
"grafana/run.sh",
"utils/cachengo.sh",
"grafana/grafana-configmap.yaml",
"grafana/grafana-deployment.yaml",
"grafana/grafana-ingress.yaml",
"grafana/grafana-pvc.yaml",
"grafana/grafana-service.yaml"
]
}
79 changes: 79 additions & 0 deletions grafana/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
![Grafana logo](https://github.com/grafana/grafana/raw/main/docs/logo-horizontal.png "Grafana Logo")

## What is Grafana?

---

Grafana allows you to query, visualize, alert on and understand your metrics no matter where they are stored


## Features

---
-Visualizations: Fast and flexible client side graphs with a multitude of options. Panel plugins offer many different ways to visualize metrics and logs.

-Dynamic Dashboards: Create dynamic & reusable dashboards with template variables that appear as dropdowns at the top of the dashboard.

-Explore Metrics: Explore your data through ad-hoc queries and dynamic drilldown. Split view and compare different time ranges, queries and data sources side by side.

-Explore Logs: Experience the magic of switching from metrics to logs with preserved label filters. Quickly search through all your logs or streaming them live.

-Alerting: Visually define alert rules for your most important metrics. Grafana will continuously evaluate and send notifications to systems like Slack, PagerDuty, VictorOps, OpsGenie.

-Mixed Data Sources: Mix different data sources in the same graph! You can specify a data source on a per-query basis. This works for even custom datasources.

## Installation

---

1. Select the devices to which Grafana will be installed from 'Devices' page.

2. Navigate to the 'App Marketplace' tab and select the 'Grafana' application.

3. The 'Install Now' button should now appear near the top of the screen. Select this button.

4. Give your installation a name and fill all the parameters. Click 'Install Grafana' in the bottom right corner.

## Required Parameters

---


## Additional Parameters

---

**Installation Name**

Here you will put your app name. Although the app name is Grafana on the portal, you can personalize the name that is shown on the device's Applications.

**NAMESPACE NAME**
Namespace where you want your app to be installed.

## Using Grafana

After you have installed Grafana and set up your first dashboard, you will have many options to choose from depending on your requirements. For example, if you want to view weather data and statistics about your smart home, then you can create a playlist. If you are the administrator for an enterprise and are managing Grafana for multiple teams, then you can set up provisioning and authentication.

If you’re using Grafana Alerting, then you can have alerts sent through a number of different alert notifiers, including PagerDuty, SMS, email, VictorOps, OpsGenie, or Slack.

## OS Architectures

---

- Arm64

## Limitations / Known issues

---

## Grafana Platform Video

---

[![Demo Image](http://img.youtube.com/vi/0n2UNzk2OaI/0.jpg)](https://www.youtube.com/watch?v=0n2UNzk2OaI)

## Docs

---

For more information: <https://grafana.com/docs/>
39 changes: 39 additions & 0 deletions grafana/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash

function do_install {
set -e
cachengo-cli updateInstallStatus "$APPID" "Installing"

kubectl create namespace $APPID

sed -i "s|#namespace_name#|$APPID|g" grafana/grafana-configmap.yaml
sed -i "s|#namespace_name#|$APPID|g" grafana/grafana-deployment.yaml
sed -i "s|#namespace_name#|$APPID|g" grafana/grafana-ingress.yaml
sed -i "s|#namespace_name#|$APPID|g" grafana/grafana-service.yaml
sed -i "s|#namespace_name#|$APPID|g" grafana/grafana-pvc.yaml

kubectl apply -f grafana/grafana-configmap.yaml
kubectl apply -f grafana/grafana-deployment.yaml
kubectl apply -f grafana/grafana-ingress.yaml
kubectl apply -f grafana/grafana-service.yaml
kubectl apply -f grafana/grafana-pvc.yaml

}

function do_uninstall {
cachengo-cli updateInstallStatus "$APPID" "Uninstalling"

kubectl delete -f grafana/grafana-ingress.yaml -n $APPID
kubectl delete -f grafana/grafana-service.yaml -n $APPID
kubectl delete -f grafana/grafana-deployment.yaml -n $APPID
kubectl delete -f grafana/grafana-pvc.yaml -n $APPID
kubectl delete -f grafana/grafana-configmap.yaml -n $APPID

kubectl delete namespace $APPID

cachengo-cli updateInstallStatus "$APPID" "Uninstalled"
}
case "$1" in
install) do_install ;;
uninstall) do_uninstall ;;
esac
6 changes: 6 additions & 0 deletions utils/docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,10 @@ function delete_network {

function container_state {
echo "$( docker container inspect -f '{{.State.Status}}' $1 )"
}

function get_host {
HOST_NAME=$(hostname)

echo "$HOST_NAME"
}