As I'm in progress replacing Reacor with RunDeck, I need to replace the Nagios quick actions to a POST webrequest executing a RunDeck job. Instead of a nice popup showing the output of the Reactor chain I'm stuck with using 'command' as action type. Executing the 'command' quick action results in a tab being opened which shows the command being run.
The output which is in json is shown in one huge line containing the output of the webrequest.
So I tried to append ' | python -m json.tool' to the command which in cli results in a +- pretty json output. In Nagios XI however nothing is outputted at all and the command doesn't seem to run at all anymore.
And example command:
Output:curl -s -XPOST -H "Accept:application/json" -H "X-Rundeck-Auth-Token:riDb5npzfdzdSvj6PXLkbTbQ" --data-urlencode "argString=-target citrixserver -loadevaluator Drain_Server" "https://rundeck:4443/api/17/job/099f518 ... 704dde/run"
Code: Select all
{"id":386,"href":"https://rundeck:4443/api/17/execution/386","permalink":"https://rundeck:4443/project/DAF/execution/show/386","status":"running","project":"DAF","user":"rundeck_daf","date-started":{"unixtime":1470388707755,"date":"2016-08-05T09:18:27Z"},"job":{"id":"099f51884b704dde","averageDuration":21456,"name":"DAF-Citrix-Drain-Server","group":"Citrix/Templates","project":"DAF","description":"Manages draining of Citrix servers.","options":{"duration":"43200","loadevaluator":"Drain_Server","target":"citrixserver ","service":"CTX_Loadevaluator","logserver":"logserver:5610","comment":"Created by RunDeck"},"href":"https://rundeck:4443/api/17/job/099f51704dde","permalink":"https://rundeck:4443/project/DAF/job/show/099f5b704dde"},"description":"job: Windows/Templates/DAF-Windows-Robocopy -- -target ${option.target} -sourcehost \"gateway\" -sourcefolder \"C:\\DAF\\DAF_Sources\\Scripts\" -destinationfolder \"C:\\Program Files\\NSClient++\\scripts\\powershell\" [... 3 steps]","argstring":"-comment \"Created by RunDeck\" -duration 43200 -loadevaluator Drain_Server -logserver logserver:5610 -service CTX_Loadevaluator -target citrixserver "}
Or maybe there is another way to make a quick action output json in a pretty way or at least not in a oneliner?
Grtz