-
-
Notifications
You must be signed in to change notification settings - Fork 407
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HRULE objects broken in some cases #2662
Comments
OR, I guess I should say, Cacti should always be accepting an integer and textual response from SNMP, and storing it, but knowing when to strip out the text and when not to, is important. So in the case of an HRULE, obviously we only need an integer. But for displaying information on a data query in the graph creation page, the text is important. Not having that is also breaking some of my automation rules since I rely on "found(0)" instead of just "0". |
Where are those hrule values coming from. Show the 'raw' value from the template. Seems like a thold issue more so than a Cati issue as we are talking 'High Warning' and 'High Alarm'. Show the thold edit screen for the thold here. Not sure where percent is coming from. |
Take that back. It's a graph template. Let's see your text format for the HRULE... |
Looks like the regex trim is not working as it should in lib/snmp.php. Did you merge correctly, or hand edit? If you look at the other ticket, you will see the issue. For the HRULE, you will likely need to extend your XML to include a value regex for the numeric data, and a normal walk for something that you want to display on the graph as text. |
I'm going to close now. However, you will need to include two versions of the percent column, one that uses a regex to remove the 'percent' and the other that includes the full text including the percent. The lib/snmp.php has been updated to fix this other issue. So, after you make this change, your hrules will work again. |
I am really confused by this requirement, it’s been working for a couple years in this manner. There are a whole ton of changes I’ll need to make in a bunch of templates to accommodate this. If an HRULE always needs an integer shouldn’t it just strip out anything that’s not an integer automatically?? There are a lot of other things scattered around that really don’t seem to be working smoothly after 1.2.1 to 1.2.3, sorry I went MIA again for a minute but I’ll try to get back into this later today if I can
Eric.
… On May 11, 2019, at 8:58 AM, Jimmy Conner ***@***.***> wrote:
I'm going to close now. However, you will need to include two versions of the percent column, one that uses a regex to remove the 'percent' and the other that includes the full text including the percent. The lib/snmp.php has been updated to fix this other issue. So, after you make this change, your hrules will work again.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
So, the issue is that we were performing trim's on the walks which was leading to bad results. We assumed that since a walk does not have to be numeric, we did not trim the data of non-numeric trailing data. I guess, we could add an XML attribute to say "If the data could be numeric, make it so", which would essentially revert the legacy behavior. However, we will not make that the default. So, you will have to update some XML files. How does that sound? |
So I assume this data is all being kept in the host_snmp_cache table, specifically in the field_value column. I do like having the "12 percent" entered here instead of just "12" so this numeric/text data can be displayed in an rrdtool COMMENT as well as in the data query output table in the "create graphs" page. It's more informative and functional in my opinion. My thought is that Cacti should do its best to pass valid data over to rrdtool wherever it can, otherwise throw a Cacti error instead of an rrdtool error. I realize this isn't always possible, but generally speaking I think the Cacti errors can be more informative than the rrdtool errors usually are. An HRULE is always going to need a plain integer value, so in the case of a field_value having non-integer data present Cacti would check for this and filter it out and send just the integer to the HRULE directive. If it couldn't, then indicate that through a more comprehensive error "hey you're throwing garbage at the HRULE and I can't fix it, please look into that". I can't see a situation where this behavior would backfire against someone, but I'd certainly want to give it careful thought to avoid any regression against something else. This logic could really be applied to a lot of rrdtool directives, so I realize that's a lot of extra work and more things that could go wrong. But I've been confronted by this type of issue several times over the years and it seems like doing some minor input validation on the inputs to rrdtool (and some very basic data filtering where possible) could really improve the overall flexibility and ease of use, especially for template developers. Sorry I don't actually contribute any code to this effort, if I had a bit more time and better familiarity with the code base I could do it. Hopefully someday:) And then I'd have a much better idea of what's really possible and logical to implement. |
Okay, I'm going to introduce something very targeted right now. It'll involve lib/functions.php and lib/rrd.php. Let me know how it works. This way, we can sort of restore legacy behavior. Sorry about all the troubles. The more I've given thought to this, the more I've realized what is missing both from Cacti and php-snmp. There is just not enough time to fix it all. |
* HRULE objects broken in some cases * Also two missed escapeshell* change
Confirmed working 1.2.4 |
This was working on whichever version I was on previously (~1.2.0). The problem is that SNMP is returning "percent" since I include the MIB by default in all queries. This is a regression of several of my other bug reports, and likely the exact opposite behavior of what I'm looking for in my other open issue (aka I do need "percent" to come through)
I really need to go back to the way things were working previously, which SNMP commands in Cacti fetched MIB resolvable units and which ones didn't.
The text was updated successfully, but these errors were encountered: