Skip to content

Commit

Permalink
Merge pull request #503 from nasa/Harmony-1598-1
Browse files Browse the repository at this point in the history
Harmony-1598:Add monitoring
  • Loading branch information
blackone-sudo authored Nov 20, 2023
2 parents 352fb45 + 5c1b36c commit 18a1659
Show file tree
Hide file tree
Showing 5 changed files with 2,923 additions and 0 deletions.
5 changes: 5 additions & 0 deletions OPERATIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ kubectl port-forward <Prometheus Pod ID> 9090:9090 -n monitoring [--kubeconfig <

After which you can access the Prometheus UI in web browser at `http://localhost:9090`.

### Grafana

The Grafana UI can be accessed by forwarding the service's port (3000) to a another port since harmony runs on same port as grafana(3000)
kubectl port-forward -n monitoring service/grafana 4000:3000

#### Metrics

Harmony services workers provide a [metric](https://prometheus.io/docs/concepts/data_model/)
Expand Down
10 changes: 10 additions & 0 deletions bin/deploy-prometheus
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@ if [ "$NODE_ENV" != "development" ]; then
envsubst < "config/alert-manager.yaml" | kubectl apply -f -
fi

# Deploy Grafana
if [ "$NODE_ENV" != "development" ]; then
envsubst < "config/grafana.yaml" | kubectl apply -f -
fi

# Deploy NODE EXPORTER
if [ "$NODE_ENV" != "development" ]; then
envsubst < "config/daemonset.yaml" | kubectl apply -f -
fi

# Check for helm
if ! command -v "helm" &> /dev/null; then
echo "'helm' command not found. Prometheus adapter needs to be deployed via helm."
Expand Down
74 changes: 74 additions & 0 deletions config/daemonset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
apiVersion: apps/v1
kind: DaemonSet
metadata:
labels:
app.kubernetes.io/component: exporter
app.kubernetes.io/name: node-exporter
name: node-exporter
namespace: monitoring
spec:
selector:
matchLabels:
app.kubernetes.io/component: exporter
app.kubernetes.io/name: node-exporter
template:
metadata:
labels:
app.kubernetes.io/component: exporter
app.kubernetes.io/name: node-exporter
spec:
containers:
- args:
- --path.sysfs=/host/sys
- --path.rootfs=/host/root
- --no-collector.wifi
- --no-collector.hwmon
- --collector.filesystem.ignored-mount-points=^/(dev|proc|sys|var/lib/docker/.+|var/lib/kubelet/pods/.+)($|/)
- --collector.netclass.ignored-devices=^(veth.*)$
name: node-exporter
image: prom/node-exporter
ports:
- containerPort: 9100
protocol: TCP
resources:
limits:
cpu: 250m
memory: 180Mi
requests:
cpu: 102m
memory: 180Mi
volumeMounts:
- mountPath: /host/sys
mountPropagation: HostToContainer
name: sys
readOnly: true
- mountPath: /host/root
mountPropagation: HostToContainer
name: root
readOnly: true
volumes:
- hostPath:
path: /sys
name: sys
- hostPath:
path: /
name: root

---
kind: Service
apiVersion: v1
metadata:
name: node-exporter
namespace: monitoring
annotations:
prometheus.io/scrape: 'true'
prometheus.io/port: '9100'
spec:
selector:
app.kubernetes.io/component: exporter
app.kubernetes.io/name: node-exporter
ports:
- name: node-exporter
protocol: TCP
port: 9100
targetPort: 9100
Loading

0 comments on commit 18a1659

Please sign in to comment.