Tuesday, August 16, 2011

How to: Quickly access Informix onstat and onconfig information

Do you frequently find yourself needing quick access to simple information about your Informix instance? Info such as onconfig variables or other parameters?

While you can create templates with infx to specify the information you need, that is overkill when you just want to know something simple, such as the instance server number.

To fill this need, the infx status service has a simple interface that allows ad hoc access to the full details of the onstat parser library.

Lets take the instance server number as an example:

demo1@bobii:/home/informix>infx status vars=onconfig_servernum
23

Lets say I also want to know the onconfig MSGPATH parameter:

demo1@bobii:/home/informix>infx status vars=onconfig_servernum+onconfig_msgpath
23 /infx/inst/demo1/logs/online.log

In a script, these values could easily be read into variables:

#!/bin/sh

infx status vars=onconfig_servernum+onconfig_msgpath | read server msg

echo server=$server msgpath=$msg

You can also access list values, such as the name of each chunk file in an instance:

demo1@bobii:/home/informix>infx status list=chunkfile_list vars=path
/infx/inst/demo1/chks/sblob01.000
/infx/inst/demo1/chks/dat01.001
/infx/inst/demo1/chks/sblob01.001
/infx/inst/demo1/chks/log02.000
/infx/inst/demo1/chks/root.001
/infx/inst/demo1/chks/tmp01.000
/infx/inst/demo1/chks/dat02.000
/infx/inst/demo1/chks/log01.000
/infx/inst/demo1/chks/ltmp01.000
/infx/inst/demo1/chks/plog.000
/infx/inst/demo1/chks/blob01.000
/infx/inst/demo1/chks/dat01.000
/infx/inst/demo1/chks/idx01.000
/infx/inst/demo1/chks/tmp02.000
/infx/inst/demo1/chks/dat04.000

That one can be pretty handy when you want to run an external backup e.g.

tar cvf /backup/ext.tar `infx status list=chunkfile_list vars=path`

The onstat parser reference contains all the lists and variables available
informix onstat and onconfig information

No comments:

Post a Comment