Viewing post

MySQL migrations and generating Zabbix Cisco templates

What a week. What a month. What a year.

So much has happened, far more than I could or should ever write about.

Recently we’ve been migrating MySQL servers from one hardware to another – for anyone (me!) that finds this useful in the future, firstly “Hello, and I hope the future is better than the current ‘past’!”, and secondly “I hope this does what you need”:

#!/bin/sh
HOST="$1"
USER="$2"
PASS="$3"
mysql -h "$HOST" -u "$USER" -p"$PASS" -e \
"SELECT CONCAT(\"SHOW GRANTS FOR '\", \
user,\"'@'\",host,\"'\;\") FROM mysql.user;" -B -N | \
mysql -h "$HOST" -u "$USER" -p"$PASS" | egrep -v "^Grants"

That small bash script accepts 3 arguments, HOSTNAME, USERNAME and PASSWORD. Executing it will output “CREATE USER” statements for all users on the MySQL instance.

While migrating the MySQL servers, we took the opportunity to setup a new monitoring solution – Zabbix. I’ve used it a couple of times in the past, and in my most humble opinion it’s failing is it’s flexibility. It’s just so flexible!

We have a fair number of Cisco switches and routers at our disposal here in the office, and setting up Zabbix templates for each is not high on my bucket list. Why do something by hand that can be done automagically by a computer?

Thus this (very hacky, PHP) script which automatically generates Cisco (SNMP) templates for Zabbix.

Simply run “show snmp mib ifmib ifindex” on your Cisco device of choice, and shove the output into the script’s STDIN. Hey-presto, out comes a Zabbix template!

Modifying the default options in the template is very easy; just edit what you like after line 34.

Tagged as: , , ,

This entry was posted on Wednesday, December 7th, 2011 at 11:03 am and is filed under Uncategorized. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

4 Responses to “MySQL migrations and generating Zabbix Cisco templates”

  1. Hoteluri Veliko Tarnovo Says:

    Hoteluri Mamaia Preturi

    Having read this I thought it was extremely informative.
    I appreciate you spending some time and effort to put this information together.

    I once again find myself personally spending way
    too much time both reading and leaving comments. But so what, it was still
    worthwhile!

  2. social media management Hatfield Says:

    For hottest information you have tto visit web annd on internet I found
    this webb site as a most excellent wweb pae for newest updates.

    My page social media management Hatfield

  3. Potters Bar Aggregates Says:

    Very great post. I just stumbled upon your weblog andd wanted to say that I’ve really loved browsing your blog posts.
    In anyy caqse I will be subscribing in your rss feed and
    I’m hoping you write again very soon!

  4. Carpet Cleaner Kimpton Says:

    Heyy There. I found your blog thhe use of msn. That is a very
    neatloy written article. I’ll be sure too bookmark it and come back to
    learn extea of your useful information. Thank you for the post.

    I’ll certainly comeback.

Leave a Reply