Answers for "Checking FME Server availability using the REST API" https://knowledge.safe.com/questions/43588/checking-fme-server-availability-using-the-rest-ap.html The latest answers for the question "Checking FME Server availability using the REST API" Answer by nic_ran https://knowledge.亚搏在线safe.com/answers/43792/view.html

We had a phone call with the guys at Safe and talked about this point, among other items. I subsequently received an email with the information below. It turns out that there's an undocumented REST API call that can be made to do a quick "health check" to see if the services are running but it still does not test full job processing capability. Anyway, their response is interesting and provides some further context around what the available calls are and what they are checking...

as discussed in our call today, here is the REST endpoint for the FME Sever health check:

<FMEServer_URL>:<PORT>/fmerest/v3/healthcheck

This is the endpoint that we use to check whether our FME Cloud instances are up and running. However I am not 100% anymore if this is what you were looking for. I had a discussion with a developer and it turns out that this call just checks whether the REST API webapp is running. It does not tell you:

1. Is the FME Core process running

2. Is the FME Engine process running

So it is not exactly a indication whether a job can be processed.

The /fmerest/v3/healthcheck endpoint will either return an HTTP 200 response code or not respond at all.


The call

<FMEServer_URL>:<PORT>/fmerest/v3/info

will give an indication whether the FME Core process is up, because it calls this process. That said, we would not recommend to hit this endpoint too often as it is single threaded and can put a lot of load on the process. This is the actual reason why we use the healthcheck endpoint.

The /fmerest/v3/info call can return 2 different HTTP status codes depending on the state of the core:

- 200 core is up & running

- 503 Web app can't connect to core

Pinging this endpoint about every 10s should be fine.




Another option is the call

<FMEServer_URL>:<PORT>/fmerest/v3/transformations/engines

This will tell you whether engines are registered and running and therefore this is the best indicator whether a job can be processed or not. However this call will be slower and probably also shouldn't be hit in a too high interval.

As conclusion I'd say the healthcehck gives you an idea wither the tomcat and the machine is up and it can be hit in short intervals. If the FME Server core is running on a different machine this check won't detect if the core is down. The info and engines endpoints will give you more information about the overall status but should also not be hit too often.

Thu, 04 May 2017 14:09:05 GMT nic_ran
Answer by nic_ran https://knowledge.safe.com/answers/43668/view.html

Thanks folks. I figured that checking the available engines was probably the best approach, as per Todd's recommendation, just wanted to see if anyone had alternate solutions/suggestions.

It would be nice if Safe could add a REST call specifically to check for FME Server "availability", however that is best defined. For example, is it possible for the engines to be available but not the Core? They are started and managed by different services. Or for the Engines and Core to be available but not the DB service?

I think checking engine availability is a good start and probably the best solution with the current REST API but I'm just not sure it's a total solution.

It would be nice if Safe could comment on this... :)

Tue, 02 May 2017 14:57:22 GMT nic_ran
Answer by david_r https://knowledge.safe.com/answers/43611/view.html < p > @todd_davis说,您可以使用REST API to query for the number of running engines. Example:

http://myfmeserver/fmerest/v2/transformations/engines?accept=json&detail=low

It will return a json list object that enumerates the available engines. If you want to see if one of them is free, check for currentJobId = -1, example from a server with two engines:

[ { "hostName": "myfmeserver", "resultFailureCount": 0, "resultSuccessCount": 0, "maxTransactionResultSuccess": 100, "instanceName": "myfmeserver_Engine1", "transactionPort": 62392, "currentJobID": -1, "maxTransactionResultFailure": 10, "buildNumber": 16716, "platform": "WIN32" }, { "hostName": "myfmeserver", "resultFailureCount": 0, "resultSuccessCount": 0, "maxTransactionResultSuccess": 100, "instanceName": "myfmeserver_Engine2", "transactionPort": 54189, "currentJobID": -1, "maxTransactionResultFailure": 10, "buildNumber": 16716, "platform": "WIN32" } ] 

There is also an API call to query the running and queued jobs, if you need more information.

Tue, 02 May 2017 07:21:09 GMT david_r
Answer by itay https://knowledge.safe.com/answers/43604/view.html

The best way to know which API end point to use is to acces it via your FME server > help > REST API this way you can see what the result is and if it fits your needs.

Hope this helps.

Tue, 02 May 2017 04:31:33 GMT itay
Answer by todd_davis https://knowledge.safe.com/answers/43602/view.html

If you want to query whether there are engines running, or with queues you can use a get on transformations/jobs as below:

http://docs.safe.com/fme/html/FME_REST/v2/apidoc/index.html#!/transformations/list_get_11

Tue, 02 May 2017 03:38:33 GMT todd_davis