Configuration & Administration

Expand all | Collapse all

Monitor swap memory on linux servers

  • 1.  Monitor swap memory on linux servers

    Posted 01-04-2019 12:18 PM

    Hi

    I was wondering would anyone be able to help me. We have a Linux environment and I want to monitor swap memory (not file system swap). What I want to be able to do is get an alert if the swap memory is over 50%.

    I found the below article, I configured the new data source and added the data-point to it as in the article. But when I stressed one of our servers it didn't alert. I had set to 50% and then changed to 30% (here.getRRDValue('memTotalSwap') or 1000000000)* .70

    I'd appreciate any advice.

    Zenoss swap usage threshold as percentage

    Siology remove preview
    Zenoss swap usage threshold as percentage
    For some reason, setting a threshold in zenoss for percentage amount of swap usage is not as easy as you may hope. You can set a threshold as a fixed value easily enough, but doing it as a percentage (such that it will work on machines with differing amounts of ram) is a little more tricky.
    View this on Siology >





    ------------------------------
    Eamon

    ------------------------------


  • 2.  RE: Monitor swap memory on linux servers

    Posted 01-05-2019 04:35 PM
    Edited by Jane Curry 01-05-2019 04:38 PM
    What version of Zenoss are you using???  The getRRDValue trick may not work if you have later than Zenoss 4.

    I think I can improve on the article you found, which should be more generic.  This assumes that your servers are under the /Server/Linux device class.  The standard /Server/Linux Device modeler populates the totalSwap attribute (this value is in bytes not KB).  The attribute is part of the operating system os relationship.  You can look at it using zendmd; for example, for device zen42.class.example.org:

    zendmd
    d=find('zen42.class.example.org')
    d.os.totalSwap

    You can use this value in a threshold. I might start by creating a local template on a test device - use the action icon and "Override template here".  Choose the Device (/Server/Linux) template to override.  Then go to ADVANCED -> Monitoring Templates, choose Device and find the specific template for your overriden device.

    In that template, create a new threshold based on the memAvailSwap datasource - as shown in your referenced document.  In the Min value, use the expression:
    (here.os.totalSwap or 1000000000)/1024* .70
     for a threshold where available swap is less than 70% or, putting it another way, swap used is over 30% of the total.  Remember that here.os.totalSwap is in bytes and your memAvailSwap datapoint is in Kb (just the way that SNMP is used to gather these values).

    That is working for me on a Zenoss Core 4.2.5 and I think should be generic enough to work on any version of Zenoss.

    I will add a couple of screenshots with the template and the resulting event detail.

    Cheers,
    Jane

    ------------------------------
    Jane Curry
    Skills 1st United Kingdom
    jane.curry@skills-1st.co.uk
    ------------------------------



  • 3.  RE: Monitor swap memory on linux servers

    Posted 01-10-2019 04:46 AM
    Hi Jane,

    Thanks, I configured on Tuesday and works great. Once I configured yours, I realized I had made a silly mistake with the original. I can confirm both work for swap memory on version 4.2. Although I have to say I understand it better now. I would have replied sooner, except I had wanted to come back with a transform to turn the KB into a percentage. Haven't figured that out yet.
      Just to let you/people know. There is however one issue, with our AWS nodes (Linux as well) they give a false result and alert constantly. This is not an issue for us, we are just going to create a new template for them.
    Once again thanks, really appreciate it.

    Éamon

    ------------------------------
    Eamon B
    I
    N/A
    ------------------------------