Observium and Mediawiki


This post assumes you have fairly adequate knowledge of MediaWiki administration and basic knowledge on how templates in MediaWiki work. 

So you have a wiki powered by MediaWiki and you also happen to have an Observium installation in your network.

You want to display CDP map of a particular device in your network,  in the corresponding device's page in your wiki. (Or any other wiki page for that matter). You only want to tell your wiki Observium's device ID, and in return wiki is to produce CDP map based off of data Observium collects on your network.

For instance, I place the following template inside a wiki page, and pass any an ID of a Cisco device Obserivum has been keeping track of.

{{DeviceMap|34}}

In this case 34 is the device ID of a Cisco device in my Observium installation. The output of above is as follows.



Now the beauty of this is, you don't really have to come back to your wiki page to change the documentation every time you change something in your network. Your Observium already keeps track of it, and it gets reflected in your wiki within 5 minutes of the change.

Colored interfaces are clickable links which takes you to respective graph page in Observium. Colorless interfaces and devices are what CDP "sees", but are not monitored by your Observium.

How do you set this up in your local wiki?

I will post the the templates I created at the end of this post.

For those templates to work, you will need to have the following prerequisites met in your wiki and Observium installation.

MediaWiki checklist:

Software packages:
  • GraphViz installed on the server running MediaWiki. I have version 2.38.0 in my installation. Your GraphViz MW extension is practically useless without the GraphViz binaries. 
You can check your MW version and extension versions at http:///wiki/index.php/Special:Version
  • MediaWiki Parser Functions - My PaserFunctions version is 1.6.0 (This used to be an extension, but is now bundled starting from  MW1.18)
  • ImageMap extension - (I have a git commit of this from August 2014. Doesn't really show me a version number on my Special:Version page)
  • Enable this in your wiki
  • GraphViz extension - (READ THIS: You can go ahead and install the latest version of this Extension. I don't use the latest version because it has the nasty habit of uploading the graphviz output to MW each time your ouput changes. This may not be a bad thing if you are using MW to render CDP maps and such, that hardly change. In my Installation I use MW Graphviz extension in conjunction with Observium to actually produce real time Weathermaps within my Wiki. And you know weathermaps change every 5 minutes. That's a lot of uploads if you refresh your weathermaps a lot) -- The version I use is here. You can configure this like like you configure any other extension.
  • External Data extension - My version of this extension is 1.8  - Have this installed and configure it so that it can talk to your Observium database. This is configured in LocalSettings.php. Mine looks like below:

    If you don't want to modify my templates, you may want to use below. Else you can use your own instead of "observerdb" and modify my templates accordingly.
    • // Defining for ExternalData extension
    • $edgDBServer['observerdb'] = "OBSERVIUM_DB_IP";
    • $edgDBServerType['observerdb'] = "mysql";
    • $edgDBName['observerdb'] = "observium";
    • $edgDBUser['observerdb'] = "SQL_READ_USER";
    • $edgDBPass['observerdb'] = "SQL_PASS";

Observium checklist:

Place this in your Obserivum config.php file. DO THIS AT YOUR OWN RISK

// Graph Auth
$config['allow_unauth_graphs'] = 1; # Allow graphs to be viewed by anyone

We can take advantage of this to render Observium graphs within the wiki. 

The set of templates I include can be used separately to place graphs in wiki pages. The template pages itself would contain adequate amount of information on how to use them. Shouldn't be that difficult to figure out, if you are already familiar with wiki templates.

The templates:

Now that all that's taken care of, you can go ahead and import the templates to your wiki. Most of the templates in the tarball are auxiliary and complimentary templates without which actual templates would not work. So you'll probably have to import them all.

After or before importing, you can modify the templates to reflect the URL of your Obserivum where links are produced as part of the output. I have listed templates that you need to alter so that you can point to your Observium URL. 
  • Template:Device map links
  • Template talk:Device map links
  • Template:ObserverGraphMemory
  • Template:ObserverGraphDeviceTotal
  • Template:ObserverGraphCPU
  • Template:DeviceOverview
It's probably easier to modify them after importing them to your wiki and click "edit" button.

Download the template files here. Inside tarball, you will see individual XML files that you need to import via Special:Import MW page.

Once you import them, try {{DeviceMap|34}} in any wiki page. Of course, you will replace 34 with one of your valid device IDs in Observium.

Ends

If any of you actually bothered to go ahead and implement this in your wiki, and things don't exactly work the way they're meant to, please drop a comment here. I'll see if I can address it.

Thanks

No comments: