-
1. Re: How to check if AS7 is fully started?
jaikiran Jun 21, 2011 7:13 AM (in response to matt.drees)You can do this from the AS7 command line interface. Assuming you started the server and want to check it's state, then from command line, go to JBOSS_HOME/bin folder and run the following commands:
jpai@jpai-laptop:bin$ ./jboss-admin.sh You are disconnected at the moment. Type 'connect' to connect to the server or 'help' for the list of supported commands.
That will bring up the AS7 command line interface. Then connect to the server:
[disconnected /] connect Connected to standalone controller at localhost:9999
Then issue a read-attribute operation for the "server-state" attribute name:
[standalone@localhost:9999 /] :read-attribute(name=server-state)
That'll return you the result of the operation:
[standalone@localhost:9999 /] :read-attribute(name=server-state) { "outcome" => "success", "result" => "RUNNING", "compensating-operation" => undefined }
The "result" is what is the current value for the "server-state" attribute. In this example, it shows that the server is in "RUNNING" state.
This can be done programatically too (but I don't have the details of the client API and jar, right now).
-
2. Re: How to check if AS7 is fully started?
matt.drees Jun 21, 2011 8:16 AM (in response to jaikiran)Perfect.
Thanks Jaikiran!
-Matt
-
3. Re: How to check if AS7 is fully started?
dabramov May 25, 2012 11:09 AM (in response to matt.drees)Our installation copies the required .ears etc. to the deployments directory and then we let the deployment scanner do it's work when JBoss starts. It looks like the the state switches to "running" to early for us - before the initial deployments are complete.
Is there another attribute which would tell us that "JBoss has started and has completed"? I imagine I could probably find a way to check individual deployments, but that seems harder to maintain long term.
In JBoss 4.0.4 (which we're upgrading from ) we used to check the MBean/attribute "jboss.system:type=Server/Started". This seems to take deployemnts into account.
Thanks,
-Dan
-
4. Re: How to check if AS7 is fully started?
mike1452 Jun 6, 2012 5:27 AM (in response to matt.drees)Hello all!
For scripting usages (JBoss 7.1.1):
- to check if JBoss server is started: ./jboss-cli.sh -c --commands="read-attribute server-state"
- to check if application is started: ./jboss-cli.sh -c --commands="cd deployment,cd myapp.war, read-attribute status"
-
5. Re: How to check if AS7 is fully started?
pathduck Jun 6, 2012 8:09 AM (in response to mike1452)Thanks mike, thats useful!
For those interested, if you have several appservers running on the same machine:
- ./jboss-cli.sh -c --controller=localhost:9999 --command="read-attribute server-state"
Change the port depending on what instance you are checking.
You won't need to specify username+password if connecting locally using the runtime user, which is useful for scripting.
Though for basic init-script status function we just use:
- ps -ef | grep "org.jboss.as" | grep "/$JBOSS_CONF/"
Which works good enough for us
-
6. Re: How to check if AS7 is fully started?
agoncal Jul 10, 2014 8:02 AM (in response to mike1452)That's very handy to be able to check via script. But what about having a REST interface ? I thought JBoss 7+ had REST interfaces for some admin commands. Will it be possible to check that the server is up and running with an HTTP call ? And checking that a war or an ear is correctly deployed with REST ?
Thanks
-
7. Re: How to check if AS7 is fully started?
sewatech Jul 10, 2014 8:43 AM (in response to agoncal)The whole management information is available via a REST API or an HTTP/JSON API.
http://localhost:9990/management/?include-runtime=true returns a JSON object, check the server-state attribute.
To translate a jboss-cli path to the REST one, replace the '=' characters with '/'.
For a deployment : http://localhost:9990/management/deployment/myapp.war?include-runtime=true, attribut status
-
8. Re: How to check if AS7 is fully started?
cvasilak Jul 10, 2014 9:37 AM (in response to agoncal)or you can query directly the attribute:
from browser:
http://user:pass@localhost:9990/management/deployment/myapp.war?operation=attribute&name=status
and with curl:
$ curl --digest 'http://user:pass@localhost:9990/management' --header "Content-Type: application/json" -d '{"operation":"read-attribute","address":[{"deployment":"myapp.war"}], "name": "enabled", "json.pretty":1}'
-
9. Re: How to check if AS7 is fully started?
sewatech Jul 10, 2014 9:43 AM (in response to cvasilak)Thank you Christos. I was looking for this feature.
-
10. Re: How to check if AS7 is fully started?
agoncal Jul 10, 2014 10:45 AM (in response to cvasilak)But how do you query simple CLI commands such as :
- version
- reload
- read-attribute product-version
Antonio
-
11. Re: Re: How to check if AS7 is fully started?
sewatech Jul 10, 2014 11:20 AM (in response to agoncal)http://localhost:9990/management/?operation=attribute&name=release-version
http://localhost:9990/management/?operation=attribute&name=product-version
Not sure whether you can do a reload with the REST API. You should probably switch to the other HTTP/JSON API :
curl --digest -D - http://localhost:9990/management --header "Content-Type: application/json" -d '{"operation":"reload", "address":[], "json.pretty":1}' -u username:password
-
12. Re: How to check if AS7 is fully started?
asa951 Nov 12, 2015 11:30 PM (in response to dabramov)dabramov Did you ever find a good solution to your problem?