Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

After seeing a question here

I want to have a configuration in my Ubuntu system so that if the cpu processing exceeds 90%, it gives a beep sound. Is this possible?

Also, where else can this beep sound be used? Can it be used if the hard disk utilisation exceeds 80% ?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

I want to have a configuration in my Ubuntu system so that if the cpu processing exceeds 90% it gives a beep sound. Is this possible?

Yes. I wrote a script that plays a notification sound when CPU load average exceeds 90% (accounting for all cores).

The system speaker is, by default, disabled on Ubuntu systems, hence using one of the standard notification sound seems a better choice for this.

To run it, simply download the script (save it as notify-highload.sh), and copy to your home directory. Then, from a terminal, run chmod +x ./notify-highload.sh, followed by ./notify-highload.sh -ag &.

If you want it to run every time on start up, add the script to your Startup Applications.

Also, where else can this beep sound be used? like can it be used if the Hard Disk space exceeds 80%.

Yes, it can. I wrote a script available here.

I will add a few more later on.

share|improve this answer
    
Thanks for the answer, this script when initiated will automatically run in the cycle of 5 seconds to check the cpu load? –  Tarun Sep 23 '13 at 4:53
    
Yes. You can change the duration if you like. –  AsheeshR Sep 23 '13 at 4:55
    
Is there any other way as well other than using a shell script which sleeps for 5 seconds. I hope it wouldn't increase the cpu load due to it? –  Tarun Sep 25 '13 at 6:18
    
Any way of checking will involve either some script or a daemon or a full fledged application. It will obviously have an overhead involved, but the overhead is almost negligible. –  AsheeshR Sep 25 '13 at 6:51
    
What's the use of set command here? why use it? Thanks –  Tarun Sep 26 '13 at 8:10

Monit is a free open source utility for managing and monitoring, processes, programs, files, directories and filesystems on a UNIX system. Monit conducts automatic maintenance and repair and can execute meaningful causal actions in error situations.

What Monit can do

You can use Monit to monitor daemon processes or similar programs running on localhost. Monit is particular useful for monitoring daemon processes, such as those started at system boot time from /etc/init.d/. For instance sendmail, sshd, apache and mysql.

In difference to many monitoring systems, Monit can act if an error situation should occur, e.g.; if sendmail is not running, Monit can start sendmail again automatically or if apache is using too much resources (e.g. if a DoS attack is in progress) Monit can stop or restart apache and send you an alert message. Monit can also monitor process characteristics, such as; how much memory or cpu cycles a process is using.

You can also use Monit to monitor files, directories and filesystems on localhost. Monit can monitor these items for changes, such as timestamps changes, checksum changes or size changes. This is also useful for security reasons - you can monitor the md5 or sha1 checksum of files that should not change and get an alert or perform an action if they should change.

Monit can monitor network connections to various servers, either on localhost or on remote hosts. TCP, UDP and Unix Domain Sockets are supported. Network test can be performed on a protocol level; Monit has built-in tests for the main Internet protocols, such as HTTP, SMTP etc. Even if a protocol is not supported you can still test the server as you can configure Monit to send any data and test the response from the server.

Monit can be used to test programs or scripts at certain times, much like cron, but in addition, you can test the exit value of a program and perform an action or send an alert if the exit value indicates an error. This means that you can use Monit to perform any type of check you can write a script for.

Finally, Monit can be used to monitor general system resources on localhost such as overall CPU usage, Memory and Load Average.

Download: Install via the software center

Install with Ubuntu Software Center: Monit Install monit

share|improve this answer
1  
Can I use beep utility for the same? –  Tarun Sep 20 '13 at 12:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.