The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Small-scale SNMP reporting iBot UNIX and Linux RSS News 0 02-12-2008 12:50 PM
sar command not reporting RobSand SUN Solaris 1 10-15-2007 11:36 AM
Reporting SU and Failedlogins janet Shell Programming and Scripting 1 02-24-2006 06:51 AM
Progress reporting Ypnos UNIX for Dummies Questions & Answers 9 05-28-2003 08:25 AM
Reporting Mike11 UNIX for Dummies Questions & Answers 3 12-14-2000 07:48 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 05-22-2008
Registered User
 

Join Date: May 2008
Posts: 2
SNMP time reporting

Hi,

First post, please bare with me.

I am currently using SNMP on Nagios to monitor Exim and all is running great with the exception to it picking up the date / time of the last Exim queue run.

What I am hoping to achieve is for SNMP / Nagios to correctly pickup the difference between the current time and the last queue run.

I am using the below to capture the date / time value ;
Code:
 hostname-f:/etc/snmp# cat /var/log/exim4/mainlog|grep "End queue run"|tail -n1|awk '{ print $1, $2 }'
2008-05-22 10:42:58
However, when I check the snmp, it only takes the first value from the time (: works as a break);
Code:
bash-2.05# ./check_snmp -H xxx.xxx.xx.xx -o .1.3.6.1.4.1.8072.1.3.2.4.1.2.15.115.110.109.112.95.101.120.105.109.95.115.116.97.116.115.10 -w 10 -c 20
SNMP OK - 10
As you can see from my code above I am only trying to get it to display the last date / time as I have no idea where to start with subtracting the values.

Any further info required, give me a shout.

Many thanks in advance.

TheBlueProject
Reply With Quote
Forum Sponsor
  #2  
Old 05-22-2008
Registered User
 

Join Date: May 2008
Posts: 2
It's not perfect but I've found the below does the job.

Instead of doing a date and a time calculation (as I first simply thought of), it will work out the difference in seconds, then divides that by 60, thus displaying the difference in minutes.

Code:
$(( $(( $(( $(date --utc +%s)+3600)) - $(grep "End queue run" /var/log/exim4/mainlog |tail -n1|awk '{ print "date --utc --date \""$1" "$2"\" +%s" }'|sh) )) / 60 ))

Last edited by theblueproject; 05-22-2008 at 09:23 AM. Reason: typo
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 08:02 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0