Is there any built-in way to query Ambari for (a) when a service was last in maintenance mode, (b) the last error for a service plus why, etc. Accessing this information via the REST API would be ok if it is possible. Accessing it via Phoenix could also work, but is there a working example?
Is your goal to query historical information for Ambari server that is not available from Ambari Rest API ? Look at Temporal metrics section
and you may be able to build your query using this info.