KWh meter setup: verschil tussen versies

Uit MakerSpace Leiden
Ga naar: navigatie, zoeken
 
(16 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]]
  
File in systemd at: /etc/systemd/system/kwh-tunnel.service:
+
The remote access to the [[KWh meter]] depends on Wireguard[[Server setup| 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]
 
     [Unit]
     Description=Tunnel to kWh meter.
+
     Description=Multi-router Traffic Grapher
     After=network.target
+
     After=syslog.target
   
+
 
 
     [Service]
 
     [Service]
     ExecStart=/usr/bin/ssh -i /etc/kwh-meter-tunnel -l dirkx -p 222 -NT \
+
    Environment=LANG=C
                -o ServerAliveInterval=60 -o ExitOnForwardFailure=yes \
+
     ExecStart=/usr/bin/mrtg --daemon
                -L 9999:192.168.6.111:80 83.163.200.191 -   
+
     Type=forking
     RestartSec=30
+
     SuccessExitStatus=0 1
     Restart=always
+
 
   
 
 
     [Install]
 
     [Install]
 
     WantedBy=multi-user.target
 
     WantedBy=multi-user.target
  
and this is received by a SSH authorized key line on the space machine:
+
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
  
    no-pty,permitopen="192.168.6.111:80" ssh-rsa AAAAB3NzaC1yc2EA....NFlObjqxPGezJYI0wMNlI9XiP purely-the-tunnel to the kWh meter
+
Webserver config in ```/etc/apache2/sites-enabled/mrtg.conf```
  
With localhost:9999 mapped in the CRM for those that need access.
+
      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>