-
New Feature Request
-
Resolution: Fixed
-
Minor
-
2.2.10
-
Sprint 2, Sprint 4, Sprint 5, Sprint 6, Sprint 7, Sprint 8, Sprint 9, Sprint 10, Sprint 11, Sprint 12, Sprint 13, Sprint 14, Sprint 15
-
24
Custom functions (items) based on External check, User parameter or loadable module often parse output or content of commands resp. files that include information for lots of metrics.
Thanks to parameter support in items keys a single function can be used to extract the value of a particular metric only.
When being interested in many of the included metrics or even all of them, then this can become quite inefficient. For each dedicated metric all information is requested just to ignore values from the other ones (see ZBXNEXT-103).
In best case a loadable module function is used to access a pseudo file.
A rather worse scenario could be the need to run an expensive command or command chain by User parameter:
UserParameter=openvz.ubc[*],/usr/bin/sudo /usr/bin/tac /proc/user_beancounters | awk '/$1/{print $(NF-5+$2);exit}'
The previous User parameter extracts one of five possible values for one of 20 possible resources from OpenVZ's User Beancounters table
When being interested in every available metric this means 100 User parameter calls each obtaining the very same information per OpenVZ container - and there may be hundreds of containers per physical host.
This ticket is about providing a way to improve this by caching all potential information in memory, so that (dynamic provided) custom functions can then extract data from this regularly updated cache.
What I currently think of is introducing a new cache, lets say Bulk Parameter Cache, which may be populated by Bulk parameters.
A Bulk user parameter could look like this:
BulkUserParameter=openvz.ubc,1,sudo tac /proc/user_beancounters | awk ...
What means the agent executes the deposited command every minute and memorizes the output in the designated cache.
The output must follow a common syntax of course, lets say it must result in a list of key value pairs like this:
# sudo tac /proc/user_beancounters | awk '$1=="uid"{for(i=4;i>=0;i--)h[i]=$(7-i);next}$6~/./{r=$(NF-5);for(i=0;i<5;i++)printf("openvz.ubc[%s,%s] %d\n",r,h[i],$(NF-i))}'
openvz.ubc[kmemsize,failcnt] 0
openvz.ubc[kmemsize,limit] 1217787766
openvz.ubc[kmemsize,barrier] 1217604266
openvz.ubc[kmemsize,maxheld] 793927680
openvz.ubc[kmemsize,held] 764308562
openvz.ubc[lockedpages,failcnt] 0
openvz.ubc[lockedpages,limit] 1368
openvz.ubc[lockedpages,barrier] 1368
openvz.ubc[lockedpages,maxheld] 123
--- SNIP --- SNAP --- SNIP --- SNAP ---
On each cache updated new keys get appended, existing key values get updated and missing keys get removed from the cache.
Ideally each in cache existing key becomes dynamically a valid item key available to passive as well as to active agent checks returning the current key value on demand.
By this the expensive part is significant reduced to one call per minimum desired item update interval.
Of course this should not be limited to Bulk user parameters but be also supported for Bulk external checks or for use in loadable modules.
PS: OpenVZ has been chosen as example just because of being easy to parse.
- causes
-
ZBX-12661 Cannot edit item of Type 'Dependent item' from LLD item prototype
- Closed
-
ZBX-13335 Heavy SQL query with huge output in the create() and update() methods for item, item prototype and discovery rule classes
- Closed
-
ZBX-14812 Hex to Decimal does not ignore whitespaces
- Closed
-
ZBX-12618 item became not supported: Item preprocessing step #1 failed: (null)
- Closed
-
ZBX-14396 Template full clone exhaust memory (large system)
- Closed
-
ZBX-12635 Unsupported low level discovery rule fails silently
- Closed
-
ZBX-15539 Incorrect error message when changing item type to dependent item with no master item
- Closed
- depends on
-
ZBXNEXT-4109 Allow to use LLD MACRO value as a value for preprocessor
- Closed
-
ZBXNEXT-4200 Ability to create LLD item prototype of type "dependent" with a master item NOT only item prototype
- Closed
- part of
-
ZBXNEXT-3508 Add embedded script support to item preprocessing options
- Closed
-
ZBXNEXT-3863 Extend item preprocessing with jsonpath function
- Closed
-
ZBXNEXT-3864 Extend item preprocessing with xpath function
- Closed
-
ZBX-12251 New values aren't counted towards trigger functions evaluation
- Closed