- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Log file new message monitoring
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
Forums
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
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
09-06-2007 05:44 AM
09-06-2007 05:44 AM
I need to look into a log file for this messages "file system full" and it should alert me if this message is seen which can be achieved rather easily but the problem is if this message has been posted to the log for a long time and I want to be alerted for any new message and not old ones which are already residing in the log file.
How do I achieve this.
Thanks,
Allan.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2007 05:52 AM
09-06-2007 05:52 AM
Re: Log file new message monitoring
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2007 06:11 AM
09-06-2007 06:11 AM
SolutionHere is the main idea of a simple script.
count lines in syslog.log
save this in a file for next time
check current line count with last line count
if different then use tail "-difference of above" syslog.log
If run through cron every 5,10 or 15 minutes it will give you all log entries since the last interval.
You can then be creative on what you want to alert for by using egrep with -vf and a exclude search file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2007 02:45 AM
09-07-2007 02:45 AM
Re: Log file new message monitoring
#!/usr/bin/ksh
. $HOME/.profile > /dev/null
grep "file system full" /var/adm/syslog/syslog.log > ~allanm/1
echo "Sleeping for 500 seconds"
sleep 500
grep "file system full" /var/adm/syslog/syslog.log > ~allanm/2
VAR1=`diff ~allanm/1 ~allanm/2|wc -l`
if [ ${VAR1} -gt 0 ]
then
mailx -s "check file system on b-box for space problems" allanm@tt.com < /dev/null
fi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2007 02:59 AM
09-07-2007 02:59 AM
Re: Log file new message monitoring
You script, as written, will run for one pass (of 500 seconds) only. Eliminate the 'echo' and you could create a cron job with something like:
#/usr/bin/sh
while true
do
...
if [ ${VAR1} -gt 0 ]; then
mailx -s "check file system on b-box for space problems" allanm@tt.com < /dev/null
sleep 500
done
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2007 03:06 AM
09-07-2007 03:06 AM
Re: Log file new message monitoring
I appreciate your desire to tackle this yourself, and am pleased to see you post your own attempts vs asking 'the world' to solve your problem.
But as Court implies, this particular problem has been solved, and so much better so.
When the message 'File system full' appears, it is too late already!
There are several existing tools, freeware and formalware, which monitor disk space and a host of other conditions and will give early warning as well as alerts.
Unless your main goal is to learn scripting, be sure not to re-invent the wheel!
fwiw,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2007 03:07 AM
09-07-2007 03:07 AM
Re: Log file new message monitoring
Sorry, I meant to suggest a startup script, not a cron job, since the amended script runs "forever".
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2007 04:56 AM
09-07-2007 04:56 AM
Re: Log file new message monitoring
Yes Hein I am learning shell scripting so any help is welcome , I want to move to df -k solution where if the threshold is greater than 85% then I need to get notified ( but only ONCE as soon as any file system becomes more than 85% ) ... I want to achieve this through a shell script .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2007 06:05 AM
09-07-2007 06:05 AM
Re: Log file new message monitoring
bdf |
awk '{NF==1?getline n:n="";print $0n}' |
awk 'z[split($5,z,"%")-1] > 90' |
mailx -s "Filesystem > 90%" abc@xyz.com
Bill Hassell has a great script which might be exactly what you're looking for.
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1124262&admit=-682735245+1189187355844+28353475