- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- script to alert when File system has reached > 87%
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-06-2010 01:44 AM
12-06-2010 01:44 AM
I know that is a topic that has been here in the forums lots of times, but I´m facing a different scenario. The file system used in the server is veritas, so the format is :
"/dev/vx/dsk/dgrac/data05
104791936 95884935 8350314 92% /data05"
which is different from the O.S. file systems which are:
"/dev/vg00/lvol1 2097152 349280 1734264 17% /stand"
I´m still learning writing scripts, but I´ve not figured out yet how to have an output that will show me if a partcular F.S. either on normal layout or on the veritas format!
So please can you help?
Regards
F.R.
Solved! Go to Solution.
- Tags:
- bdf
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2010 04:13 AM
12-06-2010 04:13 AM
Re: script to alert when File system has reached > 87%
The fields are equivalent, merely split into two lines due to the length of the device file name.
See this thread for more explanation and solutions:
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1369609
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2010 04:22 AM
12-06-2010 04:22 AM
Re: script to alert when File system has reached > 87%
Sorry James, But I dont know where to incorporate your suggestion (bdf | awk '{if (NF==1) {line=$0;getline;sub(" *"," ");print line$0} else {print}}') into the script I have which:
bdf | awk '{ if ( $5 > "90%" ) print $0 }' | mailx -r root@node0.com fretagi@abcd.com
Can you be more specific? Or help?
Regards
F.R.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2010 05:51 AM
12-06-2010 05:51 AM
Solution# bdf | awk '{if (NF==1) {line=$0;getline;sub(" *"," ")};split(line$0,a," ");if (a[5]>90) {print line$0}}' | mailx -r root@node0.com fretagi@abcd.com
The idea is that if two lines are required to report a filesystem, the lines are joined together. We then split the line into fields and test accordingly.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2010 06:09 AM
12-06-2010 06:09 AM
Re: script to alert when File system has reached > 87%
Oops, posted too fast. I'm sure you don't want mail generated unless the alert level is actually exceeded. Do something like:
# RESULTS=$(bdf | awk '/^Filesystem/ {next};{if (NF==1) {line=$0;getline;sub(" *"," ")};split(line$0,a," ");if (a[5]>90) {print line$0}}')
[ -z "${RESULTS} ] || echo ${RESULTS} | mailx -r root@node0.com fretagi@abcd.com
The change above skips the header of 'bdf' and collects any output in a variable called 'RESULTS'. Only if that variable isn't empty do we send mail.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2010 06:31 AM
12-06-2010 06:31 AM
Re: script to alert when File system has reached > 87%
James! Thanks a lot, your first script worked great, but the second there is an error expecting " on this line:
[ -z "${RESULTS} ] || echo ${RESULTS} | mailx -r
I´m going to put that on a cron, to run 3 times a day, that will be enough for the oracle dba and myself.
regards
F.R.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2010 07:50 AM
12-06-2010 07:50 AM
Re: script to alert when File system has reached > 87%
I missed a double-quote:
[ -z "${RESULTS}" ] || echo ${RESULTS} | mailx -r root@node0.com fretagi@abcd.com
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2010 10:09 AM
12-06-2010 10:09 AM
Re: script to alert when File system has reached > 87%
And one last correction for the last stupid mistake. We should strip the "%" from the field before comparing for correctness in all cases. Hence:
# RESULTS=$(bdf | awk '/^Filesystem/ {next};{if (NF==1) {line=$0;getline;gsub(" *"," ")};gsub(/%/,"");split(line$0,a," ");if (a[5]>90) {print line$0}}')
[ -z "${RESULTS}" ] || echo ${RESULTS} | mailx -r root@node0.com fretagi@abcd.com
You could also leverage Bill's script in the original post I cited. Read the documentation that he has in the beginning of his attached script.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2010 10:37 PM
12-06-2010 10:37 PM
Re: script to alert when File system has reached > 87%
Thanks a lot for your help, I guess I need to learn shell script and awk to get to your level of programming.There so much stuff on the net so I dont know where to start
regards
F.R.