KWh meter setup: verschil tussen versies

Uit MakerSpace Leiden
Ga naar: navigatie, zoeken
(Nieuwe pagina aangemaakt met 'The remote display depends on a SSH tunnel on the MTA: ``` # File: /etc/systemd/system/kwh-tunnel.service [Unit] Description=Tunnel to kWh meter. Aft...')
 
 
(20 tussenliggende versies door 3 gebruikers niet weergegeven)
Regel 1: Regel 1:
The remote display depends on a SSH tunnel on the [[MTA-Setup|MTA]]:
+
[[Category:Servers network & websites]]
  
```
+
The remote access to the [[KWh meter]] depends on Wireguard[[Server setup| Wireguard]] and the kWh meter having a fixed IP.
# File: /etc/systemd/system/kwh-tunnel.service
 
[Unit]
 
Description=Tunnel to kWh meter.
 
After=network.target
 
  
[Service]
+
* IP address: 192.168.6.111
ExecStart=/usr/bin/ssh -i /etc/kwh-meter-tunnel -l dirkx -p 222 -NT -o ServerAliveInterval=60 -o ExitOnForwardFailure=yes -L 9999:192.168.6.111:80 83.163.200.191 -
+
* Port: 161 (snmp)
 +
* Protocol: SNMPv2 public/community string standard
  
RestartSec=30
+
= MRTG setup =
Restart=always
 
  
[Install]
+
This should be fixed - i.e. not run as root !!
WantedBy=multi-user.target
+
 
root@makerspaceleiden:/etc/sy
+
    [Unit]
````
+
    Description=Multi-router Traffic Grapher
 +
    After=syslog.target
 +
 
 +
    [Service]
 +
    Environment=LANG=C
 +
    ExecStart=/usr/bin/mrtg --daemon
 +
    Type=forking
 +
    SuccessExitStatus=0 1
 +
 
 +
    [Install]
 +
    WantedBy=multi-user.target
 +
 
 +
Config file:
 +
 
 +
      # This file is for use with mrtg-2.5.4c
 +
      WorkDir: /var/www/mrtg
 +
      WriteExpires: Yes
 +
                 
 +
      Title[L1]: Phase 1 power
 +
      PageTop[L1]: <H1>L1</H1>
 +
      Target[L1]: 1.3.6.1.4.1.31034.2.8.1.5.1&1.3.6.1.4.1.31034.2.8.1.5.1:public@IPKWHMETER:161
 +
      MaxBytes[L1]: 50000
 +
      YLegend[L1]: Ampere
 +
      ShortLegend[L1]: A
 +
      Options[L1]: gauge,nopercent,noo
 +
      Factor[L1]: 0.01
 +
      YTicsFactor[L1]: 0.01
 +
     
 +
      Title[L2]: Phase 2 power
 +
      PageTop[L2]: <H1>L2</H1>
 +
      Target[L2]: 1.3.6.1.4.1.31034.2.8.1.5.2&1.3.6.1.4.1.31034.2.8.1.5.2:public@IPKWHMETER:161
 +
      MaxBytes[L2]: 50000
 +
      YLegend[L2]: Ampere
 +
      ShortLegend[L2]: A
 +
      Options[L2]: gauge,nopercent,noo
 +
      Factor[L2]: 0.01
 +
      YTicsFactor[L2]: 0.01
 +
     
 +
      Title[L3]: Phase 3 power
 +
      PageTop[L3]: <H1>L3</H1>
 +
      Target[L3]: 1.3.6.1.4.1.31034.2.8.1.5.3&1.3.6.1.4.1.31034.2.8.1.5.3:public@IPKWHMETER:161
 +
      MaxBytes[L3]: 50000
 +
      YLegend[L3]: Ampere
 +
      ShortLegend[L3]: A
 +
      Options[L3]: gauge,nopercent,noo
 +
      Factor[L3]: 0.01
 +
      YTicsFactor[L3]: 0.01
 +
     
 +
      Title[Power]: Power
 +
      PageTop[Power]: <H1>Power</H1>
 +
      Target[Power]: 1.3.6.1.4.1.31034.2.8.1.5.1&1.3.6.1.4.1.31034.2.8.1.5.1:public@IPKWHMETER:161 + 1.3.6.1.4.1.31034.2.8.1.5.2&1.3.6.1.4.1.31034.2.8.1.5.2:public@IPKWHMETER:161 + 1.3.6.1.4.1.31034.2.8.1.5.3&1.3.6.1.4.1.31034.2.8.1.5.3:public@IPKWHMETER:161
 +
      MaxBytes[Power]: 200000
 +
      YLegend[Power]: Ampere
 +
      ShortLegend[Power]: A
 +
      Options[Power]: gauge,nopercent,noo
 +
      Factor[Power]: 0.01
 +
      YTicsFactor[Power]: 0.01
 +
 
 +
Webserver config in ```/etc/apache2/sites-enabled/mrtg.conf```
 +
 
 +
      Alias /mrtg      /var/www/mrtg
 +
     
 +
      DirectoryIndex index.html
 +
      <Directory /var/www/mrtg>
 +
      Options All +Indexes
 +
      order deny,allow
 +
      allow from all
 +
      Require all granted
 +
      </Directory>

Huidige versie van 26 mrt 2025 om 17:02


The remote access to the KWh meter depends on Wireguard Wireguard and the kWh meter having a fixed IP.

  • IP address: 192.168.6.111
  • Port: 161 (snmp)
  • Protocol: SNMPv2 public/community string standard

MRTG setup

This should be fixed - i.e. not run as root !!

   [Unit]
   Description=Multi-router Traffic Grapher
   After=syslog.target
   [Service]
   Environment=LANG=C
   ExecStart=/usr/bin/mrtg --daemon 
   Type=forking
   SuccessExitStatus=0 1
   [Install]
   WantedBy=multi-user.target

Config file:

     # This file is for use with mrtg-2.5.4c
     WorkDir: /var/www/mrtg
     WriteExpires: Yes
                 
     Title[L1]: Phase 1 power
     PageTop[L1]: <H1>L1</H1>
     Target[L1]: 1.3.6.1.4.1.31034.2.8.1.5.1&1.3.6.1.4.1.31034.2.8.1.5.1:public@IPKWHMETER:161
     MaxBytes[L1]: 50000
     YLegend[L1]: Ampere
     ShortLegend[L1]: A
     Options[L1]: gauge,nopercent,noo
     Factor[L1]: 0.01
     YTicsFactor[L1]: 0.01
     
     Title[L2]: Phase 2 power
     PageTop[L2]: <H1>L2</H1>
     Target[L2]: 1.3.6.1.4.1.31034.2.8.1.5.2&1.3.6.1.4.1.31034.2.8.1.5.2:public@IPKWHMETER:161
     MaxBytes[L2]: 50000
     YLegend[L2]: Ampere
     ShortLegend[L2]: A
     Options[L2]: gauge,nopercent,noo
     Factor[L2]: 0.01
     YTicsFactor[L2]: 0.01
     
     Title[L3]: Phase 3 power
     PageTop[L3]: <H1>L3</H1>
     Target[L3]: 1.3.6.1.4.1.31034.2.8.1.5.3&1.3.6.1.4.1.31034.2.8.1.5.3:public@IPKWHMETER:161
     MaxBytes[L3]: 50000
     YLegend[L3]: Ampere
     ShortLegend[L3]: A
     Options[L3]: gauge,nopercent,noo
     Factor[L3]: 0.01
     YTicsFactor[L3]: 0.01
     
     Title[Power]: Power
     PageTop[Power]: <H1>Power</H1>
     Target[Power]: 1.3.6.1.4.1.31034.2.8.1.5.1&1.3.6.1.4.1.31034.2.8.1.5.1:public@IPKWHMETER:161 + 1.3.6.1.4.1.31034.2.8.1.5.2&1.3.6.1.4.1.31034.2.8.1.5.2:public@IPKWHMETER:161 + 1.3.6.1.4.1.31034.2.8.1.5.3&1.3.6.1.4.1.31034.2.8.1.5.3:public@IPKWHMETER:161
     MaxBytes[Power]: 200000
     YLegend[Power]: Ampere
     ShortLegend[Power]: A
     Options[Power]: gauge,nopercent,noo
     Factor[Power]: 0.01
     YTicsFactor[Power]: 0.01

Webserver config in ```/etc/apache2/sites-enabled/mrtg.conf```

     Alias /mrtg      /var/www/mrtg
     
     DirectoryIndex index.html
     <Directory /var/www/mrtg>
     Options All +Indexes
     order deny,allow
     allow from all
     Require all granted
     </Directory>