State metrics

Why should I report states?

Use states to monitor the health of the device monitored by ActiveGate plugin.

Defining states

See an example of the state definition in JSON:

JSON essential
Download
{
	"name": "custom.remote.python.my_plugin",
	"version": "1.001",
	"type": "python",
	"entity": "CUSTOM_DEVICE",
	"processTypeNames": ["PYTHON"],
	"technologies": ["example technology"],
	"source": {
		"package": "my_plugin",
		"className": "MyPlugin",
		"activation": "Remote"
	},
	"metrics": [
		{
			"entity": "CUSTOM_DEVICE", 
			"statetimeseries": {
				"key": "my_state",
				"states": ["OK", "Troubles", "Bad"],
				"dimensions": [],
				"displayname": "My status"
		}}
	]
}

Reporting states

See how to make your plugin send the states:

How to report cluster
Download
from ruxit.api.base_plugin import RemoteBasePlugin

class MyPlugin(RemoteBasePlugin):
    def query(self, **kwargs):
        group = self.topology_builder.create_group("My group1", "My group1")
        device = group.create_element("My device1", "My device1")
        device.state_metric("my_state", "OK")