Rule Fire Amount Script - Foglight for Databases - Foglight for Databases - Dell Community

Rule Fire Amount Script

Rule Fire Amount Script

This question is answered

Hi,


I'm looking to generate a report that outlines a set of rules and the number of times that those rules have fired alarms, similar to the information you can find via Rule Diagnostics > Diagnostic Details. I believe I need to use the RuletteStats Methods, found under foglightserver/console/script-help/index.html, however there isn't any documentation.

The issue comes in with getting the amount of times the alarms have fired, as I can find the name of the rules easily enough. Also, is it possible to get just the amount of times the alarms have fired for a certain time frame or is it just the number of times the alarms have fired total?

Thanks for any suggestions in advance,

Dillon

Verified Answer
All Replies
  • Hi

    I'm only aware of how to get at this info via scripting, e.g.

    server.RuleService.getAllRules()[0].getRulettesStatistics().iterator().next().getNumFire() 

    (a list of all rules, statistics for each applicable scope the rule was applied to)

    The stats are as per restart of the server, there's no way to get a time window into this or to reset the stats through official API.


    Regard

    Nils

  • I do not know your exact use case, but the Alarm Analysis cartridge has a reporting option. Maybe it has what you are looking for.

    See: http://en.community.dell.com/techcenter/performance-monitoring/foglight-administrators/w/fog-script-wiki/6282.alarms-analysis-dashboard.aspx


    Regards, Bart

  • I think that's what I'm looking for but I'm having trouble figuring out how to use it. I have the following code:

    import com.quest.nitro.service.alarm.*;
    import com.quest.nitro.service.sl.interfaces.alarm.*;
    import com.quest.nitro.service.sl.interfaces.rule.*;

    def remedyRules = #!AlarmExportDefinition where name = "Remedy"#.getTopologyObjects().rules;

    for(int i = 0; remedyRules[0].get(i) != null ; i++) {
        print remedyRules[0].get(i).toString();
        print remedyRules[0].get(i).toString().getRulettesStatistics().iterator().next().getNumFire();
        print "\n"


    }


    which produces the error, any ideas?:

    com.quest.nitro.service.sl.interfaces.sc

    ripting.ScriptingException: com.quest.nitro.service.sl.interfaces.scripting.ScriptAbortException: groovy.lang.MissingMethodException: No signature of method: java.lang.String.getRulettesStatistics() is applicable for argument types: () values: []
    ----script start------
    import com.quest.nitro.service.alarm.*;
    import com.quest.nitro.service.sl.interfaces.alarm.*;
    import com.quest.nitro.service.sl.interfaces.rule.*;

    def remedyRules = #!AlarmExportDefinition where name = "Remedy"#.getTopologyObjects().rules;
    //return remedyRules[0].get(1);
    for(int i = 0; remedyRules[0].get(i) != null ; i++) {
    print remedyRules[0].get(i).toString();
    print remedyRules[0].get(i).toString().getRulettesStatistics().iterator().next().getNumFire();
    }

    return remedyRules;
    ---- script end ------
    com.quest.nitro.service.scripting.ScriptingService.invoke(ScriptingService.java:618)
    com.quest.nitro.service.sl.impl.scripting.ScriptingBean.invoke(ScriptingBean.java:171)
    sun.reflect.GeneratedMethodAccessor1289.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:597)
    org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
    org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
    org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
    com.quest.nitro.service.sl.aop.AuditingInterceptor.invoke(AuditingInterceptor.java:71)
    org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
    $Proxy92.invoke(Unknown Source)
    sun.reflect.GeneratedMethodAccessor1289.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:597)
    org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
    org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:198)
    $Proxy92.invoke(Unknown Source)
    sun.reflect.GeneratedMethodAccessor50801.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:597)
    org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:88)
    groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
    groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1058)
    groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886)
    org.codehaus.groovy.runtime.InvokerHelper.invokePojoMethod(InvokerHelper.java:781)
    org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:772)
    com.quest.nitro.service.scripting.FoglightServiceInterface.invokeMethod(FoglightServiceInterface.java:84)
    org.codehaus.groovy.runtime.callsite.PogoInterceptableSite.call(PogoInterceptableSite.java:45)
    org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:124)
    system._core_commons.scripts.runScript.run(runScript:26)
    com.quest.nitro.service.scripting.groovy.GroovyScript.exec(GroovyScript.java:141)
    com.quest.nitro.service.scripting.Script.runInternal(Script.java:310)
    com.quest.nitro.service.scripting.Script.run(Script.java:255)
    com.quest.nitro.service.scripting.ScriptingService.invoke(ScriptingService.java:604)
    com.quest.nitro.webconsole.services.ScriptServiceImpl.eval(ScriptServiceImpl.java:86)
    sun.reflect.GeneratedMethodAccessor530.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:597)
    com.quest.wcf.services.Registry$LazyInvocationHandler.invoke(Registry.java:127)
    $Proxy227.eval(Unknown Source)
    com.quest.wcf.core.module.function.FunctionManager.evaluateScript(FunctionManager.java:577)
    com.quest.wcf.core.module.function.FunctionManager.evaluateScriptFunction(FunctionManager.java:396)
    com.quest.wcf.core.module.function.FunctionManager.evaluate(FunctionManager.java:268)
    com.quest.wcf.core.module.function.FunctionManager.getResult(FunctionManager.java:184)
    com.quest.wcf.core.module.function.AsyncFunctionProgressTracker.execute(AsyncFunctionProgressTracker.java:56)
    com.quest.wcf.core.module.function.BaseAsyncProgressTracker.run(BaseAsyncProgressTracker.java:166)
    com.quest.nitro.service.taskmanager.TaskRunnable.run(TaskRunnable.java:294)
    java.lang.Thread.run(Thread.java:662)
    Caused by:
    com.quest.nitro.service.sl.interfaces.scripting.ScriptAbortException: groovy.lang.MissingMethodException: No signature of method: java.lang.String.getRulettesStatistics() is applicable for argument types: () values: []
    ----script start------
    import com.quest.nitro.service.alarm.*;
    import com.quest.nitro.service.sl.interfaces.alarm.*;
    import com.quest.nitro.service.sl.interfaces.rule.*;

    def remedyRules = #!AlarmExportDefinition where name = "Remedy"#.getTopologyObjects().rules;
    //return remedyRules[0].get(1);
    for(int i = 0; remedyRules[0].get(i) != null ; i++) {
    print remedyRules[0].get(i).toString();
    print remedyRules[0].get(i).toString().getRulettesStatistics().iterator().next().getNumFire();
    }

    return remedyRules;
    ---- script end ------
    com.quest.nitro.service.scripting.Script.runInternal(Script.java:334)
    com.quest.nitro.service.scripting.Script.run(Script.java:255)
    com.quest.nitro.service.scripting.ScriptingService.invoke(ScriptingService.java:604)
    com.quest.nitro.service.sl.impl.scripting.ScriptingBean.invoke(ScriptingBean.java:171)
    sun.reflect.GeneratedMethodAccessor1289.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:597)
    org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
    org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
    org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
    com.quest.nitro.service.sl.aop.AuditingInterceptor.invoke(AuditingInterceptor.java:71)
    org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
    $Proxy92.invoke(Unknown Source)
    sun.reflect.GeneratedMethodAccessor1289.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:597)
    org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
    org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:198)
    $Proxy92.invoke(Unknown Source)
    sun.reflect.GeneratedMethodAccessor50801.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:597)
    org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:88)
    groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
    groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1058)
    groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886)
    org.codehaus.groovy.runtime.InvokerHelper.invokePojoMethod(InvokerHelper.java:781)
    org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:772)
    com.quest.nitro.service.scripting.FoglightServiceInterface.invokeMethod(FoglightServiceInterface.java:84)
    org.codehaus.groovy.runtime.callsite.PogoInterceptableSite.call(PogoInterceptableSite.java:45)
    org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:124)
    system._core_commons.scripts.runScript.run(runScript:26)
    com.quest.nitro.service.scripting.groovy.GroovyScript.exec(GroovyScript.java:141)
    com.quest.nitro.service.scripting.Script.runInternal(Script.java:310)
    com.quest.nitro.service.scripting.Script.run(Script.java:255)
    com.quest.nitro.service.scripting.ScriptingService.invoke(ScriptingService.java:604)
    com.quest.nitro.webconsole.services.ScriptServiceImpl.eval(ScriptServiceImpl.java:86)
    sun.reflect.GeneratedMethodAccessor530.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:597)
    com.quest.wcf.services.Registry$LazyInvocationHandler.invoke(Registry.java:127)
    $Proxy227.eval(Unknown Source)
    com.quest.wcf.core.module.function.FunctionManager.evaluateScript(FunctionManager.java:577)
    com.quest.wcf.core.module.function.FunctionManager.evaluateScriptFunction(FunctionManager.java:396)
    com.quest.wcf.core.module.function.FunctionManager.evaluate(FunctionManager.java:268)
    com.quest.wcf.core.module.function.FunctionManager.getResult(FunctionManager.java:184)
    com.quest.wcf.core.module.function.AsyncFunctionProgressTracker.execute(AsyncFunctionProgressTracker.java:56)
    com.quest.wcf.core.module.function.BaseAsyncProgressTracker.run(BaseAsyncProgressTracker.java:166)
    com.quest.nitro.service.taskmanager.TaskRunnable.run(TaskRunnable.java:294)
    java.lang.Thread.run(Thread.java:662)