0

I'm very new to Wildfly but I need to set up automated monitoring of individual deployment status via the API.

In the same way that I can view the server state with curl, eg:

curl --insecure --digest 'https://admin:password@localhost:9993/management' --header "Content-Type: application/json" -d '{"operation":"read-attribute","name":"server-state","json.pretty":1}'

Will return:

{
    "outcome" => "success",
    "result" => "running"
}

In the same way the from the jboss-cli, I issue:

:read-attribute(name=server-state)

And get the same result.

So, from the CLI, if I issue the following command to get the status of a specific deployment:

/deployment=bob :read-attribute(name=status)

I get the following result:

{
    "outcome" => "success",
    "result" => "OK"
}

But I can't work out what curl command will give me that result. I've read through a tonne of documentation and either it doesn't exist or I'm looking in the wrong spot. I've tried:

curl --insecure --digest 'https://password@localhost:9993/management' --header "Content-Type: application/json" -d '{"deployment":"bob","operation":"read-attribute","name":"status","json.pretty":1}'

but that didn't work. Any ideas?

Thanks, Mark J.

1 Answers1

0

You need to add an array for the address attribute and move the "deployment":"bob" in the array.

curl --insecure --digest 'https://password@localhost:9993/management' --header "Content-Type: application/json" -d '{"operation":"read-attribute", "address":[{"deployment":"bob"}],"name":"status","json.pretty":1}'

The address is a name/value pair object for the path the attribute you want to read. For example if you wanted to see the all the handlers associated with the root logger you could execute the following.

curl --insecure --digest 'https://password@localhost:9993/management' --header "Content-Type: application/json" -d '{"operation":"read-attribute","address":[{"subsystem":"logging"},{"root-logger":"ROOT"}],"name":"handlers","json.pretty":1}
James R. Perkins
  • 16,800
  • 44
  • 60