Find the answer to your Linux question:
Results 1 to 3 of 3
Hi I am a total newbie and im sorry if I sound dumb or havent found this in another area of the forums. I need a simple script that will ...
  1. #1
    Just Joined!
    Join Date
    Feb 2010
    Posts
    1

    Unhappy monitor CPU usage

    Hi I am a total newbie and im sorry if I sound dumb or havent found this in another area of the forums.

    I need a simple script that will check the CPU usage of my linux box. Compare that usage to a threshold e.g. 90% and if the CPU usage is equal too or more than 90% it calls another script. I already have the other script I just need something that will check the CPU and check if its above my threshold which I would have hard set in the script somewhere I imagine.

    One other thing, this linux box is multiprocessor so if I do the top command I will see 4 CPU's. I need to check if any of these are above the threshold.

    I will be putting this script in as a cron job to run every X minutes ( havent gotten that far yet)

    Please help me or I will loose my job (not really but it will help me loads)

  2. #2
    Just Joined! KPolulak's Avatar
    Join Date
    Feb 2009
    Location
    New Jersey, USA
    Posts
    42

    Re: monitor CPU usage

    I don't have a complete solution for your problem but I will recommend trying Conky. It's a system monitor that runs on your desktop. In case you're wondering, yes, it will work with a multi-core processor.

    I know Conky has an API for Lua so it may still be possible to implement a script that solves your issue.

  3. #3
    Linux Guru coopstah13's Avatar
    Join Date
    Nov 2007
    Location
    NH, USA
    Posts
    3,149
    look into sar, should be in a package called sysstat for most distros

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...