WinCC OA Docker Image with InfluxDB & Grafana …on a Mac…

On a Mac install the Docker Toolbox.

https://www.docker.com/docker-toolbox

And click on the “DOCKER CLI”

Screen Shot 2015-12-07 at 11.37.49

The type: docker run -d -p 3000:3000 –name oa1 vogler/winccoa:influxdb startup

Afterwards you will see your new container and at the preview you can already see the Grafana dashboard, click on it and it will open in your browser.

Screen Shot 2015-12-07 at 11.41.24

Screen Shot 2015-12-07 at 16.31.58

You have now a running WinCC OA system which is logging some datapoints to the InfluxDB. There is a simple simulation script running which will set random values to Drive1.*

To open the GEDI you have to go to the DOCKER CLI again and type:

bash-3.2$ docker exec -ti oa1 /bin/bash

You now have a bash in the WinCC OA Container. Set the DISPLAY variable to your client (mac). You need a X-Windows-Server on your client (and allow clients to open windows with “xhost +”). At the Mac you may use xquartz: http://www.xquartz.org

dba3d5e6193f:/ # export DISPLAY=macbookpro:0

dba3d5e6193f:/ # gedi &

Screen Shot 2015-12-07 at 11.48.47or type “console”, it will open the WinCC OA Console.

The NoSQL Logger’s configuration file is: /proj/NoSQL/config/config.logger

There you can set the query part of what you wanna log into the InfluxDB. You can specify the FROM clause of a WinCC OA query, also remote queries are possible (if you connect another OA system to this system (distributed system)).

Then you have to restart the NoSQL Database Logger – it is the WCCOAjava program you see in the console. Right, it is implemented in Java with a native API to WinCC OA.

Screen Shot 2015-12-07 at 11.51.44

Grafana can be used to create dashboards in a fast and easy way…

Screen Shot 2015-12-07 at 17.09.13

Docker Image for WinCC OA…

I pushed a docker image for WinCC OA to the docker hub.

docker pull vogler/winccoa

It is based on opensuse and WinCC OA 3.13 P009.

At the first startup it will ask for a system number and the system name.

root@debian1:~# docker run -t -i –name=oa1 vogler/winccoa startup
Please enter your desired system name and system number…
sysnum? 1
sysname? oa1
Do you wish to set the project to oa1 with num 1?
1) Yes
2) No
#? 1

It will set the system number and the system name of the project. The projectname itself is currently always “WinCCOA”, but this does not matter, because every WinCC OA project will run in a seperate container.

To startup the container and the WinCC OA project, type:

root@debian1:~# docker start oa1

To enter the container:

docker exec -it oa1 bash

 

To get the ip of the container:

4304c34d368e:/ # ifconfig
eth0 Link encap:Ethernet HWaddr 02:42:AC:11:00:02
inet addr:172.17.0.2 Bcast:0.0.0.0 Mask:255.255.0.0

To connect from a client to your container OA system you can expose ports from the container to the docker host (by using -p <source-port>:<destination-port> option at docker run…) or you may want to add a route to the bridged container network, in my case the bridged network is 172.17.0.0. On a Windows client you can add a route (192.168.1.115 is my Docker-Host-Ip):

route add 172.17.0.0 mask 255.255.255.0 192.168.1.115

for linux: route add -net 172.17.0.0 netmask 255.255.255.0 gw 192.168.1.115

Then you are able to ping your docker container network 172.17.0.2 from your client network (eg. 192.168.1.x) and so you are able to connect a WinCC OA client to the docker container project.

To start the WinCC OA console or the project administration enter the container (as shown before) and set the DISPLAY variable to your client (where you have to run a X-Window-System) and then you can start the console “startConsole”…

Hadoop OpenTSDB timeseries database and Grafana with WinCC OA…

Forwarding events from WinCC OA to OpenTSDB, which is based on HBase. Based on OpenTSDB Grafan can be used to build cool dashboards in a very fast way.

Live Example (my photovoltaic data) : http://82.149.127.81/grafana

On my test environment (i7 with 32gb RAM and 8 threads) i was able to push about 20000(!) values per second from my WinCC OA system to my Hadoop/HBase cluster. WinCC OA and the Hadoop Cluster are running on Hyper-V.

Grafana

Monitoring WinCC OA detected failures…

By monitoring the CPU load of my Oracle Database and the RDB-Buffer-Blocks i was able to detect a relationship … after some time the RDB Manager is not able to write data anymore and restarts…  seems to be an Oracle Problem… i should add more WinCC OA metrics…

CPU-Monitoring

 

DDE: Problem Key ‘ORA 600 [peshmgel: Table size]’ was completely flood controlled (0x6)
Further messages for this problem key will be suppressed for up to 10 minutes
Errors in file /app/oracle/diag/rdbms/cdb/cdb/trace/cdb_ora_50519.trc (incident=223091) (PDBNAME=PVSS):
ORA-00600: internal error code, arguments: [26599], [1], [150], [], [], [], [], [], [], [], [], []
Incident details in: /app/oracle/diag/rdbms/cdb/cdb/incident/incdir_223091/cdb_ora_50519_i223091.trc
Use ADRCI or Support Workbench to package the incident.

Oracle Inmemory Database (and materialized view)…

# turn on the inmemory option (it’s part of the SGA, so get sure that the SGA is big enought)

alter system set inmemory_size=1G scope=spfile;

One gigabyte seems to be less, but inmemory tables are stored column oriented. so, Oracle uses also compression .. for example i loaded a table with 1.2 Mio Rows (but only 5 columns) and i just needed ~30MB (in)memory.

# create a materialized view which is refreshd every 5 minutes

create materialized view sma_ext_5min_snp
refresh complete start with (sysdate) next (sysdate+5/24/60) with rowid
as select * from sma_ext_5min;

# put the materialized view table into memory
alter table sma_ext_5min_snp inmemory;

# check the inmemory state of the materialized view (table)

SELECT table_name, inmemory, inmemory_priority, inmemory_distribute, inmemory_compression, inmemory_duplicate FROM user_tables WHERE table_name = ‘SMA_EXT_5MIN_SNP’

# access the view so that it will be loaded into memory (default is load on use)

select count(*) from sma_ext_5min_snp;

# check if it is loaded into memory:

select * from v$im_segments

How to send alerts to an Android App by push notifications…

With the new WinCC OA version 3.13 it is very easy to use webservices. A simple example is to send alerts to an app (Android, iOS, Windows) by push notifications (powered by Windows Azure Cloud).

 

All you need is:

* Download a panel: http://rocworks.at/share/rocworks.pnl

* Download an Android-App: http://rocworks.at/share/rocworks.apk

* Android Barcode Scanner: https://play.google.com/store/apps/details?id=com.google.zxing.client.android

* Start the panel and scan the QR-Code with the App (top right menu button “scan”)

* You can create your own distribution channel with a click on “create new QR code” in the panel and scan it with your phone(s).

 

This is just a demo. It is not safe and not secure.

You can use and adapt the panel as you want.

No guarantee about the availability of the cloud service.

 

Panel

 

Screenshot_2014-12-18-18-08-14