Skip to main content

Industrial protocols data puller

Project description

Pulr - pull devices and transform data into events

What is Pulr

Pulr is a small command-line tool, which can pull data from the device and convert it into events. Meaning the data is outputted ONLY when it's changed.

The data is always being outputted to STDOUT, you can grep it or use any pipeline processor (I use vector) to push it via HTTP, into databases etc.

Before the output, any data part can be transformed: converted, divided, multiplied, rounded and so on.

The data can be outputted as plain text or as nd-json.

pulr -F modbus.yml -L
{"id":"sensor:axon/din1.value","value":0}
{"id":"sensor:axon/din2.value","value":1}
{"id":"sensor:axon/din3.value","value":1}
{"id":"sensor:axon/din4.value","value":0}
{"id":"unit:axon/dout1.status","value":1}
{"id":"unit:axon/dout2.status","value":1}
{"id":"unit:axon/dout3.status","value":0}
{"id":"unit:axon/dout4.status","value":0}
{"id":"unit:axon/aout.value","value":0.00619}
{"id":"sensor:axon/ain.value","value":5.2045}
{"id":"unit:tests/u1.status","value":0}
{"id":"unit:tests/u2.status","value":0}

Installing

pip3 insall pulr
# for SNMP support
pip3 install python3-netsnmp
# for Modbus
pip3 install pymodbus
# optionally, install rapidjson to make JSON output faster
pip3 install python-rapidjson

Ethernet/IP support requires libplctag, download and install it:

git clone https://github.com/libplctag/libplctag
cd libplctag
cmake CMakeLists.txt
make
sudo make install
sudo ldconfig

Configuring

Look in ./examples for the example configurations.

How does it work

One Pulr instance pulls one piece of the hardware equipment. The goal is to pull and process the data as fast as possible, but die as soon as any errors occur. Pulr is built to be started by supervisor, which collects the data from it and restarts the process on crashes.

But it's possible to run the tool with "-R" flag, which tells Pulr to restart the main loop in case of failures.

Is it fast enough?

Pulr is written in Python, but it's written to be fast enough (e.g. Modbus devices can be pulled up to 50 times per second without any problem).

Pulr code is written to be easily transformed to Rust or Golang, I plan to do this very soon.

Protocols

Currently supported:

  • Modbus (TCP/UDP)
  • SNMP (v1/v2)
  • Ethernet/IP (Allen Bradley-compatible, experimental)

Data transformers

  • speed - calculate value growing speed, useful for SNMP interface counters
  • multiply, divide, round
  • bit2int - convert boolean bits into integers (1/0)
  • int2bit - convert integers (any value/0) into boolean bits (true/false)

Output type

  • text - output the data as plain text, default
  • ndjson - output the data as newline delimited JSON
  • csv - comma-separated values
  • eva/datapuller - specific type for EVA ICS

Optional field "time-format" adds time to data output. Valid values are: "iso", "timestamp".

Bugs, feature requests, patches

You are welcome. For the patches, please avoid Python-specific coding style (e.g. function kwargs), as Python version will be rewritten very soon.

Just:

  • Outputs. No outputs are planned, except STDOUT. Use pipeline converters.

  • Pulling more than one device simultaneously. Isn't planned, start another Pulr process instead.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pulr-0.1.8.tar.gz (12.7 kB view details)

Uploaded Source

File details

Details for the file pulr-0.1.8.tar.gz.

File metadata

  • Download URL: pulr-0.1.8.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

File hashes

Hashes for pulr-0.1.8.tar.gz
Algorithm Hash digest
SHA256 f0b59a14b19e0184169d01555a252597ec2478aea7a43f5f786a1c935948395b
MD5 7e9585c184d71d470715da1299696ef0
BLAKE2b-256 5acb8549c314988b35f648eebc6fe2b3211203f6a84de833252e159fed5821c8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page