Skip to content

tedsluis/dsm-prometheus-grafana

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

De Slimme meter uitlezen met prometheus en grafana

  • dsm-exporter (de slimme meter exporter gotsmart)
  • prometheus
  • node-exporter
  • grafana
  • alertmanager (alerts to slack)
  • karma
  • cadvisor
  • haproxy
  • haproxy-exporter
  • blackbox
  • influxdb (voor toevoegen buitentemperatuur, fijnstof en luchtvochtigheid)
  • p2000 exporter
                           /-----------------------------------------------------------------------------<
                           |            -------------------------------------------------------------
                           \            |                                                           |
  /------------------------->---9090--->|                     prometheus                            |
 /                                      |                                                           |
 |                                      -------------------------------------------------------------
 |                                         V     V     V     V     V     V     V     V     V     V
 |                                         |     |     |     |     |     |     |     |     |     |
 |                                         |     |     |     |     |     |     |     |     |     |
 |     --------------------               /      |     |     |     |     |     |     |     |     |
 \----<|   alertmanager   |<---9093------<--------------------------------------------------------------<    
 |     --------------------               \      |     |     |     |     |     |     |     |     |
 |                                        |      |     |     |     |     |     |     |     |     |
 |     --------------------               |      |     |     |     |     |     |     |     |     |
 |     |                  |>--------------/      /     |     |     |     |     |     |     |     |
 \----<|     karma        |                     /      |     |     |     |     |     |     |     |
 |     |                  |<---8081------------<--------------------------------------------------------<
 |     --------------------                            |     |     |     |     |     |     |     |
 |                                                     /     |     |     |     |     |     |     |
 |     --------------------                           /      |     |     |     |     |     |     |
 \----<|    grafana       |<---3000------------------<--------------------------------------------------<
       --------------------                                  |     |     |     |     |     |     |
                                                             /     |     |     |     |     |     |
       --------------------                                 /      |     |     |     |     |     |
       |  node-exporter   |<---9100------------------------<--------------------------------------------<
       --------------------                                        |     |     |     |     |     |                      
                                                                   /     |     |     |     |     |
       --------------------                                       /      |     |     |     |     |
       |   pushgateway    |<---9091------------------------------<--------------------------------------<
       --------------------                                              |     |     |     |     |
                                                                         /     |     |     |     |
       --------------------                                             /      |     |     |     |
       |    blackbox      |<---9115------------------------------------<--------------------------------<
       --------------------                                                    |     |     |     |
                                                                               /     |     |     |
       --------------------                                                   /      |     |     |
       |                  |<---9101------------------------------------------<--------------------------<
       | haproxy-exporter |                                                          |     |     |
       |                  |>---------------------------------\                       |     |     |
       --------------------               --------           |                       |     |     |
                                          |      |           /                       |     |     |
                                          |      |<---9000--<-------------------------------------------<
                                          |      |                                   |     |     |
                                          |      |                                   /     |     |
       --------------------               |   h  |                                  /      |     |
       |    cadvisor      |<---8082------<|   a  |<---8442-------------------------<--------------------<
       --------------------               |   p  |                                         |     |
                                          |   r  |                                         /     |
       --------------------               |   o  |                                        /      |
       |   dsm-exporter   |<---8080------<|   x  |<---8440-------------------------------<--------------<
       --------------------               |   y  |                                               |
                                          |      |                                               /
       --------------------               |      |                                              /
       |  p2000-exporter  |<---8080------<|      |<---2443-------------------------------------<--------<
       --------------------               |      |
                                          --------

Deployed on

  • lenovo T580 & fedora 35 - x86
  • raspberry pi 4 & fedora 35 - aarch64

Requierments

  • openssl key pair (public and private key)

On the source host:

  • some_user (for example tedsluis)
  • private key in /home/some_user/.ssh/
  • pip install ansible
  • ansible-galaxy collection install containers.podman
  • P1 cable connected to slimme meter

On the target host:

  • ansible user
  • permissions for ansible user to become root without password
  • public key in /home/ansible/.ssh/authorized_keys

Source and target host can be the same!

Prepare deployment

Replace the secrets in roles/dsm/defaults/main.yml with your own. This can be plain text (not recommended) or using ansible-vault encrypted secrets. (Be sure you store your own encryption key in /home/some_user/.vault_pass.txt while using ansible-vault)

$ ansible-vault encrypt_string 'mypassword' -n _privatekey_passphrase
_privatekey_passphrase: !vault |
          $ANSIBLE_VAULT;1.1;AES256
          61613566393936313337636339663961346435663330643034656632336265313938373436306634
          3339623864386531633637643935353433343766366433350a383365376235303434313233616632
          33303065393838346130383264386539656231303866653336353231373636386266633034633161
          3839613236366138310a356435613931636466613033306436336561393163636135386363383230
          3838
Encryption successful

ansible all -m shell -a 'echo "{{_privatekey_passphrase}}"' -e@roles/dsm/defaults/main.yml

deploy

# ansible-playbook -b -l dsm deploy-dsm.yaml 

End points

service direct access access using haproxy
alertmanager https://dsm:9093
https://dsm:9093/metrics
blackbox https://dsm:9115
https://dsm:9115/config
https://dsm:9115/metrics
cadvisor http://dsm:8082 https://dsm:8442
http://dsm:8082/metrics https://dsm:8442/metrics
dsm exporter http://dsm:8080 https://dsm:8440
http://dsm:8080/metrics https://dsm:8440/metrics
grafana https://dsm:3000
https://dsm:3000/metrics
haproxy exporter https://dsm:9000
https://dsm:9101
https://dsm:9101/metrics
influxdb https://dsm:8086
karma https://dsm:8081
https://dsm:8081/metrics
node exporter https://dsm:9100
https://dsm:9100/metrics
prometheus https://dsm:9090
https://dsm:9090/metrics
pushgateway https://dsm:9091
https://dsm:9091/metrics
p2000 exporter http://dsm:2000/metrics http://dsm:2443/metrics
http://dsm:2000/config http://dsm:2443/config

debug USB to serial cable to connect to the smart meter

root@dsm ~]# ll /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_AC2YPOKN-if00-port0
lrwxrwxrwx. 1 root root 13 Nov  4 01:00 /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_AC2YPOKN-if00-port0 -> ../../ttyUSB0

root@dsm ~]# chmod 666 /dev/ttyUSB0
root@dsm ~]# stty -F /dev/ttyUSB0 115200

[root@dsm ~]# cat < /dev/ttyUSB0 
-1012

1-3:0.2.8(50)
0-0:1.0.0(211119173247W)
0-0:96.1.1(4530303433303037303435303838353138)
1-0:1.8.1(006462.887*kWh)
1-0:1.8.2(007905.585*kWh)
1-0:2.8.1(000000.000*kWh)
1-0:2.8.2(000000.000*kWh)
0-0:96.14.0(0002)
1-0:1.7.0(00.173*kW)
1-0:2.7.0(00.000*kW)
0-0:96.7.21(00009)
0-0:96.7.9(00003)
1-0:99.97.0(1)(0-0:96.7.19)(200420123608S)(0000000430*s)
1-0:32.32.0(00126)
1-0:32.36.0(00001)
0-0:96.13.0()
1-0:32.7.0(224.0*V)
1-0:31.7.0(001*A)
1-0:21.7.0(00.209*kW)
1-0:22.7.0(0/ISK5\2M550E-1012

resources

grafana dashboards

screenshots

dashboard1

dashboard2

dashboard

dashboard4

dashboard5

dashboard6

dashboard7

dashboard8

dashboard9

dashboard10

dashboard11

dashboard12

dashboard13