Collection the data metrics where there are unique keys
SPID = 1 BLOCKED = 0 i want to capture the above data, the above data is my querry result. please tell me the data point settings |
SPID = 1 BLOCKED = 0 i want to capture the above data, the above data is my querry result. please tell me the data point settings |
Thanks , bro
So, you’re good? All working as expected?
The script failed, elapsed time: 0 seconds - No signature of method: java.lang.Integer.getAt() is applicable for argument types: (java.lang.Integer) values: [0]Possible solutions: getAt(java.lang.String), next(), putAt(java.lang.String, java.lang.Object), wait(), grep(), getClass()groovy.lang.MissingMethodException: No signature of method: java.lang.Integer.getAt() is applicable for argument types: (java.lang.Integer) values: [0]Possible solutions: getAt(java.lang.String), next(), putAt(java.lang.String, java.lang.Object), wait(), grep(), getClass() at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:71) at org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:48) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:128) at Script4977$_run_closure1$_closure2.doCall(Script4977.groovy:37) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:98) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325) at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:264) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1034) at groovy.lang.Closure.call(Closure.java:418) at groovy.lang.Closure.call(Closure.java:434) at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2125) at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2110) at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2151) at org.codehaus.groovy.runtime.dgm$163.invoke(Unknown Source) at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:274) at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:56) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:128) at Script4977$_run_closure1.doCall(Script4977.groovy:33) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:98) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325) at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:264) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1034) at groovy.lang.Closure.call(Closure.java:418) at groovy.lang.Closure.call(Closure.java:434) at groovy.sql.Sql.callClosurePossiblyWithConnection(Sql.java:4396) at groovy.sql.Sql.withTransaction(Sql.java:3586) at groovy.sql.Sql$withTransaction.call(Unknown Source) at Script4977.run(Script4977.groovy:24)
hi, iam getting error related to time blocked, can you please check
This is the important part of the error:
No signature of method: java.lang.Integer.getAt() is applicable for argument types: (java.lang.Integer) values: [0]Possible solutions: getAt(java.lang.String)
This means that the .toInteger() method (of which java.lang.Integer.getAt() is a sub-method) requires input of an object of a certain type. You passed in an object that could not be converted to an integer. This means that either h or m doesn’t contain a string that can be converted to an integer. .toInteger() needs a string to convert to an integer. It looks like you’re passing in either a “0” (integer) or [0] (list). I can’t tell which one because java debugging requires a higher state of consciousness to decipher.
If you’re still using the script from here, the issue is in the “toInteger()” method, which is happening at this point in your script. Here are some suggestions on how to troubleshoot it.
// get the values of hours and minutes from time_blocked. time_blocked will be something like 18:53
// so h should end up being 18 (in this case)
// and m should end up being 53 (in this case)
(h,m) = row.time_blocked.split(":")
// put a println statement here to see what h and m are to make sure they are convertable to integers
println("h=${h}\nm=${m}")
// if h and m look like integers here, then you shouldn't have any problems converting them to integers.
// if this line still doesn't work, it may be that there are extra spaces. In that case, use .trim() to remove any extra spaces
time_blocked = h.trim().toInteger()*60 + m.trim().toInteger()
// You can also split these lines up into their individual steps to see which one is failing
intHours = h.toInteger()
intMinutes = m.toInteger()
time_blocked = intHours * 60 + intMinutes
// if h and m look like this:
// h=[18]
// m=[53]
// then you don't have strings, you have a list of strings. You'd need to extract the elements from the list:
time_blocked = h[0].toInteger()*60 + m[0].toInteger()
Give some of these suggestions a try and see what you get. Check the output of the println statement to see if you’re getting valid values from the .split() method.
There are other ways to parse a string into an integer, but your first order of business is to find out what h and m contain after the .split() happens.
hi please find the above codes and output. here i want to make segments as my instances. please tell me how to do.
You should make this a “script”, since your collection script is designed to only poll one instance’s worth of data.
In your collection script, your datapoint keys should not have spaces in them, so I’d update line 28 in your collection script to this:
def result = sql.rows("select s.name Segment, cast(sum((size*$alloc)/1048576) as decimal(38,10)) 'size_in_MB', cast(sum((size*$alloc)/1048576)-sum((curunreservedpgs(db_id('${wildvalue}'),lstart, unreservedpgs)* $alloc)/1048576) as decimal(38,10)) 'Used_in_MB', cast(sum((curunreservedpgs(db_id('${wildvalue}'),lstart, unreservedpgs)* $alloc)/1048576) as decimal(38,10)) 'Free_in_MB' from master..sysusages u, syssegments s where u.dbid=db_id('${wildvalue}') and (segmap & power(2, segment))=power(2,segment) group by s.name")
You’ll also need to figure out a way to transform the “Segment” into a number since the collection script can only provide numbers to the DataSource. You could modify your discovery script to add the segment as part of the instance definition, either the description or an instance level property. I’d work on getting your collection working before attempting that.
actually, Iam think of to add segment as discovery. any idea of that