This is a requirement to create a Monitor where we can overrides the frequency and sample count value.
All the built in service monitoring uses Monitors that reference the Microsoft.Windows.CheckNTServiceStateMonitorType monitortype, which is in the Microsoft.Windows.Library mp.
This MonitorType has a hard coded definition with <Frequency>30</Frequency> and <MatchCount>2</MatchCount>. This means by default, monitors that use this will inspect the service state every 30 seconds, and alarm when it is not running after two consecutive checks. However the challenge is that we did not expose these values as override-able parameters.
Here is the management pack which I have created to expose those values as an overridable parameter and it works like a charm.
If you have any such kind of requirements from the customers, you can share the attached MP with the customer. But please take a note that you may need to change all the references in the MP according to the version of dependent MP in customer environment. Also you need to change the service name for which you need to create the monitor.
The attached MP is having the followings and you may need to tweak it.
-<DataSource ID="DS" TypeID="Windows!Microsoft.Windows.WmiProviderWithClassSnapshotDataMapper">
<Query>SELECT * FROM Win32_Service WHERE Name='VMTools'</Query>
<!-- Example query here: <Query><![CDATA[select * from Win32_Service where Name = 'spooler' and startmode = 'Manual']]></Query> -->