Cacti: migrating settings and RRD history

November 28th, 2008

1 Giant Leap – Nothing Wrong With Me

I was having a hard time figuring out how to migrate Cacti from one box to another, or more specifically I could do the migration by the book but nothing was working, so after much head scratching and googling I’m going to collate my notes here. This assumes Debian to Debian, and we’ll call the boxes oldcacti and newcacti.

Step 1 is to setup Cacti, RRDTool, SNMP etc on newcacti. This is outside the scope of this post.

Step 2 is to migrate your database, so dump it, scp it to newcacti:

oldcacti:/etc/cacti# mysqldump -u cacti -p > cacti.sql
Enter password:
oldcacti:/etc/cacti# scp cacti.sql root@newcacti:/etc/cacti/
root@newcacti's password:
cacti.sql 100% 463KB 462.5KB/s 00:00
oldcacti:/etc/cacti#

and restore it:

newcacti:/etc/cacti# mysql -u cacti -p < cacti.sql
Enter password:
newcacti:/etc/cacti#

Step 3 All of your settings should now be across, but you'll likely want to keep your RRD history too. Unfortunately you cannot just scp the files across as you'll likely get complaints about the RRD files being created on a different arch:

COMMENT:From 2008/06/18 14:05:32 To 2008/06/19 14:05:32\c
ERROR: Garbage ':05:32 To 2008/06/19 14:05:32\c' after command:
COMMENT:From 2008/06/18 14:05:32 To 2008/06/19 14:05:32\c
ERROR: This RRD was created on other architecture
ERROR: This RRD was created on other architecture
ERROR: This RRD was created on other architecture
ERROR: This RRD was created on other architecture
ERROR: Garbage ':05:41 To 2008/06/19 14:05:41\c' after command:
COMMENT:From 2008/06/18 14:05:41 To 2008/06/19 14:05:41\c
ERROR: Garbage ':05:41 To 2008/06/19 14:05:41\c' after command:

So we need to export the files to xml and then reimport them:

rrdtool dump filename.rrd > filename.xml
rrdtool restore filename.xml > filename.rrd

But if you’ve got dozens, hundreds or even thousands of RRD files, doing them one by one is going to get tired, very quickly. So here we go:

oldcacti:/usr/share/cacti/site/rra/# ls -1 *.rrd | awk '{print "rrdtool dump "$1" > "$1".xml"}' | sh -x
scp *.xml root@newcacti:/usr/share/cacti/site/rra/

followed by:

newcacti:/usr/share/cacti/site/rra/# rm *.rrd
newcacti:/usr/share/cacti/site/rra/# ls -1 *.rrd.xml | sed 's/\.xml//' | awk '{print "rrdtool restore "$1".xml "$1}' | sh -x
newcacti:/usr/share/cacti/site/rra/# rm *.xml
newcacti:/usr/share/cacti/site/rra/# chown www-data:www-data *

That should be it, the final chown ensures that Apache can actually open the files and present them. Assuming Cacti et al is configured right on newcacti, you should be seeing some pretty graphs :)

Article Tags>> | |

If you’d have spent movember money on me, spend it here

November 17th, 2008

Ali Campbell – Don’t Try This At Home

http://www.fundraiseonline.co.nz/DaleStevens/

Kia ora to my friends, whanau, workmates and fellow citizens.

I’m shaving my lid for a brave kid!

The Child Cancer Foundation funrazor will be held at 22 locations around NZ in December 2008.

Ill be shaving my dreads on the 6th December at:
TIME 12:00
PLACE Civic Plaza, Hamilton

Come down and watch, it’ll be heaps of fun!

Every year on average 150 Kiwi kids are diagnosed with cancer, which means that there are lots of children and families requiring special support and assistance. The Child Cancer Foundation believes that no child suffering from cancer, or their family, should ever feel alone.

By shaving my lid for a brave kid, I’m helping us to raise money for support and services for children and families affected by childhood cancer. I’m passionate about this cause and I’m willing to lose my dreadlocks to prove it!

Please sponsor me as I participate in funrazor all money raised goes to the Child Cancer Foundation.

Thanks so much.
Dale Stevens

The Child Cancer Foundation is just as worthy a cause as Prostate Cancer and Men’s Depression, and just like those it doesn’t get as near the amount of exposure that it should.

Article Tags>> |

Lightning Strike == Money for me

November 10th, 2008

This chick can sing

On Friday a freak bit of hail and lightning hit Wellington, and some of the lightning struck very close to our office, creating a surge big enough to upset some of the equipment that is awaiting migration to the new power platform, which includes some of the office’s most important servers – hence the difficulty migrating them as it’s nigh on impossible to get an outage window out of those who command what’s on the servers.

We performed a small feat getting an entire rack of dead equipment up and running within 20 minutes, keeping everything within SLA’s etc. Everything seemed fine until this morning, when I was awoken by a Romanian colleague to let me know that one of the servers was down, again. And only perhaps the most important server in the rack, as it is client facing.

In our rush to get the rack back up, we unplugged the redundant psu’s to reduce the load on the dodgy circuit (remember – old power platform) while the servers came up. 99.9% of the time, servers will run fine on one redundant PSU, so we left some of them unplugged with a plan to warm-migrate this week to the new power platform (i.e. plug in the redundant supplies and connect them to the new platform, then swap the other supplies over – no outage required)

Bad move. The important server on its one PSU experienced that rare .1% probability PSU failure. So, by whatever series of events that transpired, I was awoken and sifted into the office and sorted the problem out – with the help of an IT friendly early bird. So I spent the day a bit grumpy, but I get paid a call out fee at least :)

This experience proves a couple of things:
1) Inheriting IT systems that were once maintained by IT cowboys sucks. Especially when management expects you to keep improving things with a budget of $0 while factoring in their meddling
2) You often won’t get a mandate from management unless they are personally affected. I’ve been asking for months for an outage window for this stuff, as soon as a bit of weather hits I suddenly get it – go figure :)

Article Tags>> | | |

Yes, I Voted

November 8th, 2008

Whatever Rhombus song is playing in the lounge

I voted today. Labour for my local vote, and Progressives for my party vote.

Disappointingly, National is still likely to get in, even more disappointingly is that they’ll get in with ACT, which would be a very bad thing for NZ. This election has shown that NZ’s swing voters are more on the sheepish side of intelligence and are following the hype surrounding the National campaign, while ignoring all the historical mess that National has got the country in every time they’re in power – and forgetting the debarcle that was their last leadership: A relatively competent National leader (shock! horror!) was usurped by a self-obsessed idiot, yeah.. just the type of leadership we need.

This isn’t to say that Labour’s campaign has been angelic, in fact it has been downright disgusting, with petty tactics you’d think would be reserved for the idiotic Palins of the world.

I will never vote National, either, because I don’t believe in their top-down economic style. Yes, looking after businesses is important, but at the expense of the general public – the people whose dollars keep business running? And don’t be fooled by this new-look centrist National party either, they’ll tend towards their underlying values, especially with ACT trying to bend them back to the right. I like my economic policies like I like my alcohol: bottoms up.

So I voted Labour for my local vote because, well, our local Labour MP has proven to be a very competent MP, and IMHO the most competent out of all the contenders. I voted Progressive for the party vote because, well, out of all the potential Labour coalition partners I like them and their policies the most, and Uncle Jim has done a lot of good things for NZ, and has a fairly good vision for what should be our next steps.

I would have voted Greens for my party vote (like last time), but I don’t agree with some of their policies, MP’s and attitudes. Yes, even though I have a friend and the guy I was named after in the party. Though they could at least run a campaign above the belt, unlike National and Labour.

Article Tags>> | | |

Musing about relationships

November 6th, 2008

Only the music that’s in my head

They say that women tend to go for Mr Right Now and then later on go for Mr Right.

Why can’t they go for Mr Right, Now?

Movember 2008

November 3rd, 2008

Opshop – Waiting Now

Cyanide and Happiness, a daily webcomic
Cyanide & Happiness @ Explosm.net

I have a small announcement regarding Movember. This year, I won’t be doing it. For three reasons:

1) I now have ladyfriend commitments. This was a reason I scourned last year, but now that I’m in the position to understand… well I’ll STFU.
2) I’m not keen on walking around looking like a sexual predator for a month. If I really grew it out I’d at best have a Johnny Depp style mo, but until then it looks like a dirty sanchez, and that’s not cool, that will get you arrested.
3) I’ve got a few too many issues to deal with to handle the extra load of Movember, hence the quiet state of this blog lately :(

Article Tags>>