Showing results for 
Search instead for 
Did you mean: 
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

Axeda: How to monitor concurrent user logins on the Axeda Platform

No ratings

This article explains how to monitor concurrent user logins on the Axeda Platform. Its going to do this by creating an asset to monitor the solution. This asset will have a dataitem that tracks the users logged in. You can use this dataitem to trend usage during the day, or calculate the max per day. Or you could alarm if the number of users goes over some limit.

The following needs to be created on your Platform :
A model named “Monitor”, containing an analog DataItem named “userlogins” and an asset named “Metrics” This asset will receive the values.

Expression Rule:

Create two expression rules that update the number of users, triggered on user login or logout:

Name : UserLoginMonitor

Type: Userlogin and Userlogout (two rules required)

IF:     true

THEN: ExecuteCustomObject(“getUserLogins”,

This calls a script and passes in  = The total number of users that are logged into the system (Concurrently).

Groovy Script (Custom Object)

Now, the next step is to write a Groovy Script (Custom Object)
You can copy and paste the following code into your Groovy script.

Give the script a name : getUserLogins

This script also has a parameter named logins

import com.axeda.drm.sdk.device.DataItem;

import com.axeda.drm.sdk.device.Device;

import com.axeda.drm.sdk.Context

import com.axeda.drm.sdk.device.DataItemFinder;

import com.axeda.drm.sdk.device.ModelFinder;

import com.axeda.drm.sdk.device.DeviceFinder;


import com.axeda.drm.sdk.device.Model;



def logins= parameters.logins

def ctx = Context.create()

def mod = loadModel("Monitor",ctx)

def dev = loadDevice("Metrics",mod,ctx)

DataItemFinder dif = new DataItemFinder(ctx)



DataItem di = dif.find()

DataValueEntry dve = new DataValueEntry(ctx, dev, di, logins)

    public void setDataItem(String dataItemName, Integer dataItemValue, Device device, Context context)


        DataItemFinder dif = new DataItemFinder(ctx);



        DataItem di = dif.find();

        DataValueEntry dve = new DataValueEntry(ctx, dev, di, newValue)


    public DataValue findCurrentDataItemValue(Device device, String dataItemName,Context ctx)


        CurrentDataFinder cdFinder =  new CurrentDataFinder(ctx,device);

        DataValue dv = cdFinder.find(dataItemName);

        return dv;


    public DataItem loadDataItem(Model model,String dataItemName, Context ctx)


        DataItemFinder iFinder = new DataItemFinder(ctx);



        return iFinder.find();


    public Model loadModel(String modelNumber, Context ctx)


        ModelFinder mf = new ModelFinder(ctx);


        return mf.find();


    public Device loadDevice(String serialNumber,Model model, Context context ) {

        DeviceFinder df = new DeviceFinder(context);



        return df.find();


Whenever a user logs into the Axeda Platform, the Metrics asset will show the concurrent number of logged in users in the Platform. This dataitem can be graphed to see the pattern of usage.

If you wanted to take action based on the number of users, create an expression rule to alarm when a threshold is reached. This rule should be associated with the model "Monitor".

Name : LoginsCheck

Type: Data

IF:     userlogins > 40

THEN: CreateAlarm("Login limit", 100, str(userlogins)+" users")

Now an alarm is created each time too many users are logged in. An alarm can be used for notifications or viewed on the Monitor asset.

Version history
Last update:
‎Jun 01, 2016 10:45 AM
Updated by:
Labels (1)
Tags (2)