Sponsored Content
Top Forums Shell Programming and Scripting help in high memory usage alert script Post 302559637 by ieth0 on Tuesday 27th of September 2011 06:28:35 PM
Old 09-27-2011
Quote:
Originally Posted by robo
but the real problem is i would like to develop this like
to execute this in an intervals of 5 and if the used% exceeds specified value for consicutive n times and then echo a warning message

can you please do help me in this
use while and sleep :

Code:
#!/bin/bash
times=0

while true;do
used=`free -m |awk 'NR==3 {print $3}'`
total=`free -m |awk 'NR==2 {print $2}'`
result=`echo "$used / $total" |bc -l`
result2=`echo "$result > 0.8" |bc`

if [ $result2 -eq 1 ];then
        let times+=1
        if [ $times -gt 5 ];then
                echo "more than 80% of ram used"
        times=0
        fi
else
        times=0
fi

sleep 5
done

This User Gave Thanks to ieth0 For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Sun: High kernel usage & very high load averages

Hi, I am seeing very high kernel usage and very high load averages on my system (Although we are not loading much data to our database). Here is the output of top...does anyone know what i should be looking at? Thanks, Lorraine last pid: 13144; load averages: 22.32, 19.81, 16.78 ... (4 Replies)
Discussion started by: lorrainenineill
4 Replies

2. AIX

High memory usage in AIX 5.1

Hi, We have AIX 5.1 machine of RAM 8 GB and paging space is 8GB. we are getting high memory usage of almost 99%.Can anybody please help in this ? Partial vmstat o/p kthr memory ----- ----------- r b avm fre 2 1 278727 1143 There is no paging issue.Becoz in... (5 Replies)
Discussion started by: jayakumarrt
5 Replies

3. HP-UX

how can I find cpu usage memory usage swap usage and logical volume usage

how can I find cpu usage memory usage swap usage and I want to know CPU usage above X% and contiue Y times and memory usage above X % and contiue Y times my final destination is monitor process logical volume usage above X % and number of Logical voluage above can I not to... (3 Replies)
Discussion started by: alert0919
3 Replies

4. AIX

How to monitor the IBM AIX server for I/O usage,memory usage,CPU usage,network..?

How to monitor the IBM AIX server for I/O usage, memory usage, CPU usage, network usage, storage usage? (3 Replies)
Discussion started by: laknar
3 Replies

5. AIX

Script to identify high CPU usage processes

Hi Guys, I need to write a script capable of identifying when a high cpu utilitzation process. It sounds simple but we are on a AIX 5.3 environment with Virtual CPU's (VP's) and logical CPU's. Please any ideas or tips would be highly appreciated. Thanks. Harby. (6 Replies)
Discussion started by: arizah
6 Replies

6. UNIX for Advanced & Expert Users

Memory usage shown is high

Hello all, I am facing a memory related issue on my linux that is CentOS 4.0. What I see as an output of top command, free command is that memory usage is almost 90% which is quite high without much load on the system. This is continuously showing 90% or so of memory usage with top or free... (2 Replies)
Discussion started by: radiatejava
2 Replies

7. AIX

AIX memory usage always high

hi, I want to ask , my AIX 6.1 is always used about 97% memory. Is this normal ? or any command can free up memory like Linux ? thanks. (1 Reply)
Discussion started by: virusxx
1 Replies

8. Shell Programming and Scripting

shell script to alert cpu memory and disk usage help please

Hi all can any one help me to script monitoring CPU load avg when reaches threshold value and disk usage if it exceeds some % tried using awk but when df -h out put is in two different lines awk doesnt work for the particular output in two different line ( output for df -h is in two... (7 Replies)
Discussion started by: robo
7 Replies

9. Red Hat

Swap memory usage is high in Linux

Hi , There is one following alert . Message : cdm:Average (2 samples) swap memory usage is now 91%, which is above the warning threshold (90%) Here is my findings. Output of TOP command in Linux server. top - 14:21:44 up 6 days, 4:48, 1 user, load average: 2.55, 2.06,... (3 Replies)
Discussion started by: Maddy123
3 Replies

10. UNIX for Advanced & Expert Users

Troubleshooting sudden high memory usage

Hi, This morning there was an app that caused a sudden spike in I/O and memory usage in the server. We found the reason for the I/O, however the memory spike was something new, as it had never happened before. I figured out what caused the memory spike, however, how do I investigate why... (6 Replies)
Discussion started by: anaigini45
6 Replies
alert(3alleg4)							  Allegro manual						    alert(3alleg4)

NAME
alert - Displays a popup alert box. Allegro game programming library. SYNOPSIS
#include <allegro.h> int alert(const char *s1, *s2, *s3, const char *b1, *b2, int c1, c2); DESCRIPTION
Displays a popup alert box, containing three lines of text (s1-s3), and with either one or two buttons. The text for these buttons is passed in `b1' and `b2' (`b2' may be NULL), and the keyboard shortcuts in `c1' and `c2' as ASCII value. Example: if (!exists(CONFIG_FILE)) alert(CONFIG_FILE, "not found.", "Using defaults.", "&Continue", NULL, 'c', 0); RETURN VALUE
Returns 1 or 2 depending on which button was clicked. If the alert is dismissed by pressing ESC when ESC is not one of the keyboard short- cuts, it treats it as a click on the second button (this is consistent with the common "Ok", "Cancel" alert). SEE ALSO
alert3(3alleg4), gui_fg_color(3alleg4), exgui(3alleg4), expackf(3alleg4), exspline(3alleg4) Allegro version 4.4.2 alert(3alleg4)
All times are GMT -4. The time now is 06:52 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy