I am having an cluster where Ambari metrics collector was installed and removed later as they dont use it . Now there Nifi fails to start due to script error :
Issue is easy to reproduce
1) Deploy a fresh cluster with HDF
2) Remove AMS service
3) try to start/stop or restart nifi service. it will fail with abouve error.