GithubHelp home page GithubHelp logo

postgres-grafana's Introduction

postgres-grafana

1. Install Kube-Prometheus-Stack on cluster:

Reference Documentation is as below:

https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack

This will installs the kube-prometheus stack, a collection of Kubernetes manifests, Grafana dashboards, and Prometheus rules combined with documentation and scripts to provide easy to operate end-to-end Kubernetes cluster monitoring with Prometheus using the Prometheus Operator.

Below Steps needs to be followed:

helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
kubectl create ns metrics
kubectl config set-context --current --namespace=metrics

helm upgrade --install grafana prometheus-community/kube-prometheus-stack

2. Install Postgres database on cluster:

helm repo add bitnami https://charts.bitnami.com/bitnami
helm install postgresql-dev bitnami/postgresql
kubectl get pods 

kubectl get secret/postgresql-dev -oyaml 

kubectl exec -it pod/postgresql-dev-0 sh


echo OTYwV0FRemZHZA== | base64 -d
POSTGRES_PASSWORD="960WAQzfGd"
PGPASSWORD="$POSTGRES_PASSWORD" psql --host 127.0.0.1 -U postgres -d postgres -p 5432

CREATE DATABASE testdb;

CREATE TABLE hello_world 
(
region      text,
country     text,
year        int,
production  int,
consumption int
);

INSERT INTO hello_world (region, country, year, production, consumption) VALUES ('America', 'USA', 1998, 2014, 12897);

kubectl get svc
kubectl edit svc/postgresql-dev 

Change the Service to Load Balancer so that it can be accessed from Grafana

To Search all of the time series data points grouping by job

count({__name__=~".+"}) by (job)

3. Install Prometheus Postgres Exporter

helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update

helm upgrade --install postgres-exporter prometheus-community/prometheus-postgres-exporter -f postgress-exporter-values.yaml

kubectl port-forward svc/postgres-exporter-prometheus-postgres-exporter 8080:80

4. Install Prometheus Mysql Exporter Dashboard

https://grafana.com/grafana/dashboards/12485-postgresql-exporter/

Add the below id as Grafana Dashboards and monitor Postgres DB 

    12485

postgres-grafana's People

Contributors

bhoopesh123 avatar

Watchers

 avatar

Forkers

tarasnon

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.