Define and report state metrics

Use states to understand the health of any device monitored by an ActiveGate plugin.

Define states

See this example of 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"
		}}
	]
}

Report states

See how to make your plugin send state information:

How to report device groups
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")