Troubleshoot ActiveGate plugins

If after deploying your ActiveGate plugin the results are different from your expectations, try one of the following actions to find out what went wrong.

Browse the DESK UI

Go to the Technology overview page to verify that your ActiveGate-monitored technology is displayed on one of the tiles. If you can't find it, your device group wasn't reported by the plugin.

Click your device group. If the device group doesn't contain a device, your device wasn't reported. If there are no metrics reported in the device group, the plugin isn't sending group metrics. Note that this may be the expected behavior.

Check plugin status in the DESK UI

You can find the problems reported by a running plugin on the Monitored technologies page. Go to Settings > Monitoring > Monitored Technologies and select the Custom plugins tab. The plugins that report errors are displayed in red. Click the plugin name to see the reported errors.

Check the Remote Plugin Module logs

On Linux, logs are stored at \var\lib\DESK\remotepluginmodule\log\remoteplugin.
On Windows, logs are stored at C:/ProgramData/DESK/remotepluginmodule/log/remoteplugin. The base folder contains logs from Remote Plugin Module internals. The plugin messages are stored in subfolders. Let's use an example:

Simple example plugin
Download
import logging
from ruxit.api.base_plugin import RemoteBasePlugin

logger = logging.getLogger(__name__)

class LogPluginRemote(RemoteBasePlugin):
    def query(self, **kwargs):
        logger.info('LogPluginRemote query is called')


Simple JSON example
Download
{
	"name": "custom.remote.python.log_demo",
	"version": "1.001",
	"type": "python",
	"entity": "CUSTOM_DEVICE",
	"metricGroup": "my_log",
	"technologies": ["My Technology"],
	"source": {
		"package": "log_demo_plugin",
		"className": "LogPluginRemote",
		"activation": "Remote"
	},
	"metrics": [{
			"entity": "CUSTOM_DEVICE",
			"timeseries": {
				"key": "counter",
				"unit": "Count",
				"displayname": "Counter"
			}
		}
	]
}

The plugin creates the custom.remote.python.log_demo subfolder with the LogPluginRemote.log file where it logs the messages.

:

2019-09-17 11:20:11.911 UTC INFO [Python][17956881948133727][my_endpoint][140679152801536][ThreadPoolExecutor-0_0] - [query] LogPluginRemote query is called

2019-09-17 11:20:19.909 UTC INFO [Python][17956881948133727][my_endpoint][140679152801536][ThreadPoolExecutor-0_0] - [event_set_configuration] event_set_configuration, plugin: <RemotePluginEngine, meta_name:custom.remote.python.log_demo id:0x7ff26b36fb38> config: {}

2019-09-17 11:20:19.910 UTC INFO [Python][17956881948133727][my_endpoint][140679152801536][ThreadPoolExecutor-0_0] - [query] LogPluginRemote query is called

2019-09-17 11:21:01.950 UTC INFO [Python][17956881948133727][my_endpoint][140679144408832][ThreadPoolExecutor-0_1] - [query] LogPluginRemote query is called

The log uses the following fields:

Field example description
2019-09-17 11:21:01.950 UTC date and time in UTC
INFO log level
[Python] it's generated by Python script
[17956881948133727] endpoint id
[my_endpoint] endpoint name
[140679144408832] thread id
[ThreadPoolExecutor-0_1] thread name
[query] method name

If your plugin freezes, check the ruxitagent_pluginagent_fault_info_.log file for details. You can also find detailed information about hanged plugins with stacktrace breakdown in the ruxitagent_pluginagent_hang_info_.log file.

Create your own logs

As a last resort, you can create your own logger and log suspicious data or behavior, as shown in the examples below:

How to log in plugins
Download
from ruxit.api.base_plugin import RemoteBasePlugin
import logging

logger = logging.getLogger(__name__)

class MyRemotePlugin(RemoteBasePlugin):
    def query(self):
        logger.debug("MyPluginRemote query method")
JSON essential
Download
{
    "name": "custom.remote.python.my_remote_plugin",
    "version": "1.001",
    "type": "python",
    "entity": "CUSTOM_DEVICE",
     "metricGroup": "remote_demo",
    "processTypeNames": ["PYTHON"],
    "technologies": ["example technology"],
    "source": {
        "package": "my_remote_plugin",
        "className": "MyRemotePlugin",
        "activation": "Remote"
    }
}

Debugging

You can use a remote debugger for deep diagnosis of plugin issues.

  1. Install Eclipse with pydev or PyCharm.
  2. Copy the debugger libraries to

C:\Program Files\DESK\remotepluginmodule\agent\plugin\engine (on Windows)

or /opt/DESK/remotepluginmodule/agent/plugin/engine (on Linux).

  1. Add the following to your plugin Python code:
import pydevd

pydevd.settrace()
  1. Start the remote debugger from your developer environment and restart the Remote Plugin Module.