Monday, August 19, 2013

Nagios Log File Time Conversion [Human Readable]

To tail the file online:
tail -f /var/log/nagios3/nagios.log | perl -pe 's/(\d+)/localtime($1)/e'
To convert certain time stamp:
echo 1376930831 | perl -pe 's/(\d+)/localtime($1)/e'
Mon Aug 19 19:47:11 2013

Ubuntu APT Proxy Settings

Open apt configuration file
vim /etc/apt/apt.conf
and add the following:
Acquire::http::Proxy "http://username:password@proxyhostname:port";
The syntax shown above should be strictly followed.

This configuration may fail if your username or password has an '@' in it. You can also add proxy configuration for other protocols such as FTP.