- Nagios - Switch Interface Traffic
- How To - Linux Server Performance
- Notes - Building New ESXi Host for iSCSI with Jumbo Frames
- Microsoft Office Version Numbers (XP, 2003, 2007, 2010)
- ESXi Custom Welcome Screen Text
- PHP - Read Data from a CSV file
- PHP - Input Variables from URL
- Fix - WMI Error EventID 10
- Fix - EventID 4007 DNS Server Error
- FIX - CHECK_ESX3.PL Script
Tip - Convert Nagios.log Timestamp
If you are like me, you have to dig through some log files to research some errors. The ../var/nagios.log file has alot of data and unfortunately the times stamps are not exactly friendly to read.
[1256314960] EXTERNAL COMMAND: PROCESS_SERVICE_CHECK_RESULT;hostname;servicename;0;Service running OK
Using a little perl command line magic we can convert that ugly timestamp into something more readable.
[Fri Oct 23 11:22:40 2009] EXTERNAL COMMAND: PROCESS_SERVICE_CHECK_RESULT;hostname;servicename;0;Service running OK
Just use...
perl -pe 's/(\d+)/localtime($1)/e' nagios.log
Of course that will spew the entire log. So using grep or tail, you can make it a bit more useful.
perl -pe 's/(\d+)/localtime($1)/e' nagios.log |grep server1 tail nagios.log | perl -pe 's/(\d+)/localtime($1)/e'
- MWalker's blog
- Printer-friendly version
- Login to post comments
-
