<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Simple Shell Script to Monitoring Disk Space on a Linux Machine</title>
	<atom:link href="http://kedar.nitty-witty.com/blog/simple-shell-script-to-monitoring-disk-space-on-a-linux-machine/feed" rel="self" type="application/rss+xml" />
	<link>http://kedar.nitty-witty.com/blog/simple-shell-script-to-monitoring-disk-space-on-a-linux-machine</link>
	<description>Kedar&#039;s Blog for MySQL and more</description>
	<lastBuildDate>Fri, 27 Jan 2012 04:35:06 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: to domain name</title>
		<link>http://kedar.nitty-witty.com/blog/simple-shell-script-to-monitoring-disk-space-on-a-linux-machine/comment-page-1#comment-7</link>
		<dc:creator>to domain name</dc:creator>
		<pubDate>Mon, 03 May 2010 10:23:26 +0000</pubDate>
		<guid isPermaLink="false">http://kedar.nitty-witty.com/blog/?p=40#comment-7</guid>
		<description>&lt;strong&gt;hi guys...&lt;/strong&gt;

hi guysI would like to thank you for the efforts you have made in writing this article. I am hoping the same best work from you in the future as well and i have start my own blog now, , thanks for your effort...</description>
		<content:encoded><![CDATA[<p><strong>hi guys&#8230;</strong></p>
<p>hi guysI would like to thank you for the efforts you have made in writing this article. I am hoping the same best work from you in the future as well and i have start my own blog now, , thanks for your effort&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: George</title>
		<link>http://kedar.nitty-witty.com/blog/simple-shell-script-to-monitoring-disk-space-on-a-linux-machine/comment-page-1#comment-6</link>
		<dc:creator>George</dc:creator>
		<pubDate>Wed, 17 Mar 2010 17:28:57 +0000</pubDate>
		<guid isPermaLink="false">http://kedar.nitty-witty.com/blog/?p=40#comment-6</guid>
		<description>This works for me on RHEL 5.4
#! /bin/ksh
#
########################################################################################
# This scripts monitors the disk space utilization and sends an email to the Admins if #
# the amount of disk space for any file system reaches 90% or more. This script will #
# run as an hourly cron job. #
########################################################################################
df -h &#124; grep -iv filesystem &#124; while read LINE; do PERC=`echo $LINE &#124; awk &#039;{print $5}&#039; &#124; sed -e &#039;s/%//&#039;`
if [ $PERC -gt 90 ]; then
echo &quot;The Filesystem ${LINE} on `hostname`&quot; &#124;mail -s &quot;Disk Space Alert&quot; george.moran@aderas.com
fi
done</description>
		<content:encoded><![CDATA[<p>This works for me on RHEL 5.4<br />
#! /bin/ksh<br />
#<br />
########################################################################################<br />
# This scripts monitors the disk space utilization and sends an email to the Admins if #<br />
# the amount of disk space for any file system reaches 90% or more. This script will #<br />
# run as an hourly cron job. #<br />
########################################################################################<br />
df -h | grep -iv filesystem | while read LINE; do PERC=`echo $LINE | awk &#8216;{print $5}&#8217; | sed -e &#8216;s/%//&#8217;`<br />
if [ $PERC -gt 90 ]; then<br />
echo &#8220;The Filesystem ${LINE} on `hostname`&#8221; |mail -s &#8220;Disk Space Alert&#8221; <a href="mailto:george.moran@aderas.com">george.moran@aderas.com</a><br />
fi<br />
done</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kedar</title>
		<link>http://kedar.nitty-witty.com/blog/simple-shell-script-to-monitoring-disk-space-on-a-linux-machine/comment-page-1#comment-5</link>
		<dc:creator>kedar</dc:creator>
		<pubDate>Wed, 17 Mar 2010 06:43:47 +0000</pubDate>
		<guid isPermaLink="false">http://kedar.nitty-witty.com/blog/?p=40#comment-5</guid>
		<description>Hi Vishwa,
Idea in myscript was &quot;grep&quot;ing disk details from df command and using it in script.
I&#039;m not into Oracle yet (&#039;d be interested though) but you may for sure grep the oracle daemon or service information in the script.

About services being stopped:

For mysql if you want to check if it&#039;s running or not we have:
/etc/init.d/mysqld status
Which will report the service status. I think Oracle must be having something like this.

Meanwhile I Googled and found that normally people search for ORACLE_SID or pmon:
ps -ef&#124;grep $ORACLE_SID&#124;grep -v grep&#124;grep -v ora_&#124;wc –l

You may also grep for &quot;pmon&quot;, if that is not running you can say Oracle is down.

Check below script:
#!/bin/sh

ret=`ps -fu oracle &#124; grep ora_smon_ &#124; grep -v grep &#124; wc -l`
echo $ret
if [ $ret -eq 0 ] ; then
  echo &quot;database down&quot;
  # Run script here
else
  echo &quot;database up&quot;
fi

I assume you should find this helpful: orafaq.com/wiki/Scripts.

About unauthorized access:
I&#039;m not sure how will you detect that or what you meant by that!? If X enters as root user, how will you define that X is unauthorised? It&#039;s better to stop unauthorized access by securing your OS settings than detect it later.</description>
		<content:encoded><![CDATA[<p>Hi Vishwa,<br />
Idea in myscript was &#8220;grep&#8221;ing disk details from df command and using it in script.<br />
I&#8217;m not into Oracle yet (&#8216;d be interested though) but you may for sure grep the oracle daemon or service information in the script.</p>
<p>About services being stopped:</p>
<p>For mysql if you want to check if it&#8217;s running or not we have:<br />
/etc/init.d/mysqld status<br />
Which will report the service status. I think Oracle must be having something like this.</p>
<p>Meanwhile I Googled and found that normally people search for ORACLE_SID or pmon:<br />
ps -ef|grep $ORACLE_SID|grep -v grep|grep -v ora_|wc –l</p>
<p>You may also grep for &#8220;pmon&#8221;, if that is not running you can say Oracle is down.</p>
<p>Check below script:<br />
#!/bin/sh</p>
<p>ret=`ps -fu oracle | grep ora_smon_ | grep -v grep | wc -l`<br />
echo $ret<br />
if [ $ret -eq 0 ] ; then<br />
  echo &#8220;database down&#8221;<br />
  # Run script here<br />
else<br />
  echo &#8220;database up&#8221;<br />
fi</p>
<p>I assume you should find this helpful: orafaq.com/wiki/Scripts.</p>
<p>About unauthorized access:<br />
I&#8217;m not sure how will you detect that or what you meant by that!? If X enters as root user, how will you define that X is unauthorised? It&#8217;s better to stop unauthorized access by securing your OS settings than detect it later.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vishwa</title>
		<link>http://kedar.nitty-witty.com/blog/simple-shell-script-to-monitoring-disk-space-on-a-linux-machine/comment-page-1#comment-4</link>
		<dc:creator>Vishwa</dc:creator>
		<pubDate>Wed, 17 Mar 2010 06:10:54 +0000</pubDate>
		<guid isPermaLink="false">http://kedar.nitty-witty.com/blog/?p=40#comment-4</guid>
		<description>I am using Oracle Apps 11i
My OS is RHEL 4.6.

I need to get a email alerts,

when there is a critical issues like unauthorized access or services being stopped..

How i can achieve this ..</description>
		<content:encoded><![CDATA[<p>I am using Oracle Apps 11i<br />
My OS is RHEL 4.6.</p>
<p>I need to get a email alerts,</p>
<p>when there is a critical issues like unauthorized access or services being stopped..</p>
<p>How i can achieve this ..</p>
]]></content:encoded>
	</item>
</channel>
</rss>

