Friday, January 29, 2010

Cacti Graph for E1s on Cisco AS5350

I stumbled across this thread while searching for a way to graph E1s on a Cisco AS5350. The initial post points to Barry O'Donovan's website post detailing the specifics. I tried importing the xml file directly, but I got an error: "Hash version does not exist". Some more Googling led me to believe that this was related to the Cacti version.

Since I wasn't really in the mood to upgrade Cacti then and there for this one graph, I decided to recreate as much as I could of the graph using the information Barry had helpfully provided.

Data Sources
The first step is to configure the Data Sources. I'm sure there's a way to simplify this, but I haven't figured it out yet, so you'll need 1 Data Source for all active channels and 1 Data Source per E1.

All Active Channels
Go to Data Sources->Add, and use the following:
Selected Data Template: SNMP - Generic OID Template
Host: Choose the host for this Data Source

Click on Create to go to the next configuration page.

Change the following fields:
Name: |host_description| - Active Channels

Click Save and you're done.

E1 x/x
You'll do the same thing for the E1s, except for the following:
Name: |host_description| - E1 2/0
OID: .

The last 2 digits of the OID are the slot and port numbers. For E1 2/0, it's .2.0, for E1 3/1, it would be .3.1

Do this for each E1.

Graph Template

Now, we need to add a new graph template. Here are the fields I changed:
Name: AS5350 E1 Usage
Title (check Use Per-Graph Value): |host_description| - E1 Usage
Vertical Label (check User Per-Graph Value): Channels

Click Create and we'll start creating the actual graph.

Graph Item Inputs
First, we'll need to add our inputs. For this, I'm only going to use 2 E1s to show you how it's done. My production config has 2 templates: one for 2xE1 cards and one for 4xE1 cards.

For now, just add the name and use Field Type: Data Source.

I created 3, one for each E1 and one for all Active Channels.

Graph Template Items
Next, we'll add the Graph Template Items. You'll have 4 entries for each Data Source: the graph itself, and 3 GPRINT values for current, average and maximum.

The last picture doesn't show it, but check Insert Hard Return for the last value. It will show up as

on the main template page.

You should now have the following:

You'll notice I changed the colors around from the previous screenshots. The main things to note are the Graph Item Types and the CF Type.

Also, Cacti may automatically add a Data Source [snmp_oid] field. Go ahead and delete it.

Now, we need to go through our Data Sources and make sure they match up with their graph items.

Save the template and we're ready to create our graph.

Creating the Graph
Go to Graph Management and Add a new graph. Use the template we just created, and then select the appropriate Data Sources. If all goes well, your graph should look like this:

ERROR:the RRD does not contain an RRA matching the chosen CF
This error had me stumped for a while, but I found the answer on this thread on the Cacti Forums.

Here's the crucial piece of information:

LAST appears to work fine in a GPRINT but in an AREA or LINE no joy 
After changing the Line to Average, but leaving the GPRINT as Last, everything worked fine. You can see that the graphs for the E1s are set to Last, but the line graph for all of the channels is set to Average.

Thursday, January 28, 2010

Flash Bitching

Once again, there is much wailing and gnashing of teeth against the lack of Flash on the iPad. Since it's based on the iPhone OS, the lack of Flash support isn't surprising. However, after reading the multitude of comments deriding the device for this perceived shortcoming, I began to wonder exactly how much Flash impacts my browsing habits.

So, for the next month I'll be updating this post whenever I come across a page that requires Flash support in order to be useful.

Therefore, here are my exceptions:
- YouTube doesn't count. Most of the content is streamed in h264 anyway and, besides, there's an App for that.
- Flash ads, banners, etc. don't count either. I use ClickToFlash for a reason.

I'll start off the first entry with the sites that my son goes to for games:
- assorted others

While searching for Phineas and Ferb episodes, I came across the Phineas and Ferb iPhone App: iTunes Link. It perfectly replicates the games at

Even though the App is $1.99 and the website is free, it's still a viable alternative to the Flash game.

Flash Porn
Saw this today as well:

My purely unscientific, and for research purposes only, survey of major porn sites has revealed that almost all of them have mp4 feeds. Score another one for the iPhone/iPad.

Only one instance of Flash since the last update:

Read in a tweet from @pogue. Cool animation, but these are the kinds of things that I'm thinking HTML5 can do better.

And I'm stopping here. After seeing this, I'm pretty much saying goodbye to Flash.

Thursday, January 21, 2010

Cronjobs in Snow Leopard

Great instructions here:

Works perfectly in Snow Leopard. A quick way to check your plist is to do ''open local.your.plist" from Terminal. That will open it in the plist editor and/or complain if there are any errors.

Tuesday, January 19, 2010

Apple to use Bing as default search on iPhone? No. Just, no.

According to a recent Businessweek article, Apple and Microsoft are in talks to replace Google with Bing as the default search engine on the iPhone.

Without even thinking too hard, I can come up with 3 reasons why this is not going to happen.

1. Google still owns the search engine market
Even the article itself mentions that of people who use mobile search, 86% used Google in November while only 11% used Bing. Why would Apple gimp search on the iPhone?

2. Google has a way better track record than Microsoft in regards to search engines
Bing is just the latest incarnation of Microsoft's attempt to be relevant in the search engine game. From MSN search, to Windows Live Search, to Bing, Microsoft has consistently failed to gain any traction. Conversely, Google has been one top almost the entire time.

3. The Apple/Google rivalry is completely overplayed
I doubt that there is anywhere near the level of animosity between Apple and Google as the mainstream media would have you believe.

Monday, January 18, 2010

Geektool Setup

Geektool is a system preference pane that allows you to display different information on your desktop.

Here's my setup:

Disk Information
Type: Shell
Command: df -h

Filesystem      Size   Used  Avail Capacity  Mounted on
/dev/disk0s2   186Gi  182Gi  4.1Gi    98%    /
devfs          113Ki  113Ki    0Bi   100%    /dev
map -hosts       0Bi    0Bi    0Bi   100%    /net
map auto_home    0Bi    0Bi    0Bi   100%    /home
I normally use this to see how much space I'm using on my drives.

System Log
Type: File
File: system.log
Output: Too long to list
A running system.log is pretty useful. If anything seems to be misbehaving, I can check the log and see if there's any crazy going on. I usually only show about 5 or 6 lines of the log.

Type: Shell
Command: ls -alh /var/vm
total 16777216
drwxr-xr-x  16 root  wheel   544B Jan 18 12:10 .
drwxr-xr-x  26 root  wheel   884B Aug 30 15:45 ..
-rw------T   1 root  wheel   3.0G Jan 18 09:01 sleepimage
-rw-------   1 root  wheel    64M Jan  5 17:53 swapfile0
-rw-------   1 root  wheel    64M Jan 18 14:05 swapfile1
-rw-------   1 root  wheel   512M Jan 18 14:05 swapfile10
-rw-------   1 root  wheel   512M Jan 18 13:23 swapfile11
-rw-------   1 root  wheel   512M Jan 18 14:05 swapfile12
-rw-------   1 root  wheel   128M Jan 18 14:05 swapfile2
-rw-------   1 root  wheel   256M Jan 18 14:05 swapfile3
-rw-------   1 root  wheel   512M Jan 18 14:05 swapfile4
-rw-------   1 root  wheel   512M Jan 18 14:05 swapfile5
-rw-------   1 root  wheel   512M Jan 18 14:05 swapfile6
-rw-------   1 root  wheel   512M Jan 18 14:05 swapfile7
-rw-------   1 root  wheel   512M Jan 18 14:05 swapfile8
-rw-------   1 root  wheel   512M Jan 18 14:05 swapfile9
As you can see, I'm using quite a bit of disk space on the swapfiles. Right now, most of these are the result of having Safari open with a ton of windows. Mostly, this helps me figure out why I suddenly lost 6GB of space.

Uptime and System Load
Type: Shell
Command: /usr/bin/uptime
14:08  up 12 days, 20:16, 3 users, load averages: 1.19 1.28 1.16
Self-explanatory for the most part.

Battery Info
Type: Shell
Command: perl /path/to/
The contains the following code:


my $charge = 0;
my $full = 0;
my $amperage = 0;
my $voltage = 0;
my $cycles = 0;

@powerinfo = `system_profiler SPPowerDataType`;

foreach $item (@powerinfo)
if ($item =~ /apacity/)
@temp = split(/:/, $item);
$temp[1] =~ s/\n//g;
$temp[1] =~ s/\r//;
$temp[1] =~ s/ //gi;
$full = $temp[1];

if ($item =~ /remaining/)
@temp = split(/:/, $item);
$temp[1] =~ s/\n//g;
$temp[1] =~ s/\r//;
$temp[1] =~ s/ //gi;
$charge = $temp[1];

if ($item =~ /Amperage/)
@temp = split(/:/, $item);
$temp[1] =~ s/\n//g;
$temp[1] =~ s/\r//;
$temp[1] =~ s/ //gi;
$amperage = $temp[1];

if ($item =~ /Voltage/)
@temp = split(/:/, $item);
$temp[1] =~ s/\n//g;
$temp[1] =~ s/\r//;
$temp[1] =~ s/ //gi;
$voltage = $temp[1];

if ($item =~ /Cycle/)
@temp = split(/:/, $item);
$temp[1] =~ s/\n//g;
$temp[1] =~ s/\r//;
$temp[1] =~ s/ //gi;
$cycles = $temp[1];

print "$charge/$full mAh | $amperage mA | $voltage mV | $cycles cy | ";

if ($amperage < 0)
$chargetime = $charge / $amperage * -1 * 60;
$chargetime = ($full - $charge) / $amperage * 60;

print int(($charge/$full)*100) . "%" . 
" | " . int($chargetime) . " min".
4207/4831 mAh | 888 mA | 12456 mV | 162 cy | 87% | 42 min
This one took a bit of figuring out. The command system_profiler SPPowerDataType provides all the necessary info, and the Perl script parses that and formats it properly.
Some notable formulas:
% Charge: current charge / capacity (in mAh)
Charge Time:
When on battery, amperage is listed as a negative number since power is being drawn from the battery so we need to multiply by -1 to get a positive value. In that case, the formula is - current charge / amperage * -1 * 60 (in minutes)
When the charger is plugged in, amperage is listed as a positive number representing how much power is being sent to the battery. You also have to calculate how many mAh are left to go for a full charge. In that case, the formula is - (capacity - current charge) / amperage * 60 (in minutes)

Charging Indicator, Battery Health Indicator, and SMART status
Type: Shell (check Display status feedback image)
system_profiler SPPowerDataType | grep Charging | grep Yes > /dev/null
system_profiler SPPowerDataType | grep Condition | grep Normal > /dev/null
diskutil info disk0s2 | grep Verified > /dev/null
Charging Indicator: Green if charging; Red if on battery
Battery Health Indicator: Green if normal; Red if replace soon or other abnormal status
SMART Status: Green if ok; Red if otherwise