PostRemoteLog

Author

Samuel Williams (www.oriontransfer.co.nz/)

Copyright

Copyright © 2009 Samuel Williams

License

GPLv3

PostRemoteLog installs a binary tool “post-remote-log” which collects data about the machine it is being run on, and sends it via XMLRPC or SMTP. It is useful in a system administration scenario when you want to measure statistics over a large number of machines. For example, you can use it as part of login and logout scripts to record when users are logging in and logging out. Additionally, this could record the time it took to log in, and then this could be measured as a performance statistic when deciding to upgrade servers, etc.

Another usage is for recording faults. For example, QuotaCheck.app can hook into post-remote-log to send a notification when a user bypasses the low quota warning. This means that you have a record of the warning, and when the user comes to complain about corrupt files (because the file was saved without enough free space on the users home directory), you can simply tell them to go away and free up space.

PostRemoteLog is very simple and all behavior is controlled using a configuration file. This configuration file specifies how to send the log file and all other details. Here is an example of how to send a log file:

$ echo “The user has logged in ($seconds)” > post-remote-log “User Event” $ echo “The user has logged out” > post-remote-log “User Event”

The configuration file used by default is /etc/post-remote-log.yaml but can be specified using -c option.

$ echo “The user has logged out” > post-remote-log -c specific-config.yaml “User Event”

The command also integrates directly with daemon-exec. Ensure that rexec is installed before using this option.

$ echo “The user has logged out” > post-remote-log -d -c specific-config.yaml “User Event”

This command will relaunch itself using daemon-exec which allows the command to run seemlessly in the event of a network outage. The main use for this is when post-remote-log is used in login and logout scripts, which shouldn’t be delayed if the network is slow.

Included with this package is a basic rack backend which can be used to aggregate the XMLRPC messages into a directory. This can be used for testing and evaluation. However, there is a web interface under development which stores information in a database.

To use the simple backend, you need to install thin:

$ sudo gem install thin $ post-remote-log-server