[ZBXNEXT-768] allow to customise unit blacklist Created: 2011 Apr 29  Updated: 2024 Apr 10  Resolved: 2018 Jan 08

Status: Closed
Project: ZABBIX FEATURE REQUESTS
Component/s: Frontend (F), Server (S)
Affects Version/s: None
Fix Version/s: 4.0.0alpha2, 4.0 (plan)

Type: Change Request Priority: Minor
Reporter: richlv Assignee: Alexei Vladishev
Resolution: Fixed Votes: 34
Labels: blacklist, patch, units
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File UnitEscape.patch     File UnitEscape226.patch    
Issue Links:
Causes
causes ZBXNEXT-4351 Possibility to specify unit conversio... Open
Duplicate
is duplicated by ZBXNEXT-4298 Option on Frontend to configure units... Closed
is duplicated by ZBXNEXT-2702 Allow items to be set to not use K/M/... Closed
Team: Team C
Sprint: Sprint 24, Sprint 25
Story Points: 3

 Description   

zabbix has a hardcoded unit blacklist where prefix multiplier (K, M, G etc) is not applied.
currently the blacklist includes "%", "ms", "rpm" and "RPM".

it would be useful to allow customisation of the blacklist. preferably, this would be done through the frontend. the blacklist configuration would have to be stored in the db, as it should be used both by frontend and server (for notifications)



 Comments   
Comment by Oleksii Zagorskyi [ 2011 Apr 29 ]

This was many times discussed, we need dummy prefix placeholder to display value as is (without prefix itself). For example count of "something" is 19766 and it should be displayed without any prefixes.
It is need for GUI and server notification too. Would be nice to introduce this possibility in this issue.

Comment by richlv [ 2011 Apr 29 ]

"dummy unit" would be quite bad usability wise. i'd prefer a checkbox on the item level that would never apply the multiplier (i'm sure it's mentioned in some other issue somewhere )

Comment by Steve mushero [ 2012 May 23 ]

Agreed we need this, and also some fixes so we don't have KKB on some units; we've adjusted hard-coding, but still messy.

Comment by Oleksii Zagorskyi [ 2012 Jun 14 ]

When implementing, please check ZBX-5024

Comment by Tomas Pipo [ 2012 Oct 29 ]

I agree with richlv, the new check box in item configuration form is more suitable than special prefix in Units field.

Comment by Michel Meyers [ 2012 Oct 29 ]

The dummy unit is relatively easy to get going, by just making that unit list customizable and relying on the existing code. (That's what I do when I manually add 'lic', for licenses, to the func.inc.php file.)

The check box is certainly the cleaner implementation but will require more modifications across the web interface (item form, graph generation, ...).

Comment by Jonathan deBoer [ 2013 Jun 18 ]

I've written a patch for Zabbix 2.0.6 that does something similar. This patch allows you to prevent "unit processing" by prefixing the unit value with a "!" (So, for example, you could use "!days" for the unit, and get "1234 days", instead of "1.23 kdays") Also, you can specify the unit precision for floating point numbers: "![2]deg" would give you "123.45 deg" instead of "123 deg" or "123.450000 deg" as you would get by simply adding "deg" to the blacklist.

Personally, I feel that having some sort of escape character is by far the easiest solution. It requires no schema changes, and the patch is really minimal.

Comment by Jonathan deBoer [ 2013 Jun 18 ]

Patch to allow bypassing of unit processing by prefixing the unit with a "!"

Additionally, "![num]" allows specifying floating point precision.

Comment by halt [ 2013 Oct 22 ]

Just facing the same issue with one custom userparameter, I prefer if this setup will be in the configuration of the item on the GUI, so per item, in my case I want to monitor the puppet conf version but that does not make to much sense in Gigs.
So plus one vote from ME

Comment by Max N [ 2015 Jan 07 ]

I really like to see this in upcoming releases.
I've modified the patch from @jdccdevel to work with zabbix 2.2.6 (there were just some variables replacd by arrays).

UnitEscape226.patch

Comment by richlv [ 2015 Jul 31 ]

blacklist was initially implemented in ZBX-2295

Comment by viktorkho [ 2015 Aug 21 ]

Appropriate API method will be useful too

Comment by Aleksandrs Saveljevs [ 2016 Jul 25 ]

ZBXNEXT-3347 asks specifically for microseconds.

Comment by Alexei Vladishev [ 2017 Dec 27 ]

Implemented in pre-4.0.0alpha2, revision76317.

If unit is prefixed with character '!', then no unit prefixes (KMGT) will be applied to item values. It affects displaying of values in front-end as well as server side expansion of macros for alerting.

A few examples:

1024 B -> 1 KB
1024 !B -> 1024 B
61 s -> 1m 1s
61 !s -> 61 s
0 uptime -> 00:00:00
0 !uptime -> 0 uptime
0 ! -> 0
0 !! -> 0 !

Comment by Vitaly Zhuravlev [ 2017 Dec 27 ]

It's good that its finally implemented, but so not obvious. IMHO,either a floating hint should be provided in the item configuration screen or this blacklisting moved to the separate checkbox such as 'do not apply unit prefixes'.

Comment by richlv [ 2017 Dec 27 ]

awesome news, this will make many users happy - and great to see it implemented in such a flexible way.

Vitaly, it being non-obvious does not seem to be such a big hurdle. for example, frequency units are not exposed in the ui, macros in actions, item or trigger config and so on. having a small icon next to each field that would explain all this would be great, but that's a separate thing, tracked at ZBXNEXT-130 .

Comment by Alexei Vladishev [ 2017 Dec 27 ]

By the way, the default blacklist of units should not be used anymore (it still works, but deprecated), instead it must be replaced by !%, !ms, !rpm, etc. The standard templates should be reviewed at some point as well.

Comment by Martins Valkovskis [ 2017 Dec 29 ]

Updated documentation:

sasha CLOSED

Comment by Alexander Vladishev [ 2018 Jan 01 ]

(1) [F] No translation strings changed

CLOSED

Comment by Nicola Mauri [ 2018 Jan 06 ]

In documentation I would replace "Unit blacklisting" with something more comprehensible in the user context, like "Automatic multiplier prefix" or "Preventing multiplier prefix".

Comment by Martins Valkovskis [ 2018 Jan 08 ]

Thanks for the feedback on documentation. The title has been changed to "Preventing unit conversion flexibly".

sasha Thanks! CLOSED

Comment by richlv [ 2018 Jan 08 ]

a new issue to track the default template changes might be useful

Generated at Wed Apr 24 18:03:56 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.