[Xymon] Anyone have a plugin for IBM Datapower?

Jason Brockdorf apocalysque at yahoo.com
Sun Apr 16 22:17:20 CEST 2017


I wrote one that works with the REST API on ISAM appliances.  I believe they’re pretty similar to the datapower appliances.  There’s 2 parts to it and you’ll need to have node.js installed, as well as the jq - commandline JSON processor executable.  The username and password for the appliance should go on the line immediately following the tag for this host.  I found that putting the user/passwd on the same line as the host/tags made the information show up on the “info” page in xymon and I don’t think you want credentials published there.

 

This particular test only checks to see if any of the junctions are “red” and reports a red status if so.  The entire junction tree is reported along with green/red for good/bad junctions.  I didn’t write in anything for junction specificity, though that’s probably coming soon.

 

The first file I called isam-junctions.sh and the 2nd file I called isam-jct-parse.js

 

I know it’s not exactly what you’re looking for but I hope it will help you to develop one that you can use for the datapower appliances.

  _____  

#!/bin/bash

#

# get the status of junctions from ISAM appliances

#

 

HOSTTAG=junctions                                                       # What we put in hosts.cfg to trigger this test

COLUMN=junctions                                                        # Name of the column, often same as tag in hosts.cfg

CURLCOMMAND=/usr/bin/curl                                         # where to find curl executable

CURLOPTIONS="-skH 'Accept:application/json'"                # set any preferred options here

SEARCHTEXT='ServiceAccount'                                             # set the content to look for here

 

$XYMONHOME/bin/xymongrep $HOSTTAG | while read L

do

set $L                                                                              # To get one line of output from xymongrep

 

JCTUID=`grep -A 1 $2 /etc/xymon/hosts.cfg | egrep -io 'jctuid=[^[:space:]]+' | cut -f2 -d '='`

JCTPWD=`grep -A 1 $2 /etc/xymon/hosts.cfg | egrep -io 'jctpwd=[^[:space:]]+' | cut -f2 -d '='`

 

COLOR="green"                                                                 # default to all is ok

RESULT="0"

 

HOSTIP="$1"

MACHINEDOTS="$2"

MACHINE=`echo $2 | sed -e's/\./,/g'`

 

URL="https://$MACHINEDOTS/wga/widgets/health.json"                                              # set the URL here

RESPONSE=`$CURLCOMMAND $CURLOPTIONS --user "$JCTUID:$JCTPWD" -X GET $URL`          # get the HTTP response from the URL

HTML=`echo "$RESPONSE" | jq '.items[] | walk(if type == "array" then (sort_by(.label | ascii_downcase)) else . end)' | /etc/xymon/ext/isam-jct-parse.js`

RESULT=`echo "$HTML" | grep -ic "color:red"`                                                    # check to see if search text is present in the response

 

[[ "$RESULT" -ne "0" ]] && COLOR="red"

 

$XYMON $XYMSRV "status $MACHINE.$COLUMN $COLOR `date`

${HTML}"

 

done

  _____  

#!/usr/bin/env node

 

var parseJsonAsHTMLTree = function(jsn){

    var result = '';

    if(jsn.label){

        switch(jsn.health){

        case "0":

        result += '<ul style="list-style-type:none; color:green;"><li>' + jsn.label + "\n";

        break;

        case "1":

        result += '<ul style="list-style-type:none; color:red;"><li>' + jsn.label + "\n";

        break;

        }

        for(var i in jsn.children)

            result += parseJsonAsHTMLTree(jsn.children[i]); 

        result += '</li></ul>';

    }

    return result;

}

 

process.stdin.resume();

process.stdin.setEncoding('utf8');

process.stdin.on('data', function(data) {

var result = parseJsonAsHTMLTree(JSON.parse(data));

process.stdout.write("<pre>" + result + "</pre>\n");

});

  _____  

 

 

 

From: Xymon [mailto:xymon-bounces at xymon.com] On Behalf Of McDonald, Daniel (Dan)
Sent: Friday, March 3, 2017 7:29 AM
To: xymon at xymon.com
Subject: [Xymon] Anyone have a plugin for IBM Datapower?

 

I’ve been asked to monitor an IBM Datapower XML gateway, and wanted to see if anyone else had a plugin to do it before I re-invented the wheel.  They have a mib, so supposedly I can poll it with mrtg and feed statuses into xymon with bbmrtg.pl, but IBM claims that their web service has greater detail and information.  So, if anyone has written a xymon plugin to poll a datapower webservice and come up with useful stats to display in xymon, I’d love to hear about it.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20170416/b76e01e4/attachment.html>


More information about the Xymon mailing list