I am monitoring several high volume directory using Zabbix. I used du command. I need to monitor in every 60sec. But problem is that Zabbix firing du command in every 60sec. it does not check whether previous du command is running or not. Over time, it leads to several du command running on the mechanic and caused high cpu load. So, how can I calculate directory size within 60sec or less?

  • What do you consider high volume? If du does not finishes, it should be obvious you need a greater time window between probes/polling at least for that probe as an immediate measure. In the long run, it would be better to devise a better strategy to do that. – Rui F Ribeiro Nov 22 '17 at 5:23
  • Thanks for commenting. However, volume is approx 1TB. As I know, df command uses a file to generate the output. Is there anything like that for du? – again Nov 22 '17 at 5:25
  • 2
    As I hinted, you need a better strategy than using du for keeping up with space used. Simple ones that come to mind is keeping each directory in a separate partition, or using quotas for accounting with separate users, or keeping up accounting of space used at the application level if we are talking about data from an app. Your question is about your implementation problem, not an unix problem. Your script could keep the last du output and return it if du is running, however you probably do not want to run du all the time. Work smarter, not harder. – Rui F Ribeiro Nov 22 '17 at 5:29
  • (hint: you do not want du or even df running every single minute. It hurts both the VM being monitored and it does have a negative impact in the Zabbix server where you will have too much queueing if monitoring several servers) – Rui F Ribeiro Nov 22 '17 at 5:39
  • Thank you. I can fire commands from Zabbix server easily. Script can easily solve this problem. A efficient command would be great. However, I will made script. :) and need to transfer the script to target. Thanks again for you time. – again Nov 22 '17 at 5:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.