Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • 1
    top -b n1 | awk -F, '/load/ {print $4}' is a lot cleaner... Commented Jun 20, 2014 at 9:41
  • 1
    How about loadavg=$( cut -d' ' -f1 </proc/loadavg ) - and no, still not an integer expression. It's a fixpoint. If you want to use -le and friends, consider cut -d' ' -f1 </proc/loadavg | cut -d. -f1, i.e. just drop everything after the integer part. Commented Jun 20, 2014 at 9:59
  • Nagios alread has a check_load. Why are you making your own? Commented Jun 20, 2014 at 10:23
  • 1
    Do the whole thing in awk. awk can do floating points, bash or [ cannot. Commented Jun 20, 2014 at 10:24
  • You can get the load from uptime, not need to run one iteration of top for that. Commented Jun 20, 2014 at 10:25