Hi, thanks for your reply! I made a rest client with some simple, abstracted methods so the guts will be hidden here but I think you’ll get the gist:
def templates = ["generic-oracle-cmd"]
def command = "/usr/lib64/nagios/plugins/local/mde_validator/mde_validator.sh"
def attrs = ["command":[command],"vars.validator":"OracleScriptEvaluator"]
// this create part works, the response is:
// 09:11:26.577 [main] DEBUG org.myhost.build.rest.RestHttpClient - Response from request to create sanity_check_rights_library_sql:{"results":[{"code":200,"status":"Object was created"}]}
client.createObject("checkcommands",one_off,templates,attrs)
// this part works, the response is:
// 09:27:28.068 [main] TRACE org.myhost.build.rest.RestHttpClient - Pulling response that we hope is a JSON object: '{"results":[{"attrs":{"__name":"sanity_check_rights_library_sql","active":true,"arguments":{"-C":"$connstr$","-c":"$validator$","-p":"$password$","-u":"$username$","-vvv":""},"command":["/usr/lib64/nagios/plugins/local/mde_validator/mde_validator.sh"],"env":{"TNS_ADMIN":"/etc/icinga2/plugin-configs"},"execute":{"arguments":["checkable","cr","resolvedMacros","useResolvedMacros"],"deprecated":false,"name":"Internal#PluginCheck","side_effect_free":false,"type":"Function"},"ha_mode":0.0,"name":"sanity_check_rights_library_sql","original_attributes":null,"package":"_api","paused":false,"source_location":{"first_column":0.0,"first_line":1.0,"last_column":52.0,"last_line":1.0,"path":"/var/lib/icinga2/api/packages/_api/950d5775-d32f-49dd-ad04-f6d11497b898/conf.d/checkcommands/sanity_check_rights_library_sql.conf"},"templates":["sanity_check_rights_library_sql","plugin-check-command","generic-oracle-cmd"],"timeout":60.0,"type":"CheckCommand","vars":{"connstr":"$service.vars.svc_connstr$","dbname":"$service.vars.svc_dbname$","password":"$service.vars.svc_passwd$","username":"$service.vars.svc_uname$","validator":"OracleScriptEvaluator"},"version":1558455086.478566885,"zone":"cscloudxn2133.cloud.myhost.org"},"joins":{},"meta":{},"name":"sanity_check_rights_library_sql","type":"CheckCommand"}]}'
println client.getObject("checkcommands","sanity_check_rights_library_sql")
// this part returns nothing:
// -bash-4.1$ icinga2 object list --type Service |grep sanity
// -bash-4.1$
I’ve reloaded/validated numerous times since I’ve put this task on the shelf and have been doing other things.
Thoughts?
Andy