Ad Widget

Collapse

Have grpsum ignore old values

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • wcs1only
    Junior Member
    • Apr 2012
    • 2

    #1

    Have grpsum ignore old values

    Here's my situation. I have an aggregate item for the network traffic for all hosts:

    grpsum["All-Hosts","net.if.out[bond0]","last","0"]

    The problem is, if a host goes down, this item will pull the last known value over and over again. So if I have two hosts each with 10Mbs traffic and one of them goes down, the aggregate value will still be 20Mbs, even though the correct value should be 10Mbs.

    Thus, my question is, can grpsum be configured to ignore values from down hosts? Or possibly, could grpsum be configured to ignore values older than say 300 seconds?

    I do have a discovery rule to disable hosts that have been down for 24 hours, which does address the issue, but the aggregate value will be incorrect for those 24 hours.

    Thanks for your help.
  • wcs1only
    Junior Member
    • Apr 2012
    • 2

    #2
    Hack solution

    I was able to get around this by creating a cronjob to perform a database update query on items.lastvalue. If items.lastclock is over some threshold, set items.lastvalue to zero.

    If you are using postgresql it looks something like this:
    Code:
    UPDATE items
    	SET lastvalue = '0.000000' 
    	WHERE key_ LIKE 'net.if.%[bond0]'		  
    		AND lastclock < extract(epoch from timestamp 'now') -900 
    		AND lastvalue != '0.000000' ;
    This is a really ugly solution, and I'd certainly like to hear a better suggestion.

    Comment

    Working...