- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Help required in shell script
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2010 01:48 AM
12-01-2010 01:48 AM
I want to write a shell script on a linux node for the following requirement:
netstat –an|grep 1522|wc –l
the count should not be greater than 900
Can any one please help me to write the script?
Its an urgent requirement and your immediate help will be highly appreciated and helpful.
Regards,
Sudipta
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2010 02:10 AM
12-01-2010 02:10 AM
Re: Help required in shell script
And you are lousy pointgiver, maybe by trying to appreciate others time you could get better answers?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2010 02:14 AM
12-01-2010 02:14 AM
Re: Help required in shell script
I always assign the appropriate points to people whose suggestions genuinely help me to resolve my issues.
Sorry, You haven't done the same and hence haven't received points.
My aim is to monitor and get alerts as and when the output of the mentioned command exceeds 900. For creating a policy i need to write the script on the managed node
Regards,
Sudipta
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2010 02:51 AM
12-01-2010 02:51 AM
SolutionPlease copy the below script and save it as count.sh
count=`netstat â an|grep 1522|wc â l`
if [ $count > 900 ]; then
/opt/OV/bin/opcmsg a=Script o=count.sh msg_grp=OS severity=Critical msg_text="Count Exceeded"
fi
and execute chmod 755 count.sh in the directory where you saved the script.
And create a message template to capture the alert and schedule the script using schedule template or cron.
Jai.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2010 02:55 AM
12-01-2010 02:55 AM
Re: Help required in shell script
its
count=`netstat -an | grep 1522 | wc -l`
Jai.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2010 03:07 AM
12-01-2010 03:07 AM
Re: Help required in shell script
Assigned 10 points to you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2010 03:22 AM
12-01-2010 03:22 AM
Re: Help required in shell script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2010 03:25 AM
12-01-2010 03:25 AM
Re: Help required in shell script
But I am getting false alerts ..even if the count is not 900, i am getting an alert saying its greater than 900.
I have deployed a scheduled task policy.
Can you please help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2010 03:44 AM
12-01-2010 03:44 AM
Re: Help required in shell script
second - your request is unrelated to OM so ...
third - try "man sh" or "man bash" and find there how integers should be compared algebraically
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2010 03:49 AM
12-01-2010 03:49 AM
Re: Help required in shell script
Please copy the below script
count=`netstat -an|grep 1522|wc -l`
if test $count -gt 900
then
echo "Count Exceeded"
fi