High Quality JMS & AMQP Messaging.

getoid Utility

To manage or monitor SwiftMQ from a SNMP managent tool such as Nagios it is required to know the SNMP OIDs of the respective SwiftMQ attributes or entities. This Extension Swiftlet provides a utility "getoid" to retrieve OIDs for CLI contexts.

The Extension Swiftlet internally listens on a queue "swiftmqsnmp" at the local router. Here it receives requests from the "getoid" utility and returns OIDs that match with the CLI context given in the request. The "getoid" utility is a plain JMS application sending a request to the above queue and displays the result (OIDs) to the user.

The utility is invoked by a "getoid" shell script, located under the "scripts" directory of the distribution of this Swiftlet. There are different version of the shell script. One for Unix under the "unix" subdirectory and one for Windows under the "win32" directory.

The usage is as follows:

    getoid <swiftmq-router-dir> <smqp-url> <connection-factory> <cli-context-predicate> [<user> <password>]

where <swiftmq-router-dir> is the installation directory of the SwiftMQ Router, <smqp-url> the JNDI provider URL and <connection-factory> the name of the connection factory. These parameters are required to connect as a JMS client to the SwiftMQ Router. <user> <password> are additional parameters since release 9.0.0 to connect to routers with authentication enabled.

The parameter <cli-context-predicate> is a SQL-Like predicate to match for CLI contexts. A SQL-Like predicate uses '%' to match any character string and '_' to match any single character. More on this later.

SwiftMQ uses CLI contexts to address and navigate in its internal management tree. For example, to address a Queue Manager Swiftlet's "Usage" section that contains the usage information of all queues, the CLI context is "/sys$queuemanager/usage". To address a queue "testqueue" within the "Usage" section, the CLI context is "/sys$queuemanager/usage/testqueue". To match better with the internal SNMP table representaton we use a slightly different CLI context by separating the last entry of the context with a question mark '?' instead of a slash '/'. So the notation of the former "testqueue" context would be now "/sys$queuemanager/usage?testqueue". To get the "messagecount" attribute of "testqueue" we note "/sys$queuemanager/usage/testqueue?messagecount".

That seems straight forward, however, in practice it can be a little complicated to figure out what the correct CLI context for a particular attribute is. Therefore we use a SQL Like predicate. This is compared agains all available CLI contexts and returns those which match.

For example, if one wants to get the OIDs of the "messagecount" attribute of several queues, one can simply use "%messagecount%":

    ./getoid /Users/tmp/swiftmq_ha_7_3_0 smqp://localhost:4001 ConnectionFactory %messagecount%
    /sys$queuemanager/usage/sys$jndi?messagecount=1.3.6.1.4.1.16683.1.2.11.1.12.1.1.10.8.115.121.115.36.106.110.100.105
    /sys$queuemanager/usage/routerdlq?messagecount=1.3.6.1.4.1.16683.1.2.11.1.12.1.1.10.9.114.111.117.116.101.114.100.108.113
    /sys$queuemanager/usage/sys$topic?messagecount=1.3.6.1.4.1.16683.1.2.11.1.12.1.1.10.9.115.121.115.36.116.111.112.105.99
    /sys$queuemanager/usage/testqueue?messagecount=1.3.6.1.4.1.16683.1.2.11.1.12.1.1.10.9.116.101.115.116.113.117.101.117.101
    /sys$queuemanager/usage/rt$router2?messagecount=1.3.6.1.4.1.16683.1.2.11.1.12.1.1.10.10.114.116.36.114.111.117.116.101.114.50
    ...

Or ask directly:

    ./getoid /Users/tmp/swiftmq_ha_7_3_0 smqp://localhost:4001 ConnectionFactory /sys\$queuemanager/usage/testqueue?messagecount
    /sys$queuemanager/usage/testqueue?messagecount=1.3.6.1.4.1.16683.1.2.11.1.12.1.1.10.9.116.101.115.116.113.117.101.117.101

Or may be someone wants to monitor the free memory of a SwiftMQ Router. Must be something with "memory"...

    ./getoid /Users/tmp/swiftmq_ha_7_3_0 smqp://localhost:4001 ConnectionFactory %memory%
    /.env?memory-collect-interval=1.3.6.1.4.1.16683.1.2.1.1.8.0
    /.env/router-memory-list/router1?free-memory=1.3.6.1.4.1.16683.1.2.1.1.10.1.1.2.7.114.111.117.116.101.114.49
    /.env/router-memory-list/router1?total-memory=1.3.6.1.4.1.16683.1.2.1.1.10.1.1.3.7.114.111.117.116.101.114.49
    /.env/router-memory-list/router1=1.3.6.1.4.1.16683.1.2.1.1.10.1.1.100.7.114.111.117.116.101.114.49
    /sys$monitor/memory?memory-monitor-interval=1.3.6.1.4.1.16683.1.2.9.1.3.2.0
    /sys$monitor/memory?memory-threshold=1.3.6.1.4.1.16683.1.2.9.1.3.3.0
    /sys$monitor/memory?gc-interval=1.3.6.1.4.1.16683.1.2.9.1.3.4.0

Got it! It is "/.env/router-memory-list/router1?free-memory" and the OID is "1.3.6.1.4.1.16683.1.2.1.1.10.1.1.2.7.114.111.117.116.101.114.49".

Note: If you create new entities, e.g. a new queue, and want to get the OID for it, it is required that you disable and re-enable the SNMP Agent before you run the "getoid" utility.