Trigger for specific values

Support questions about the Threshold plugin

Moderators: Moderators, Developers

Post Reply
Author
Message
User avatar
Jeeves
Posts: 26
Joined: Wed Jun 12, 2013 6:25 pm

Trigger for specific values

#1 Post by Jeeves » Tue Jan 23, 2018 7:21 pm

I think the only way to do this is with Data Manipulation, but I'm unsure.

I have exact values being returned from a RAID staus. 1, and 3 are valid "OK" values. However explicitly a 2 or anything higher than a 3 indicates a failure. Trying to figure out how to make a Threshold rule for this, or if it can even handle it has been boggling me.

Has anyone run into this before?

netniV
Cacti Guru User
Posts: 2803
Joined: Sun Aug 27, 2017 12:05 am

Re: Trigger for specific values

#2 Post by netniV » Wed Jan 24, 2018 7:04 am

You'd need to use RPN Expression's to return a manipulated value. I haven't used them before, but it would be something like:

Code: Select all

|ds:ping|,1,EQ,0,|ds:ping|,3,EQ,1,|ds:ping|,IF,IF
Checkout : https://oss.oetiker.ch/rrdtool/tut/rpntutorial.en.html

User avatar
Jeeves
Posts: 26
Joined: Wed Jun 12, 2013 6:25 pm

Re: Trigger for specific values

#3 Post by Jeeves » Wed Jan 24, 2018 10:43 am

netniV wrote:You'd need to use RPN Expression's to return a manipulated value. I haven't used them before, but it would be something like:

Code: Select all

|ds:ping|,1,EQ,0,|ds:ping|,3,EQ,1,|ds:ping|,IF,IF
Checkout : https://oss.oetiker.ch/rrdtool/tut/rpntutorial.en.html
Good ole RPN. Thanks again netniV.

netniV
Cacti Guru User
Posts: 2803
Joined: Sun Aug 27, 2017 12:05 am

Re: Trigger for specific values

#4 Post by netniV » Thu Jan 25, 2018 4:34 am

If you get the expression working, post it here as I am curious how close I am lol. By my reckoning it should produce 0 (for 1), 1 (for 3), current value for 2 or 4+

User avatar
Jeeves
Posts: 26
Joined: Wed Jun 12, 2013 6:25 pm

Re: Trigger for specific values

#5 Post by Jeeves » Thu Jan 25, 2018 2:18 pm

netniV wrote:If you get the expression working, post it here as I am curious how close I am lol. By my reckoning it should produce 0 (for 1), 1 (for 3), current value for 2 or 4+
I've got a non-production cage I can pull a drive out of to test and verify this works. However, I decided to simply test for 1, 3 and greater than 3 as it seemed to be the easiest method.

Code: Select all

|ds:hdd_status|,1,EQ,0,|ds:hdd_status|,2,EQ,1,|ds:hdd_status|,3,EQ,0,|ds:hdd_status|,3,GT,1,|ds:hdd_status|,IF,IF,IF,IF
Effectively putting the the logic I initially stated into play:
- 1 = Good
- 2 = Bad
- 3 = Good
- > 3 = Bad
There are no return codes less than 1 and anything that is not a 1 or 3 indiciates a failure that needs eyes on inspection.

Currently a 3 is returning a 0. So that part I know to be working. However before I see a failure somewhere, I'd like to test one.

The other detail (for anyone else who stumbles upon this later) that few mention, is that data manipulation alters the data from the data source then hands it back to the "Threshold Engine" if you will, so that it only sees (for this query) a 1 or a 0. I'm only triggering the "Alert - High", on a 1. Nothing else. If you're reading top to bottom, down the threshold page, it reads counterintuitively like data manipulation comes afterwards.

Thanks again. RPN + Logic Flow is not the most intuituve without official Thold documentation anywhere, but it certainly does get results.

Post Reply