The command:
hdfs haadmin -getServiceState machine-98
Works only if you know the machine name. Is there any command like:
h
You can do a curl command to find out the Active and secondary Namenode for example
curl -u username -H "X-Requested-By: ambari" -X GET http://cluster-hostname:8080/api/v1/clusters//services/HDFS
Regards