I have created one custom metric. Which is working properly for server A but not working for another server B.
Not getting any error for that . When I checked the data for server B and custom metric in Cluster_SqlServer_Database_Keys ,however no data found for server B. on this server before maintenance window was set. I have removed it still it is not working.
If I'm making new metric for server B then again it is not working.

Can you go to Configuration > Monitored servers page? Then click 'Show log' against this SQL Server to see the error message. Alternatively, you can also try 'Test metric collection' for this custom metric for this particular server.

I observerd that If I change data collection frequency from 1 to 5 minutes than custom metric starts collecting data. and on analysis page it is showing data. but if I do reverse process then it is not working.