Ad Widget

Collapse

How take item value from ItemA to key of ItemB

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Rudlafik
    Senior Member
    • Nov 2018
    • 144

    #1

    How take item value from ItemA to key of ItemB

    Hi,
    reason why I need this was my goal: Take path of Zabbix agent config file, control change/editing on them by vfs.file.checksum and mayby list all non comment line.

    Problem was in our IT (windows)enviroment:
    a. diferent version of ZBX client
    b. diferent variant of ZBX client
    c. nobady know what instalation path of ZBX clients admins use before me

    Nice.

    In first time I spend lot of time observer way by LLD service.discovery. More problems not elegant solution. "dead end road"

    In next step I used the bump that is 1 meter above my ass. Windows Register! :-) This is WAY! The fountain of all Windows OS information! Now it will bee better.

    The following procedure can be used for both LLD and Dependent Items.
    1. Create "discovery rule" or standard Item
    2. Use key registry.get[HKLM\SYSTEM\ControlSet001\Services,values,"^ImageP ath$"]
    3. Set preprocessing (I need 4 steps mayby you will need use 3 - N)
    • Regular expresion ....... [^"-]*zabbix.\w+\.conf ..... \0
    • Replace .... \\\ ...... /
    • Replace .... c c ..... C
    • JavaScript
    Code:
    const tmp = value;
    var output = [];
    output.push({"path":tmp});
    return JSON.stringify(output);
    4. LLD macros {#PATH} $.path
    5. Create Item prototype​
    key: vfs.file.get[{#PATH}]

    And now its all.

    You now know how take value from one item to other item and not talk obout JSON parsing. You nou know how convert item value to JSON format and use ths value as makro in other item. You canot need use some action, alert, event, scripts etc. All is in Zabbix system in template - Nice and clear ;-)

    Ruda
    Last edited by Rudlafik; 08-06-2023, 15:12.
  • Nanocar
    Junior Member
    • Jun 2023
    • 1

    #2
    To get the value by the key, simply specify the key as follows. You can also use the get() method to get the value by the key. When using the get() method, no error will be raised even if you specify a non-existent key. See the following article.​

    Comment

    Working...