What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

Can PRTG monitor Socomec Diris Power Meter?

Votes:

4

The Socomec Diris A40/A41 power meter is freqently used to monitor building power distribution systems. It can be fitted with a Modbus over TCP module that provides a web interface and modbus access to the measured power values. Device overview: http://www.socomec.de/reihe-multifunktionsmessgerate-einzelne-abgange_de.html?product=/diris-a40_de.html The address table is available here: http://www.socomec.de/files/live/sites/systemsite/files/SCP/6_gestion_energie/diris/diris_a40/536181B_GB_Ethernet.pdf Can this device be monitored with PRTG?

diris modbus powermeter socomec

Created on Sep 20, 2016 7:14:15 AM



3 Replies

Accepted Answer

Votes:

10

The following script allows reading a number of values from the Socomed Diris A40 device with modbus over TCP module. It is used in a custom exe/xml sensor and gives us a nice overview over the load distribution over the three phases and the power consumption of our company building. I am no powershell pro, so feel free to optimize my code and post a reply. :-)

# Script to monitor the Socomec Diris A40 power meter with PRTG 
#
# Requires a modbus over TCP module attached to the A40 and the modpoll.exe command line tool
# from http://www.modbusdriver.com/modpoll.html
# 
# The meter is created as a standard device in PRTG, this script is used as a custom exe/xml sensor for the device.
#
# Monitored are power consumption, current on each phase, frequency and voltages. Other values are available, see documentation: 
# http://www.socomec.de/files/live/sites/systemsite/files/SCP/6_gestion_energie/diris/diris_a40/536181B_GB_Ethernet.pdf 
#
# This script has only been tested with a German Windows OS - output of modpoll.exe might have to be reformatted 
# if other languages are used!


#Parameters of power meter socomec diris
$SlaveIP=$env:prtg_host
$SlaveID=255
$ReadAddress=50512

#set Variables
$prtgresult=""
$value1=""
$value2=""
$value3=""
$value4=""
$value5=""
$value6=""
$value7=""
$value8=""
$value9=""
$value10=""
$value11=""
$value12=""

#get results from instrument via modbus poll http://www.modbusdriver.com/modpoll.html

cd "C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML"
$Response = @(.\modpoll.exe -m tcp -a $SlaveID -r $ReadAddress -c 56 -t 4 -1 -0 $SlaveIP)|Select-Object -Skip 10
$Response[3,5,7]|write-host

#Calculate result values
$value1=$Response[33].Split(':')
$value1=[int]$value1[1]/100
$value2=$Response[35].Split(':')
$value2=[int]$value2[1]/100
$value3=$Response[37].Split(':')
$value3=[int]$value3[1]/100
$value4=$value1+$value2+$value3
$value5=$Response[9].Split(':')
$value5=[int]$value5[1]/100
$value6=$Response[11].Split(':')
$value6=[int]$value6[1]/100
$value7=$Response[13].Split(':')
$value7=[int]$value7[1]/100
$value8=$Response[3].Split(':')
$value8=([int]$value8[1]+65536)/100
$value9=$Response[5].Split(':')
$value9=([int]$value9[1]+65536)/100
$value10=$Response[7].Split(':')
$value10=([int]$value10[1]+65536)/100
$value11=$Response[15].Split(':')
$value11=[int]$value11[1]/100


#build header for PRTG XML-output

$prtgresult+="<?xml version=""1.0"" encoding=""Windows-1252"" ?>`r`n"
$prtgresult+="<prtg>`r`n"

#build PRTG results data

		$prtgresult+="    <result>`r`n"
		$prtgresult+="        <channel>Leistung L1</channel>`r`n"
		$prtgresult+="        <value>$value1</value>`r`n"
		$prtgresult+="        <float>1</float>`r`n"
		$prtgresult+="        <unit>custom</unit>`r`n"
		$prtgresult+="        <customunit>kW</customunit>`r`n"
        $prtgresult+="        <mode>absolute</mode>`r`n"
        $prtgresult+="    </result>`r`n"
		
        $prtgresult+="    <result>`r`n"
		$prtgresult+="        <channel>Leistung L2</channel>`r`n"
		$prtgresult+="        <value>$value2</value>`r`n"
		$prtgresult+="        <float>1</float>`r`n"
		$prtgresult+="        <unit>custom</unit>`r`n"
		$prtgresult+="        <customunit>kW</customunit>`r`n"
        $prtgresult+="    </result>`r`n"

        $prtgresult+="    <result>`r`n"
		$prtgresult+="        <channel>Leistung L3</channel>`r`n"
		$prtgresult+="        <value>$value3</value>`r`n"
		$prtgresult+="        <float>1</float>`r`n"
		$prtgresult+="        <unit>custom</unit>`r`n"
		$prtgresult+="        <customunit>kW</customunit>`r`n"
        $prtgresult+="    </result>`r`n"
	
        $prtgresult+="    <result>`r`n"
		$prtgresult+="        <channel>Leistung gesamt</channel>`r`n"
		$prtgresult+="        <value>$value4</value>`r`n"
		$prtgresult+="        <float>1</float>`r`n"
		$prtgresult+="        <unit>custom</unit>`r`n"
		$prtgresult+="        <customunit>kW</customunit>`r`n"
        $prtgresult+="    </result>`r`n"
        
        $prtgresult+="    <result>`r`n"
		$prtgresult+="        <channel>Spannung N-L1</channel>`r`n"
		$prtgresult+="        <value>$value5</value>`r`n"
		$prtgresult+="        <float>1</float>`r`n"
		$prtgresult+="        <unit>custom</unit>`r`n"
		$prtgresult+="        <customunit>V</customunit>`r`n"
        $prtgresult+="    </result>`r`n"

        $prtgresult+="    <result>`r`n"
		$prtgresult+="        <channel>Spannung N-L2</channel>`r`n"
		$prtgresult+="        <value>$value6</value>`r`n"
		$prtgresult+="        <float>1</float>`r`n"
		$prtgresult+="        <unit>custom</unit>`r`n"
		$prtgresult+="        <customunit>V</customunit>`r`n"
        $prtgresult+="    </result>`r`n"

        $prtgresult+="    <result>`r`n"
		$prtgresult+="        <channel>Spannung N-L3</channel>`r`n"
		$prtgresult+="        <value>$value7</value>`r`n"
		$prtgresult+="        <float>1</float>`r`n"
		$prtgresult+="        <unit>custom</unit>`r`n"
		$prtgresult+="        <customunit>V</customunit>`r`n"
        $prtgresult+="    </result>`r`n"

        $prtgresult+="    <result>`r`n"
		$prtgresult+="        <channel>Spannung L1-L2</channel>`r`n"
		$prtgresult+="        <value>$value8</value>`r`n"
		$prtgresult+="        <float>1</float>`r`n"
		$prtgresult+="        <unit>custom</unit>`r`n"
		$prtgresult+="        <customunit>V</customunit>`r`n"
        $prtgresult+="    </result>`r`n"

        $prtgresult+="    <result>`r`n"
		$prtgresult+="        <channel>Spannung L2-L3</channel>`r`n"
		$prtgresult+="        <value>$value9</value>`r`n"
		$prtgresult+="        <float>1</float>`r`n"
		$prtgresult+="        <unit>custom</unit>`r`n"
		$prtgresult+="        <customunit>V</customunit>`r`n"
        $prtgresult+="    </result>`r`n"

        $prtgresult+="    <result>`r`n"
		$prtgresult+="        <channel>Spannung L1-L3</channel>`r`n"
		$prtgresult+="        <value>$value10</value>`r`n"
		$prtgresult+="        <float>1</float>`r`n"
		$prtgresult+="        <unit>custom</unit>`r`n"
		$prtgresult+="        <customunit>V</customunit>`r`n"
        $prtgresult+="    </result>`r`n"

        $prtgresult+="    <result>`r`n"
		$prtgresult+="        <channel>Frequenz</channel>`r`n"
		$prtgresult+="        <value>$value11</value>`r`n"
		$prtgresult+="        <float>1</float>`r`n"
		$prtgresult+="        <unit>custom</unit>`r`n"
		$prtgresult+="        <customunit>Hz</customunit>`r`n"
        $prtgresult+="    </result>`r`n"


        $prtgresult+="</prtg>"

#send data to host
Write-Host $prtgresult

Created on Sep 20, 2016 7:31:09 AM



Votes:

0

Hello msroedel, Your powershell is not that bad. It is easy to read and should also work on any PC. only a few hints.

A "Write-host" does not always write the to "Output Pipeline". So if you want to send something to the Pipeline, your should use "out-host $prtgresult" or simply "$prtgresult"

Tipp2: you can use the Parameters as what they are

param ( $SlaveIP=$env:prtg_host $SlaveID=255 $ReadAddress=50512 )

So you can specify the individuell Parameters via the PRTG ComandLine.

Created on Sep 21, 2016 10:12:40 PM



Votes:

0

Hi Frank,

thanks for your hints! Didn't notice the difference between write-host and out-host yet - though both seem to work in my scripts.

I didn't use command line parameters because the script uses a certain address range that needs to start at 50512 to make sure that the correct values are returned from the device. This address range would be the same on all similar devices if you want to monitor the intended values. Any change here would need a change in the script anyhow, as it would change the monitored values, units and channel descriptions.

Thanks again for your comments! Markus

Created on Sep 22, 2016 7:17:33 AM




Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.