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 |
As of now , its ok . I need to go for TEST and see. Thanks soo much
Thanks bro problem solved. I have used ‘-’ instead of : . problem solved
Thanks
Bye bro
please help
You’re going to need to provide more information. Is this a batchscript datasource? What does your discovery look like?
Your output will need to change if it’s batchscript.
It’ll probably need to look something like:
SPID651.blocked: 0
SPID673.blocked: 0
This makes assumptions since you didn’t provide any of the required details. Assuming you want separate instances for each line in your output and assuming blocked is the single datapoint you want to store for each of these instances.
i just wanted to store all spid and blocked info
if i go like this
SPID651.blocked: 0
SPID673.blocked: 0
i cant predifne SPID651 in datapoints , as there was no gaurantee that this is going to be in the table
You still didn’t answer any of the questions. Batchscript? What discovery are you doing?
At any rate, you’re thinking about it wrong. SPID651 is not data. It’s the identifier. So you should have a discovery script that creates the instances based on the identifiers, then your collection script outputs the data with the identifier and datapoint name before the colon and the data after the colon.
import groovy.sql.Sql
//@Grab('org.hsqldb:hsqldb:2.7.1:jdk8')
//@GrabConfig(systemClassLoader=true)
//@Grab("com.sybase.jdbc4.jdbc.SybDriver")
Class.forName("com.sybase.jdbc4.jdbc.SybDriver")
// Get basic info to connect
def hostname = hostProps.get("system.hostname")
def user = hostProps.get("sybase.user")
def pass = hostProps.get("sybase.pass")
def port = 21000
// Construct an SQL instance with a url and a driver
def url = "jdbc:sybase:Tds:##hostname##:21000", username=user, password=pass
//def url = "jdbc:sybase:Tds:hostname:port", "user", "pass"
// sybase SQL Driver
def driver = "com.sybase.jdbc4.jdbc.SybDriver"
// Create a connection to the SQL server
sql = Sql.newInstance(url,user,pass,driver)
sql.withTransaction {
// Iterate over query results and list the databases
sql.eachRow("select name from master..sysdatabases")
{
name= it.toString().split(":")[1].replace("]","")
// Create an instance for each database
println name+"##"+name
}
}
sql.close()
return 0