Thanks Dominik,
I so i have managed to add the following command object, and it seems i can run it from the API.
However, it is not returning anything like what I’m expecting. It’s as if the command itself is not executing at all.
Might you know where i am going wrong? (I wish to see what the cli command returns)
https://da.something.com:5665/v1/objects/checkcommands/list_interfaces?address=10.150.1.1
object CheckCommand “list_interfaces” {
import “plugin-check-command”
command = [ PluginDir + “/” + “check_nwc_health” ]
arguments = {
“–hostname” = “$address$”
“–protocol” = “2”
“–community” = “public”
“–mode” = “list-interfaces-detail”
}
}
Result:
{
“results”: [
{
“attrs”: {
“__name”: “list_interfaces”,
“active”: true,
“arguments”: {
“–community”: “public”,
“–hostname”: “$address$”,
“–mode”: “list-interfaces-detail”,
“–protocol”: “2”
},
“command”: [
“/usr/lib/nagios/plugins/check_nwc_health”
],
“env”: null,
“execute”: {
“arguments”: [
“checkable”,
“cr”,
“resolvedMacros”,
“useResolvedMacros”
],
“deprecated”: false,
“name”: “Internal#PluginCheck”,
“side_effect_free”: false,
“type”: “Function”
},
“ha_mode”: 0.0,
“name”: “list_interfaces”,
“original_attributes”: null,
“package”: “_etc”,
“paused”: false,
“source_location”: {
“first_column”: 0.0,
“first_line”: 1.0,
“last_column”: 36.0,
“last_line”: 1.0,
“path”: “/etc/icinga2/zones.d/global-templates/check_nwc_health.conf”
},
“templates”: [
“list_interfaces”,
“plugin-check-command”,
“plugin-check-command”
],
“timeout”: 60.0,
“type”: “CheckCommand”,
“vars”: null,
“version”: 0.0,
“zone”: “global-templates”
},
“joins”: {},
“meta”: {},
“name”: “list_interfaces”,
“type”: “CheckCommand”
}
]
}