How to enable JMX port for Namenode and Datanode in Hadoop from Ambari

I am using HDP 3.1.1. I am trying to enable JMX for HDFS by following the below link. https://docs.cloudera.com/HDPDocuments/HDP3/HDP-3.1.4/data-storage/content/using_jmx_for_accessing_hdfs_metrics.html After restarting the HDFS. again the changes are removing automatically. I tried to add the same lines from Ambari as well At that time HDFS itself is not starting.

Details