PushMon – Cloud Based Monitoring for Scripts, Cron Jobs and Batches

Say you run a daily database backup script. How do you make sure it runs successfully in the background? You only want to get notified if there’s an issue. You want something easy to setup and use. There’s a ton of website monitoring services out there, but nothing for behind the firewall processes, scripts, jobs and batches.

You can implement your own monitoring system, which will probably take longer to write than the backup script itself. You need to make sure the machine is up and running. You need to make sure cron or task scheduler is working fine. You need to make sure the network is up. You need to make sure your SMTP server is up. If you have a couple of cron jobs, you will need to do this for each one. Some might suggest Nagios, but now we have a whole monitoring system to be implemented for a few lines of shell scripting. So what normally happens is you send an email every time, which you will tend to ignore after some time, or just manually check it, which you will eventually forget. Now if your database backup normally runs and completes before 3 AM, you will only know of issues when you check your email, which normally is at 8 AM at the earliest.

We wanted an easy solution to this problem. We wanted a Pingdom for scripts and cron jobs. PushMon is the answer. All you need to is 2 minutes to sign up and create a PushMon URL with a daily schedule. You then take this URL, access it when your script succesfully ends, and that’s it. PushMon will expect a “ping” from your script on a daily basis. If it doesn’t hear from your script because it never ran or the backup failed, you will get notified by email, SMS, phone, IM or Twitter. PushMon also has an advanced but easy to use scheduling feature. Using the schedule “by 3 AM every day”, you will get alerted at 3 AM if the script hasn’t accessed the URL at that time. No need to wait for someone to come in and check emails at 8 AM.

You can request for an invite during this beta period at http://www.pushmon.com.


Jenkins and Git on Windows

We recently set up an old Windows XP machine as our Jenkins CI server. Here are the steps we took to make it work.

1. Download and install Jenkins. Here we are going to install the Windows native package.

2. Since Jenkins runs on port 8080 by default and we want this port to be open for other Tomcat instances, edit <JENKINS-HOME>jenkins.xml and change –httpPort=8080 to –httpPort=8081. Also change the AJP port by adding –ajp13Port=8010.

3. Since we have environment variables already setup on User Account, we will change the Jenkins service to use our User Account instead of the default Local System. Change this in Control Panel -> Services. Restart the Jenkins service when prompted.

4. Use Pageant to cache your SSH key passphrase. This is discussed more at the end of this post. You can also temporarily remove the passphrase by running ssh-keygen -p and add it back once you get everything working.

5. To prevent the Git Plugin from hanging, make sure things work via command prompt first. Here we are using a Bitbucket repository. Run

git clone git@bitbucket.org:USERNAME/REPOSITORY.git

If you see the message “The authenticity of host … can’t be established.”, say yes. This is a one time prompt as it will get saved into your known_hosts file. Be on the lookout for multiple known_hosts files in your system.

6. Install the Git Plugin. Go to Manage Jenkins -> Manage Plugins -> Available. Check the Git Plugin, then click “Download now and install after restart”. Click “Restart Jenkins when installation is complete and no jobs are running”

7. Configure Jenkins by going to Manage Jenkins -> Configure System. Set “Path to Git executable” to <GIT-HOME>cmdgit.cmd. Set JAVA_HOME or you can let Jenkins install one automatically. Set MAVEN_HOME or you can also let Jenkins install Maven automatically. You probably want to get notified when a build failure occurs to also setup “E-mail Notification”.

8. Create a new Job and then under Configure -> “Source Code Management”, select Git and set the “Repository URL”. Use SSH URL so we don’t get any interactive prompts. GitHub will look something like

git@github.com:USERNAME/REPOSITORY.git

Bitbucket will look something like.

git@bitbucket.org:USERNAME/REPOSITORY.git

Click “Poll SCM” and set it to the schedule you want, like @hourly for example. Also setup E-mail Notification.

9. Read the official Jenkins Git Plugin page for more information. It has a whole section about The Git Plugin and Windows. It also talks about how to use Pageant if you have a passphrase in your SSH key.