Simple Zabbix python3 script, to get values from Siemens S7 PLCs using snap7 suite and python-snap7.
Example for Zabbix server/proxy running on Centos 7:
- Download snap7 from https://sourceforge.net/projects/snap7/files/
- Install snap7:
7za x snap7-full-1.4.2.7z
sudo yum groupinstall 'Development Tools'
cd snap7-full-1.4.2/build/unix
make -f x86_64_linux.mk
sudo make -f x86_64_linux.mk install
sudo ldconfig
- Install python-snap7:
sudo python3 -m pip install python-snap7
- Copy s7_get.py to /usr/lib/zabbix/externalscripts/:
cp s7_get.py /usr/lib/zabbix/externalscripts
chmod +x /usr/lib/zabbix/externalscripts
- Test the script by running it directly from shell:
$ ./s7_get.py 172.10.1.1 0 0 66 2 int
6
Create new item:
- Type: External check
- Key:
s7_get.py[<s7_ip_address>,<s7_rack>,<s7_slot>,<DB>,<offset>,<datatype>]
, where datatype =int
,bool
orfloat
.
For example: