Forum Discussion

lroussell's avatar
7 months ago

Feature Request - New property to indicate monitoring is disabled

I have a problem where my users will disable alerting on a resource that has been removed from the environment instead of deleting it. Or they may disable alerting and forget to re-enable it. With alerting disabled, my no-data datapoint alerts never trigger. In the case of removed devices, the resources just hang out there forever and never get removed because they don’t show up on my data collection failures dashboard. Devices for which the user intended to re-enable alerting eventually meet the same fate unless they go down and we don’t know about it. Either of these outcomes is bad news.

It would be nice if there were a property which would indicate that alerting for a resource has been disabled. As far as I am aware, there is currently no way to do this. Then I could create a dynamic group of devices which have monitoring disabled. As devices are populated in the group, I can investigate them. As it stands now, I have to go manually hunt them down.

3 Replies

  • The idea with it being a property is that you could create a dynamic group and either list that group on the dashboard or use a big number widget to show the number of disabled devices?

    You could write a propertysource to query the API for the “disableAlerting” attribute on the device and store that as a property:

    import javax.crypto.Mac
    import javax.crypto.spec.SecretKeySpec
    import org.apache.commons.codec.binary.Hex
    import com.santaba.agent.groovyapi.http.*
    import groovy.json.JsonSlurper
    import groovy.json.JsonOutput

    accessId = hostProps.get("")
    accessKey = hostProps.get("alerting_status.key")

    def lm_get_request(_resourcePath, _queryParams, _accessId = accessId, _accessKey = accessKey) {
    account = ''
    File file = new File('../conf/agent.conf')
    file.text.eachLine{if (it =~ /company=/){ account = it.split('=')[1].trim() }}
    url = "https://" + account + "" + "/santaba/rest"
    httpClient = + "", 443)
    headers=calcSignature('GET',_resourcePath,accessKey,accessId) // calcSignature defined below
    headers.put("X-Version", "3")
    response = httpClient.get(url + _resourcePath + _queryParams, headers)
    responseBody = httpClient.getResponseBody()
    try {allResponse = new JsonSlurper().parseText(responseBody)}
    catch (Exception e) {allResponse = responseBody}
    return allResponse

    def calcSignature(_verb,_resourcePath,_accessKey,_accessId,_data = '') {
    epoch = System.currentTimeMillis()
    requestVars = _verb + epoch + _data + _resourcePath
    hmac = Mac.getInstance("HmacSHA256")
    secret = new SecretKeySpec(_accessKey.getBytes(), "HmacSHA256")
    hmac_signed = Hex.encodeHexString(hmac.doFinal(requestVars.getBytes()))
    signature = hmac_signed.bytes.encodeBase64()
    headers = [:]
    headers.put("Authorization" , "LMv1 " + _accessId + ":" + signature + ":" + epoch)
    return headers

    return 0
    1. Create an API token and put in the note that this is for the alerting_status PS.
    2. Take the ID and key and store them as properties on your root with the name and alerting_status.key, respectively.
    3. Create a propertysource with appliesto of “ && alerting_status.key”
    4. Use the above as the code.
    5. Test it then send it.

    It should create a property called “auto.disablealerting” with a value of true or false. YMMV, test in sandbox, with great power, yadda-yadda-yadda. FYI, a value of false means that alerting is not disabled. A value of true means alerting is disabled.