Trigger for specific values

Support questions about the Threshold plugin

Moderators: Developers, Moderators

Post Reply
User avatar
Jeeves
Cacti User
Posts: 91
Joined: Wed Jun 12, 2013 6:25 pm

Trigger for specific values

Post by Jeeves »

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: 3441
Joined: Sun Aug 27, 2017 12:05 am

Re: Trigger for specific values

Post by netniV »

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
Cacti Developer & Release Manager
The Cacti Group

Director
BV IT Solutions Ltd

+--------------------------------------------------------------------------+

Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
User avatar
Jeeves
Cacti User
Posts: 91
Joined: Wed Jun 12, 2013 6:25 pm

Re: Trigger for specific values

Post by Jeeves »

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: 3441
Joined: Sun Aug 27, 2017 12:05 am

Re: Trigger for specific values

Post by netniV »

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+
Cacti Developer & Release Manager
The Cacti Group

Director
BV IT Solutions Ltd

+--------------------------------------------------------------------------+

Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
User avatar
Jeeves
Cacti User
Posts: 91
Joined: Wed Jun 12, 2013 6:25 pm

Re: Trigger for specific values

Post by Jeeves »

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

Who is online

Users browsing this forum: No registered users and 2 guests