Forum Discussion

Stefan_W's avatar
3 years ago

Docs on "lm.emit" module?

I just imported the new DataSource "SSL_Certificate_Chains" (lmLocator YCXL9M) and the Groovy has something I've never seen before....

def modLoader = new GroovyShell(getBinding()).parse(com.logicmonitor.mod.Snippets.getLoader())
def lmEmit = modLoader.load("lm.emit", "0")   // Load LM emit module

 

The Active Discovery output is with

        lmEmit.instance(wildvalue, wildalias, "Subject:${cert.getSubjectDN()}", ilps)

and the Collect script output is similarly new (to me) with

        lmEmit.dp(wild, "SelfIssued", cert.isSelfIssued(cert) ? 1 : 0)
        lmEmit.dp(wild, "SelfSigned", cert.isSelfSigned(cert, null) ? 1 : 0)
        lmEmit.dp(wild, "DaysRemaining", ((cert.getNotAfter().getTime() - now.getTime()) / 1000 / 60 / 60 / 24))

 

This seems like an exciting new mechanism! Has anyone seen docs on this? 

All the googling I've tried only comes up with references to "emit" which are related to logging and/or APM traces.

 

3 Replies

  • FYI - Looks like that module got yanked because of some issues. It's now showing up as Module Status: Deprecated. 

    Still, that "emit" functionality looks really powerful and I am looking forward to learning more about it!!

  • Anonymous's avatar
    Anonymous

    It's probably part of the Snippets feature. As I understand it, this is available in the code base but only currently usable by our internal devs as we work out any issues. Presumably, they would be made available one day. I'm hoping for some API interaction shortcuts (sans creds).

  • Yep! Indeed it's Groovy script snippets. 

    I also find "lm.emit" as well as "lm.debug" in at least one of the new DataSources for Puppet monitoring.

    Example: Puppet_Server_JRuby_Statistics lmLocator: TPG9RX

    // Collector version 30.000 or higher required for script snippets
    def modLoader
    try {
        modLoader = new GroovyShell(getBinding()).parse(com.logicmonitor.mod.Snippets.getLoader())
    }
    catch (ClassNotFoundException|MissingPropertyException ignored) {
        println "Update collector to version 30.000 or higher for this DataSource."
        return 1
    }
    
    def lmEmit = modLoader.load("lm.emit", "0") // Load LM emit module
    def lmDebug = modLoader.load("lm.debug", "0") // Load LM debug module
    

     

    Then the collect is so simple and elegant....

                    // Check if status-code is found, if so, convert to raw numeric value.
                    if (statusCodes){
                       lmEmit.dp(k,statusCodes)
                    } else {
                        // print rest of the metrics.
                        lmEmit.dp(k,v)
                    }
    

     

    So beautiful! It's going to be hard to wait for the docs!!

    ?