Tuesday, December 4, 2007

Postgres on Cygwin

I'm working on a project that requires database support and I decided to use Postgres on Cygwin. I encountered mild difficulty (and lots of confusion) in setting it up so I decided to document what I have done. Here goes..

Install and run Cygserver as background service

The Cygwin User's Manual states that Cygserver provides Cygwin applications with services which require security arbitration or which need to persist while no other cygwin application is running.

Once installed as a service, you can start cygserver by running the net start cygserver command. Consequently, the service can be stopped by issuing a net stop cygserver command.

Create the postgres Windows user account

The account shall be used to run postgres as a service. Execute the command mkpasswd -l > /etc/passwd to update the local password file.

Additionally, grant the postgres account the rights to Logon as a service. This can be done by using the local security policy editor found under the Administrative Tools of the Windows Control Panel.

Initialize the database

Initialize the database by executing the command initdb -D {dir}. Popular choices for data directory are /var/postgresql/data, /usr/local/pgsql/data, or variations thereof. Change the ownership of the data directory and its sub-directories to postgres.

Install the postmaster service

Firstly, change the ownership of /usr/sbin/postgres.exe to postgres. Install postmaster as a service by running the command

cygrunsrv --install postmaster --disp "CYGWIN postmaster" --path /usr/sbin/postmaster --args "-D /usr/local/pgsql/data -i" --dep cygserver --termsig INT --shutdown --env CYGWIN=server --user postgres

The dependency (--dep) option automatically launches cygserver, if not yet started, when the postmaster service is started.

My Configuration:

- Windows XP Prof Service Pack 2
- Cygwin DLL release version 1.5.24(0.156/4/2)
- PostgreSQL version 8.0.7

Saturday, November 3, 2007

SNMP monitoring using getif and nagios

I use getif. a free Windows GUI-based network tool written by Philippe Simonet, to make a quick query of SNMP values from SNMP informant. You may download getif here.

Once installed, place the downloaded MIBs of SNMP-Informant under the Mibs sub-directory of GETIF. Here's a screenshot of getif in action:


For continuous monitoring of servers and networks, I use nagios to regularly poll environmental and performance statistics. The results can be graphed for better visualization and reporting.

Here are the pertinent nagios service and command configuration entries..

define service{
hostgroup_name windows
service_description mb-temp
check_command check_mbtemp!40!42
use template-service
}

define command{
command_name check_mbtemp
command_line $USER1$/check_snmp -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ -o .1.3.6.1.4.1.9600.1.10.6.1.5.1 -l 'MB temp' -u 'Celsius (Warn=$ARG1$ Crit=$ARG2$)'
}

Monday, October 15, 2007

Motherboard Monitor and SNMP Informant

Motherboard Monitor is a program that reports your system's cpu temperature, fan speed and voltage readings using the built-in sensors on the processor and motherboard. It is freeware and can be downloaded here.

SNMP Informant-MBM is a Windows SNMP extension agent that makes data collected by Motherboard Monitor accessible via SNMP. This makes it possible for network management tools like Nagios and Cacti get low-level information from a wide array of motherboards.

A similar functionality is available from Speedfan and its SNMP extension. However, Speedfan does not allow itself to be run as a Windows service making it inappropriate for unattended monitoring.

Sunday, October 14, 2007

Monitoring CPU Temperature

One of my favorite computer diagnostics package is Everest from Lavalys, Inc. It gives you a load of information about your computer without taking off its cover. Well, you still couldn't tell the temperature of your CPU even if you popped open the hood -- and that's something that Everest can do, with a clean graphical interface to boot.


An overheating CPU can be caused by poor airflow, clogged fan, poor heatsink contact, or dirt build-up among other factors. It can also be caused by processor-intensive tasks or a misbehaving computer virus.

Whatever the underlying cause, a high CPU temperature is a good indicator of an impending computer malfunction. It would be nice of we can capture the CPU temperature periodically, graph it and issue alerts when a critical threshold is breached. Now that's a job for Nagios.


In the succeeding posts, we'll see how this was done.

Monday, February 12, 2007

Push Email via WM5 ActiveSync

Push email is used to describe the ability to deliver (or push) messages to clients as they arrive at the mail server. Compare this against the traditional email — you need to fire up your favorite email client like Outlook, Eudora or web-based Yahoo/Hotmail in order to know whether you have email. With the advent of web-connected PDAs and PocketPCs, push technology provides the capability to deliver your email wherever you are — a feature which made Blackberry synonymous to push email.

The success of Blackberry has spurred the challenge to provide a similar experience in other portable devices. For Windows-powered mobile devices, here’s how to set it up fast:

  • Create a mail2web LIVE account. The mail2web service provides free accounts on Exchange servers which includes ActiveSync support.
  • Start ActiveSync in your Windows Mobile device and configure Server. Set server address as mobile.exchange@mail2web.com and provide your mail2web user-id and password. Use ad2 as the domain.




The direct push feature not only delivers email but also calendar, contacts, and tasks as well. Direct push is implemented by means of the Messaging and Security Feature Pack for Windows Mobile 5.0. Check your phone vendor for a a possible ROM upgrade in order to enjoy direct push technology.