Forum Discussion
Anonymous
2 years agoYou 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.
Related Content
- 2 years ago
- 3 days ago
- 2 years ago