Ad Widget

Collapse

Keeping track of swapout rates in Linux and Solaris

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • helixblue
    Junior Member
    • Feb 2005
    • 6

    #1

    Keeping track of swapout rates in Linux and Solaris

    I find it important to track the swapout rates of my UNIX machines, almost as much as it is to track the total swap. Thankfully, vmstat returns these results quite nicely. Linux and Solaris 10 use two different columns (8 and 9 respectively), hence the two different versions:

    Code:
    UserParameter=linuxswap[rate5s],vmstat 5 2 | awk '{ print $8 }' | tail -1
    UserParameter=linuxswap[rateavg],vmstat | awk '{ print $8 }' | tail -1
    
    UserParameter=solswap[rate5s],vmstat 5 2 | awk '{ print $9 }' | tail -1
    UserParameter=solswap[rateavg],vmstat | awk '{ print $9 }' | tail -1
    The rateavg is the average swapout rate since your machine last booted, at least according to the vmstat documentation. Enjoy!
  • Alexei
    Founder, CEO
    Zabbix Certified Trainer
    Zabbix Certified SpecialistZabbix Certified Professional
    • Sep 2004
    • 5654

    #2
    Thanks for your messages! I'm sure they will be useful for many ZABBIX users.

    Just a small note. I wouldn't recommend use of commands which require long execution time as UserParameters. For example, the "vmstat 5 2" needs 2 seconds to return result back to ZABBIX server. It means, that one of ZABBIX sucker processes will block for 2 seconds. At least, this is how it works in 1.0.
    Alexei Vladishev
    Creator of Zabbix, Product manager
    New York | Tokyo | Riga
    My Twitter

    Comment

    • helixblue
      Junior Member
      • Feb 2005
      • 6

      #3
      I try to avoid long-running UserParameter scripts if I can, but I don't know of any other way to go about monitoring these objects. I'm okay with blocking the process for a single test, as it's better to slow things down then ignore possible problems.

      My web performance script sometimes takes over a minute to execute. It seems to work for the most part, though I had to change the Zabbix source to allow execution of up to 120 second.s

      Thanks for the great product!

      Comment

      • Alexei
        Founder, CEO
        Zabbix Certified Trainer
        Zabbix Certified SpecialistZabbix Certified Professional
        • Sep 2004
        • 5654

        #4
        Originally posted by helixblue
        My web performance script sometimes takes over a minute to execute. It seems to work for the most part, though I had to change the Zabbix source to allow execution of up to 120 seconds.
        Consider use of combination of crontab+zabbix_sender+zabbix_trapperd for long running parameters. This will not hurt performance and responsiveness of ZABBIX server.

        Note that if UserParameter timeouts, ZABBIX agent does not kill executed processes. It may lead to situations when same UserParameter is executed several times, and, in some extreme cases, hundreds of times. Why? Because ZABBIX server does not give up in case of timeout and tries to get value of the parameter over and over again. Very dangerous!
        Alexei Vladishev
        Creator of Zabbix, Product manager
        New York | Tokyo | Riga
        My Twitter

        Comment

        • bbrendon
          Senior Member
          • Sep 2005
          • 870

          #5
          This seems like a slightly better solution.
          Code:
          UserParameter=pagesswappedout,vmstat -s|grep 'swapped out' |awk '{ print $1 }'
          Unofficial Zabbix Expert
          Blog, Corporate Site

          Comment

          • clahti
            Senior Member
            • Jan 2007
            • 126

            #6
            Originally posted by Alexei
            Consider use of combination of crontab+zabbix_sender+zabbix_trapperd for long running parameters. This will not hurt performance and responsiveness of ZABBIX server.

            Note that if UserParameter timeouts, ZABBIX agent does not kill executed processes. It may lead to situations when same UserParameter is executed several times, and, in some extreme cases, hundreds of times. Why? Because ZABBIX server does not give up in case of timeout and tries to get value of the parameter over and over again. Very dangerous!
            I am writing three perl wrapper scripts for iostat, vmstat and mpstat that alarms properly (timeout) etc, and I wish to use them with zabbix_sender but this does not work in the current 1.3.2 beta version. I will be happy to post these once I verify they actually work, but until zabbix_sender is fixed in 1.3.x series I am pretty dead in the water. I will be providing templates as well in the cookbook when I post these. I actually will avoid the crontab approach and use a UserParameter in the agent to actually fire the script which will then zabbix_send back multiple items, I have this pretty much ready to go but zabbix_sender is the bottleneck to releasing these...


            /Chris

            Comment

            Working...