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)
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
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);
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
Comment