zabbix_export: version: '6.0' date: '2021-11-21T22:04:12Z' groups: - uuid: b1a65eeba3cc4c9fb198e8f18f433839 name: 'Templates/Operating Systems' templates: - uuid: a81a5e460d8e420baab75a080d5f2375 template: 'LVM Cache' name: 'LVM Cache' description: | ## Description LVM cache monitoring Details in kernel documentation https://www.kernel.org/doc/Documentation/device-mapper/cache.txt ## Overview LVM Cache monitoring template. ============================== allows you to evaluate the efficiency of caching by the built-in dm-cache mechanism. **What do these values mean?** ------------------------------ Details about monitored values described in Linux Kernel Documentation **Usage** --------- 1. Put file lvmcache.conf to /etc/zabbix/zabbix\_agent.d/ 2. Put file sudoers\_lvmcache to /etc/sudoers.d/ (you need `sudo` program installed) 3. Put file vmcache to /etc/zabbix/scripts/. Then you can execut this file and test. This script produces JSON output. 4. Import the [`lvmcache_template.xml`](https://github.com/pavlozt/somezabbixtemplates/blob/master/lvmcache/lvmcache_template.xml) into your Zabbix server (click on the `Raw` button to download) 5. Add the template to your host 6. Check if new data arrives at Last Data section and Graphs. This script assumes that you have **ONLY ONE caching device** and polls the first device. Therefore, it does not require configuration and specifying a device name. Working with disks implies elevated privileges and therefore you need do not forget about sudoers\_zabbix\_lvmcache file. **Commands for debugging** -------------------------- * dmsetup status * /etc/zabbix/scripts/lvmcache * zabbix\_get -s 192.168.1.1 -k 'lvmcache.raw' (on zabbix server or zabbix proxy) ## Author pavlozt groups: - name: 'Templates/Operating Systems' items: - uuid: 6245993545644076a677d67342856d8e name: demotions type: DEPENDENT key: lvmcache.demotions delay: '0' history: 30d preprocessing: - type: JSONPATH parameters: - $.demotions - type: SIMPLE_CHANGE parameters: - '' master_item: key: lvmcache.raw tags: - tag: Application value: 'LVM Cache' - uuid: c4fc7c3dd5f7484fb1c39dffed61ce57 name: dirty type: DEPENDENT key: lvmcache.dirty delay: '0' history: 30d preprocessing: - type: JSONPATH parameters: - $.dirty master_item: key: lvmcache.raw tags: - tag: Application value: 'LVM Cache' - uuid: 99c56641bbdc4250b6acd19e1189640b name: 'LVM meta cache usage' type: CALCULATED key: lvmcache.metausage delay: 3m history: 30d value_type: FLOAT params: last(//lvmcache.used_metadata_blocks)/last(//lvmcache.total_metadata_blocks) tags: - tag: Application value: 'LVM Cache' - uuid: 4a297395cc364b35b97c9047a992be22 name: promotions type: DEPENDENT key: lvmcache.promotions delay: '0' history: 30d preprocessing: - type: JSONPATH parameters: - $.promotions - type: SIMPLE_CHANGE parameters: - '' master_item: key: lvmcache.raw tags: - tag: Application value: 'LVM Cache' - uuid: 2d4c600613d24cac838f6e514dc4c434 name: 'lvm raw data' key: lvmcache.raw delay: 3m history: '0' trends: '0' value_type: TEXT preprocessing: - type: CHECK_JSON_ERROR parameters: - $.values tags: - tag: Application value: 'LVM Cache' - uuid: 9cd1a4801c8c4d29a954ab9f1ad061ea name: read_hits type: DEPENDENT key: lvmcache.read_hits delay: '0' history: 30d preprocessing: - type: JSONPATH parameters: - $.read_hits - type: SIMPLE_CHANGE parameters: - '' master_item: key: lvmcache.raw tags: - tag: Application value: 'LVM Cache' - uuid: 7f3f12b6642a4afdb91b10ed522144f2 name: total_cache_blocks type: DEPENDENT key: lvmcache.total_cache_blocks delay: '0' history: 30d preprocessing: - type: JSONPATH parameters: - $.total_cache_blocks master_item: key: lvmcache.raw tags: - tag: Application value: 'LVM Cache' - uuid: 9f427a2388e24f9ba510d28160db20b5 name: total_metadata_blocks type: DEPENDENT key: lvmcache.total_metadata_blocks delay: '0' history: 30d preprocessing: - type: JSONPATH parameters: - $.total_metadata_blocks master_item: key: lvmcache.raw tags: - tag: Application value: 'LVM Cache' - uuid: 18e54b4030194ce9a69d28204d403fc0 name: 'LVM data cache usage' type: CALCULATED key: lvmcache.usage delay: 3m history: 30d value_type: FLOAT params: last(//lvmcache.used_cache_blocks)/last(//lvmcache.total_cache_blocks) tags: - tag: Application value: 'LVM Cache' - uuid: 7589e8fc80734474ab47b53ebfc1ce37 name: used_cache_blocks type: DEPENDENT key: lvmcache.used_cache_blocks delay: '0' history: 30d preprocessing: - type: JSONPATH parameters: - $.used_cache_blocks master_item: key: lvmcache.raw tags: - tag: Application value: 'LVM Cache' - uuid: 5ab792a5426349d3b0da44850f78d11b name: used_metadata_blocks type: DEPENDENT key: lvmcache.used_metadata_blocks delay: '0' history: 30d preprocessing: - type: JSONPATH parameters: - $.used_metadata_blocks master_item: key: lvmcache.raw tags: - tag: Application value: 'LVM Cache' - uuid: 122659ef11314ff1bfb6ef6b8c5151ac name: write_hits type: DEPENDENT key: lvmcache.write_hits delay: '0' history: 30d preprocessing: - type: JSONPATH parameters: - $.write_hits - type: SIMPLE_CHANGE parameters: - '' master_item: key: lvmcache.raw tags: - tag: Application value: 'LVM Cache' - uuid: 8b38f882decb4f79ac009aeac611c005 name: write_misses type: DEPENDENT key: lvmcache.write_misses delay: '0' history: 30d preprocessing: - type: JSONPATH parameters: - $.write_misses - type: SIMPLE_CHANGE parameters: - '' master_item: key: lvmcache.raw tags: - tag: Application value: 'LVM Cache' graphs: - uuid: 4a22b6726cc840a28208481b598e34ad name: 'LVM Cache efficiency' graph_items: - color: 1A7C11 item: host: 'LVM Cache' key: lvmcache.read_hits - sortorder: '1' color: F63100 item: host: 'LVM Cache' key: lvmcache.write_hits - sortorder: '2' color: 2774A4 item: host: 'LVM Cache' key: lvmcache.write_misses - uuid: e5ed1f0742444dbc92e22b394dbd4aa0 name: 'LVM Cache usage' show_work_period: 'NO' show_triggers: 'NO' graph_items: - color: F63100 item: host: 'LVM Cache' key: lvmcache.usage - sortorder: '1' color: 2774A4 item: host: 'LVM Cache' key: lvmcache.metausage