Sponsored Content
Top Forums UNIX for Beginners Questions & Answers High Memory threshold notification script Post 303042492 by seenuvasan1985 on Friday 27th of December 2019 04:48:26 AM
Old 12-27-2019
High Memory threshold notification script

Hello Folks,
I have created the script which use to send email notification when server memory breach the threshold limits. Script works fine, but the issue is sometimes i am receiving mail alerts for lower threshold memory also.
Please let me know why and any updates required in script?

Code:
#!/bin/bash
# Shell script to monitor or watch the high Mem-load
# It will send an email to $ADMIN, if the (memroy load is in %) percentage
# of Mem-load is >= 80%
HOSTNAME=`hostname`
LOAD=80.00
CAT=/bin/cat
MAILFILE=/tmp/mailviews
MAILER=/bin/mail
mailto="skrishna1@xxx.com"
MEM_LOAD=`free -t | awk 'FNR == 2 {printf("Current Memory Utilization is : %.2f%"), $3/$2*100}'`
if [[ $MEM_LOAD > $LOAD ]];
then
PROC=`ps -eo pcpu,pid -o comm= | sort -k1 -n -r | head -1`
echo "Please check your processess on ${HOSTNAME} the value of cpu load is $CPU_LOAD % & $PROC" > $MAILFILE
echo "$(ps axo %mem,pid,euser,cmd | sort -nr | head -n 10)" > $MAILFILE
$CAT $MAILFILE | $MAILER -s "Memory Utilization is High > 80%, $MEM_LOAD % on ${HOSTNAME}" $mailto
fi


Last edited by Scrutinizer; 12-27-2019 at 06:53 AM.. Reason: Please use code tags!!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Unix Script to find and kill a process with high memory utilization

Hi Unix Gurus i am somewhat new to unix scripting so need your help to create a script as below. # This script would find the process consuming memory beyond a certain #limit. if the meemory consumption is more than 100% for a period of 1 # minute for the specific process. the script would... (0 Replies)
Discussion started by: robinforlinux
0 Replies

2. Solaris

How to change CPU threshold high temperature

Hi, I have a NETRA 240 server wich should work on high temperature environment (up to 50 deg celsius). After reaching ~48 deg, the system is shuting down. The HighShutDownThreshold of the CPU is set to 89 deg The PowerOffThreshold of the CPU is set to 96 deg Please help me to change these... (2 Replies)
Discussion started by: Danielz
2 Replies

3. HP-UX

11.31 System Memory too high

Hello, I noticed very high system memory utilization on my new 11.31 Itanium systems. System memory is more than 11GB on 32 GB system. Comparing this to 11.23 it's more than double ... How do I find out what is using it? Is there a way to reduce it? Thank you, Kubo (4 Replies)
Discussion started by: trunecm1
4 Replies

4. Shell Programming and Scripting

help in high memory usage alert script

can any one please help me to shell script high memory usage alert (6 Replies)
Discussion started by: robo
6 Replies

5. Solaris

zone breaching 'capped-memory' threshold

Calling upon all Solaris zone experts. I have a Sun T3-1 that is running a few whole-root zones. I've set the 'capped-memory' setting on all the zones. However, I have a problem on the one zone. Under load it uses more memory that has been allocated to it. zonecfg -z sunrep02 export ... (4 Replies)
Discussion started by: soliberus
4 Replies

6. UNIX for Dummies Questions & Answers

Threshold for swap memory

hi guys the monitoring team is using a tool for monitoring linux boxes and they set an alarm for swap memory to 10%(critical) I really has no idea when swap memory usage is high.... Can someone recommend me a threshold for this? when is warning or critical and this parameters can affect... (3 Replies)
Discussion started by: karlochacon
3 Replies

7. Shell Programming and Scripting

Cron job and shell script to kill a process if memory gets to high

Hello, I'd like to set a cron job that runs a shell script every 30 minutes or so to restart a java based service if the memory gets above 80%. Any advice on how to do this? Thanks in advance! - Ryan (19 Replies)
Discussion started by: prometheon123
19 Replies

8. Solaris

[DOUBT] Memory high in idle process on Solaris 10 (Memory Utilization > 90%)

Hi Experts, Our servers running Solaris 10 with SAP Application. The memory utilization always >90%, but the process on SAP is too less even nothing. Why memory utilization on solaris always looks high? I have statement about memory on solaris, is this true: Memory in solaris is used for... (4 Replies)
Discussion started by: edydsuranta
4 Replies

9. Solaris

High Memory Utilization

Hello Guys, I have one Solaris server with high memory utilization >90%. As per checking, below is the output for memory usage. bash-3.00# ps -efo pmem,uid,pid,ppid,pcpu,comm | sort -r %MEM UID PID PPID %CPU COMMAND 1.7 29496 20668 1 0.0 /opt/app/iw-home/tools/java/bin/java 1.5... (1 Reply)
Discussion started by: myrpthidesis
1 Replies

10. Solaris

How the free memory threshold?

If I understand your question correctly, you are asking for an explanation of Solaris memory manager. You'd better ask Oracle that question because you are talking about Solaris kernel internals. The operating system kernel has no reason to kick a process's memory set out of real memory until... (4 Replies)
Discussion started by: hicksd8
4 Replies
UDHCPC(8)						 GNU/Linux Administrator's Manual						 UDHCPC(8)

NAME
udhcpc - very small DHCP client SYNOPSIS
udhcpc [OPTION]... DESCRIPTION
The udhcp client negotiates a lease with the DHCP server and executes a script when it is obtained or lost. OPTIONS
-c CLIENTID, --clientid=CLIENTID Send the client identifier CLIENTID. -f, --foreground Do not fork after obtaining a lease. -H HOSTNAME, --hostname=HOSTNAME Send the client hostname HOSTNAME. -h HOSTNAME Alias for -H HOSTNAME. -i INTERFACE, --interface=INTERFACE Configure INTERFACE. -n, --now Exit with failure if a lease cannot be obtained. -p FILE, --pidfile=FILE Write the process ID of the daemon to FILE. -q, --quit Exit after obtaining a lease. -r ADDRESS, --request=ADDRESS Request IP address ADDRESS. -s FILE, --script=FILE Use script FILE. -v, --version Display version. USAGE
When an event occurs, udhcpc executes a script. There are four possible arguments to this script: deconfig deconfig is used when udhcpc starts, and when a lease is lost. The script should put the interface in an up, but deconfigured, state. bound bound is used when udhcpc moves from an unbound to a bound state. The script should configure the interface and set any other rele- vant parameters (e.g., default gateway, dns server, etc.). renew renew is used when udhcpc when a lease is renewed. The interface is already configured, so the IP address will not change. Other parameters (e.g., default gateway, subnet mask, dns server) may. nak nak is used when udhcpc receieves a NAK packet from the server. The enviromental variable $message will contain the reason for the NAK message if the server included one. Processing this message is optional, as the script will also be called with deconfig if need be. Parameters are passed to the script via the following environment variables: HOME The inherited HOME, or "/" if it is unset. PATH The inherited PATH, or "/bin:/usr/bin:/sbin:/usr/sbin" if it is unset. interface The interface. ip The client IP address. siaddr The BOOTP next server option. sname The BOOTP server name option. boot_file The BOOTP boot file option. subnet The subnet mask. timezone The timezone offset from UTC in seconds. router The list of routers. timesvr The list of time servers. namesvr The list of IEN 116 name servers. dns The list of DNS servers. logsvr The list of MIT-LCS UDP log servers. cookiesvr The list of RFC 865 cookie servers. lprsvr The list of LPR servers. hostname The host name. bootsize The length in 512-octet blocks of the bootfile. domain The domain name of the network. swapsvr The client's swap server. rootpath The path of the client's root dist. ipttl The TTL. mtu The MTU. broadcast The broadcast address. ntpsrv The list of NTP servers. wins The list of WINS servers. lease The lease time in seconds. dhcptype The DHCP message type (safely ignored). serverid The server IP address. message Reason for a DHCPNAK. tftp The TFTP server name. bootfile The bootfile name. FILES
/usr/share/udhcpc/default.script Script run when leases are obtained or lost. NOTES
udhcpc responds to the following signals: SIGUSR1 This signal causes udhcpc to renew the current lease or, if it does not have one, obtain a new lease. SIGUSR2 This signal caused udhcpc to release the current lease. GNU
/Linux 2001-09-26 UDHCPC(8)
All times are GMT -4. The time now is 03:11 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy