Five Great Reasons Why We Should Blog

A colleague of mine sent this article to me on why we as devops/webops need to blog. It is a good read.

5 Reasons Why DevOps Should Blog

“By writing we carefully sift through our own thought processes to break it down for novices, or a broader audience. This is a learning process for us, too. It’s therapeutic. But it also hones our message and makes us better teachers. We literally learn by doing.”

MySQL Connectivity Issues with Spoon 4.4.1

I recently installed Pentaho DI 4.4.1. I was previously using PDI 3.2. Transferring my ETL’s to the new PDI installation resulted in this error message (truncated).

Error connecting to database [mysql] : org.pentaho.di.core.exception.KettleDatabaseException: 
Error occured while trying to connect to the database 

Exception while loading class 
org.gjt.mm.mysql.Driver 

Digging around, the full error can be found here:

Exception while loading class mysql.Driver

The answer is provided in the Jira ticket. You need to download and install the MySQL JDBC connector which can be found here:

Download Connector/J

I am using the Windows x64 version so I had to place the jar file here: C:\Program Files\pentaho\design-tools\data-integration\libext

Now I am able to connect to MySQL.

According to Pentaho, they can no longer include the MySQL JDBC connector as it is not compatible with the Apache 4.3 license.

Install Oracle JDK 8 on Ubuntu Server

I am trying to evaluate the MySQL plugin for NewRelic so I have to install a JRE on the MySQL server. Gut instinct tells me to go with Oracle JRE….not the alternatives. So, Here is what I did to install JRE 8.

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer

If you receive an error while adding the ppa, something like this:

error sudo: add-apt-repository: command not found

then

sudo apt-get install python-software-properties

Connection problems to github.com

One of my colleagues had a small issue with pulling the latest from github for my site today. The error was:

ssh: connect to host github.com port 22: Connection refused
fatal: The remote end hung up unexpectedly

Of course the word “fatal” would freak out any non linux user. So a with a little searching the following is the solution.

Add the following to your ./.ssh/config:

host github.com
    hostname ssh.github.com
    port 443

This forces ssh over https for github. All fixed! Now I do not have to bother networking for a firewall rule.

Add Your own Script to Default Run Levels in Ubuntu

This uses the old Sys V init.d scripts. Not upstart. I may write a post on upstart at a later date. So, you write a cool script that you want to run at startup. Place it in /etc/rc.d/init.d and make it executable. Next run the following command:

sudo update-rc.d my_cool_script defaults

This will set the script to run on all the default run levels.

New Relic Plugins

New Relic announced a new plugin framework for their excellent SaaS APM solution. I have installed both the Apache and Redis plugins. Now I have a central location where I can correlate events. The Apache plugin offers insight into counters like requests, worker processes, and cpu load. The Redis plugin offers insight into memory use, keys, and connections.

Both plugins require python, which should not be a problem on all modern distros. Installation was a snap. Simply install the application with pyton pip, move the config file and init file to their respective locations, modify the config to your environment, and start the service. You need to supply your New Relic key. Within minutes you will start seeing data in the dashboard.

Next, I will install the MySQL plugin (requires java).

See:
New Relic Platform

Enumerating Scheduled Tasks using Powershell

I need to get a list of Scheduled tasks from a Windows server out to a third party. So, I was searching for a way to do this via a script. This is the solution I came up with:

param([String]$schedPath="\")
function getTasks($path) {
    $out = @()

    # Get root tasks
    $schedule.GetFolder($path).GetTasks(0) | % {
        $xml = [xml]$_.xml
        $out += New-Object psobject -Property @{
            "Name" = $_.Name
            "Path" = $_.Path
            "LastRunTime" = $_.LastRunTime
            "NextRunTime" = $_.NextRunTime
            "Actions" = ($xml.Task.Actions.Exec | % { "$($_.Command) $($_.Arguments)" }) -join "`n"
        }
    }

    # Get tasks from subfolders
    $schedule.GetFolder($path).GetFolders(0) | % {
        $out += getTasks($_.Path)
    }

    #Output
    $out
}

$tasks = @()

$schedule = New-Object -ComObject "Schedule.Service"
$schedule.Connect() 

# Start inventory
$tasks += getTasks($schedPath)

# Close com
[System.Runtime.Interopservices.Marshal]::ReleaseComObject($schedule) | Out-Null
Remove-Variable schedule

# Output all tasks
$tasks

To execute the script, from the Powershell command prompt, I use the following string:

.\GetScheduledTasks.ps1 \Folder\TasksForMe | Format-Table -Wrap -Property Name,NextRunTime,Actions > FolderTasksForMe.txt

Powershell is not one of my strong points. So, there is probably a lot more to do with this.

Thanks to these two posts:

how to use PowerShell to inventory Scheduled Tasks

How to pass an argument to a PowerShell script?

More Tools!

I love having insight into processes. One thing that we cannot live without are tools. I have been saving these up for a few months, but here is a list of three new (new to me) tools that I have come across.

nkrode – A real-time dashboard for redis. I have actually implemented this, but am not using it currently. We are using a windows port of redis (ugh…) and the dashboard does not seem to pick up certain counters like memory consumption. Using the windows port, not my idea!

Mod Rewrite Generator – Generates a mod_rewrite rule based upon your input. I have not used it yet, but some of my colleagues have used it with success.

Which loads faster – From the developer “web performance
matters” This tool will compare the load time of two sites. It is interesting to compare across browsers, and some friendly competition amongst colleagues! Thanks to Khalid for this one.

E-Commerce KPIs

I was searching for some sort of definition as to what are some good KPIs for an ecommerce business. I came across this article:

32 Key Performance Indicators (KPIs) for Ecommerce

Some of these make perfect sense, like conversion rate, site traffic patterns, and sales. Some of the other KPIs are interesting. Including, the customer service KPIs which, in my experience, I have never taken into account. I suppose the addage “the customer is king” really is important.