lesovsky / zabbix-extensions

Zabbix additional monitoring modules
BSD 3-Clause "New" or "Revised" License
316 stars 230 forks source link

iostat template changes #65

Closed vikingUnet closed 5 years ago

vikingUnet commented 5 years ago

Hello! I found this repository when needed to control hard disk utilization metrik - large postgresql indexes on zabbix histories and trends tables will cause zabbix iowait >15% trigger problam. iowait utility gives a lot of information about hard disks monitoring and it is great integrating in zabbix server monitoring by using iostat-disk-utilization-template.xml.

Then i done a bit of small changes in this template and i hope this changes will be usefull for other users of this repository:

  1. file iostat-collect.sh
    • fixed error in iostat (v >10) whith order of parameters ("iostat interval count", not "iostat count interval")
    • added iostat option "-d" to awk script to awoid check first column name like "avg-cpu:"
    • added iostat option "-y" to collect clear statistic for selected interval (1 minute) exclude average statistic since OS reboot time (see man iostat for more details), in this way we needs only one last values, so command will be 'iostat -xyd "$SECONDS" 1'
  2. file crontab
    • no longer need to use user name root in cron task line
    • recommendation to collect every minute statistic by iostat-collect.sh for 58 seconds, not for 60, to avoid collisions of executing time (wich operation will be first processed: iostat statistic or cron task?)
    • recomendation to send result of executing in dev/nul to avoid getting emails on each cron task executing (this abblility can be ommited while debugging)
  3. iostat.conf
    • added iostat.summary user parameter to get iostat statistic in JSON format with all metrics for each hard disk, so no longe need to use user parameter iostat.metric[*] (it was needed to call for each hard disk iostat metric!)
    • removed parameter iostat.collect because cron task will calculate iostat statistic hisself zabbix have maximum limit timeout to request no longe 30 seconds, so we can't call iostat.collect by server as zabbix agent item and wait for 1 minute, and thats why we using cron task to deal with iostat - this utility must wait some time in idle mode to do calculate average statistic for 1 minute interval
  4. iostat-disk-utilization-template.xml
    • discovery ruls was chaned: there will be autocreate JSON item iostat.summary with all iostat metrics statistic for each discovered hard disk by macros {#HARDDISK} and then will be autocreate dependet items for each metric from this JSON at his own correct name, key, description and other options. So presently it is no longe need to separately query each metric item by zabbix - it will be processing by postprocessing for each JSON iostat.summary item!
  5. iostat-parse.sh
    • file was removed because iostat metrics presently is processing in zabbix server as dependent items from JSON iostat.summary item for each hard disk