Ad Widget

Collapse

Zabbix agent swap warning on embedded linux

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vip100
    Junior Member
    • Apr 2016
    • 1

    #1

    Zabbix agent swap warning on embedded linux

    Hello.

    We run zabbix agent on embedded linux ARM. It works, but zabbix shows warning: Lack of free swap space on bla_bla_bla. It's clear our system is swapless. May be we assume percent of free swap space on swapless system as 100% not zero ? 0/0 is undefined situation, so we can assume it to be 1, why 0 ?

    Code:
    --- src/libs/zbxsysinfo/linux/swap.c	2014-10-24 15:54:43.000000000 +0400
    +++ src/libs/zbxsysinfo/linux/new-swap.c	2016-04-07 14:48:15.942332280 +0300
    @@ -44,7 +44,7 @@
     	else if (0 == strcmp(mode, "used"))
     		SET_UI64_RESULT(result, (info.totalswap - info.freeswap) * (zbx_uint64_t)info.mem_unit);
     	else if (0 == strcmp(mode, "pfree"))
    -		SET_DBL_RESULT(result, info.totalswap ? 100.0 * (info.freeswap / (double)info.totalswap) : 0.0);
    +		SET_DBL_RESULT(result, info.totalswap ? 100.0 * (info.freeswap / (double)info.totalswap) : 100.0);
     	else if (0 == strcmp(mode, "pused"))
     		SET_DBL_RESULT(result, info.totalswap ? 100.0 - 100.0 * (info.freeswap / (double)info.totalswap) : 0.0);
     	else
  • kloczek
    Senior Member
    • Jun 2006
    • 1771

    #2
    IMO:
    This solution is (a bit) wrong.
    Correct one should have detection of swap device(s) and basing on such detection swap monitoring should be populated over LLD.
    With such approach on systems without swap devices swap agent keys will be simple never used and and you will never see those warning.

    I'm dealing now with systems without swap devs and I'll try to post here my own implementation of Linux and Solaris base OS monitoring templates with examples of how to implement such functionality, so you will be able to use these templates or peak and/or copy how to implement something like this to your templates.
    http://uk.linkedin.com/pub/tomasz-k%...zko/6/940/430/
    https://kloczek.wordpress.com/
    zapish - Zabbix API SHell binding https://github.com/kloczek/zapish
    My zabbix templates https://github.com/kloczek/zabbix-templates

    Comment

    Working...