State metrics

Extensions 1.0 end of life

OneAgent and ActiveGate version 1.299 are the last versions supporting OneAgent and ActiveGate Extensions 1.0 framework. You can continue using Extensions 1.0 if you stay at OneAgent or ActiveGate version 1.299. Note that this means you'll be using an unsupported Python version 3.8. We strongly recommend migrating your extensions to the latest Extensions 2.0 framework.

For more information, see General guidance and how to migrate.

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

Define states

See this example of state definition in JSON:

{
"name": "custom.remote.python.my_plugin",
"version": "1.001",
"type": "python",
"entity": "CUSTOM_DEVICE",
"metricGroup": "my_plugin",
"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 state"
}
}
],
"ui": {
"keymetrics": [
{
"key": "my_state",
"displayname": "My state",
"statemetric": true
}
],
"charts": [
{
"group": "States",
"title": "My state",
"series": [
{
"key": "my_state",
"displayname": " ",
"seriestype": "bar",
"statecolors": ["#008cdb", "#b4e5f9", " #2ab6f4"],
"statechart": true
}
]
}
]
}
}

Note that a single chart can't contain both numeric and state timeseries.

Report states

See how to make your extension send state information:

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")