Question

Currently I am tring to write a program to monitor Tuxedo. from the official documents, I found MIB is suitable for writting program to monitor it. I have read a quite lot of document of here http://docs.oracle.com/cd/E13203_01/tuxedo/tux90/rf5/rf5.htm#998207. Although there are so many instructions of very class, there is no any guide to tell me how to use it from the beginning. I have tried to search on github however unfortuanately there is no any code relating to tuxedo mib. Does any one have some good sample code?

Thanks a lot.

Was it helpful?

Solution

Here a Shell-function that reads the blocktime from Tuxedo:

get_blocktime() {

TmpErr=/tmp/ud32err_$$
rtc=0

ud32 -Ctpsysadm <<EOF 2>$TmpErr | grep TA_BLOCKTIME  | cut -f2
SRVCNM  .TMIB
TA_CLASS    T_DOMAIN
TA_OPERATION    GET

EOF

# ud32 has no good error-handling
if [ -s $TmpErr ]; then
    echo "$PRG: Error calling ud32:"
    cat $TmpErr 1>&2
    rtc=1
fi
rm  $TmpErr

exit $rtc
}

OTHER TIPS

There are several examples of accessing MIB with Python https://github.com/PacktPublishing/Modernizing-Oracle-Tuxedo-Applications-with-Python/tree/main/Chapter06. For example:

import tuxedo as t

t.tpinit(cltname="tpsysop")
machine = t.tpadmcall(
    {
        "TA_CLASS": "T_MACHINE",
        "TA_OPERATION": "GET",
        "TA_FLAGS": t.MIB_LOCAL,
    }
).data

A couple of notes:

  • you will need the TA_FLAGS set to MIB_LOCAL to return statistics (not done by default)
  • you might want to use tpadmcall() function instead of calling the .TMIB service. The function is much lighter on the system and does not increase Tuxedo statistics (number of service calls). The main limitation of tpadmcall is the limited size of the response so you will need to call the .TMIB service for server and queue statistics if your application has tens of them.

If the code example is not enough, you can check the chapter 6 of the book Modernizing Oracle Tuxedo Applications with Python.

I have some C code for calling .TMIB to monitor Tuxedo application here: https://github.com/TuxSQL/tuxmon That should get you started.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top