All of this stuff onwards is now handled automatically in a single line call from HariSekhon::ClouderaManager shortening the code in check_cloudera_manager_service_state.pl and check_cloudera_manager_health.pl