Informix

Expand all | Collapse all

Onconfig file converter

  • 1.  Onconfig file converter

    Posted 19 days ago


    One of the most time-consuming part (for me) of planning upgrades, especially major upgrades, is creating a new onconfig file. I never just drop the old file into the new directory because there can be other onconfig changes specific to the new version, and doing that doesn't necessarily account for that. So my process has always involved making a copy of the new version's onconfig.std file and then editing parameter by parameter to carry forward what I need from the old one.

    It occurs to me that the bulk of this work could be one programmatically. Both because I'm a crap programmer and because I'm assuming someone must have invented a wheel like this along the way, I'm throwing this out to the Informix Peanut Gallery. Here's what I envision:

    • The program/utility in question would take three parameters:
      • The existing version's ${INFORMIXDIR}
      • The new version's ${INFORMIXDIR}
      • The existing version's ${ONCONFIG}
    • The program would start from the new version's onconfig.std as a baseline
    • For each parameter, the existing ${ONCONFIG} would be compared with the existing version's onconfig.std; if they match, the new ${ONCONFIG} gets whatever is in the new version's onconfig.std (the assumption being that if the DBA didn't change the value from what exists in onconfig.std, they're probably okay with whatever the default is, even if that's changed in the new version)
    • If the existing ${ONCONFIG} differs from the existing version's onconfig.std, then the existing ${ONCONFIG} parameter is carried forward to the new ${ONCONFIG}, overriding whatever's in the new version's onconfig.std
    • If a parameter exists in the existing ${ONCONFIG} but does not exist in the existing version's onconfig.std, that parameter is carried forward to the new ${ONCONFIG}, whether or not the same parameter exists in the new onconfig.std
    • When done, the program reports on the changes it made.

    Now, I doubt anyone has done something _exactly_ like that, but I suspect someone has to have done something similar. Art? Anyone?

    TIA,

    - TJG

    ------------------------------
    TOM GIRSCH
    ------------------------------


  • 2.  RE: Onconfig file converter

    Posted 19 days ago
      |   view attached
    Here Tom. Script attached. Run like this:

    $ copy_config.ksh
    Usage: $0 template_config standard_config >output.config
     
    Copy current parameter values into a new onconfig.std file
        Output goes to stdout.

    $ copy_config.ksh $new_INFORMIXDIR/etc/onconfig.std $old_INFORMIXDIR/etc/$ONCONFIG >$new_INFORMIXDIR/etc/$ONCONFIG

    Art

    ------------------------------
    Art S. Kagel, President and Principal Consultant
    ASK Database Management Corp.
    www.askdbmgt.com
    ------------------------------

    Attachment(s)

    ksh
    copy_config.ksh   1 KB 1 version


  • 3.  RE: Onconfig file converter

    Posted 19 days ago
    Oops got the sample command line backwards. The first argument should be your old ONCONFIG file and the second argument the new onconfig.std.

    Art

    ------------------------------
    Art S. Kagel, President and Principal Consultant
    ASK Database Management Corp.
    www.askdbmgt.com
    ------------------------------



  • 4.  RE: Onconfig file converter

    Posted 18 days ago

    Tom,

     

     

    I had done that years ago, but Art replied first ��

     

    It takes the new onconfig.std as a pattern, grabs the values of your 'old' $ONCONFIG and sticks them in the new $ONCONFIG.

    In case of deprecated parameters, it tries to convert them in the new form.

    Perl based

    Eric

     






  • 5.  RE: Onconfig file converter

    Posted 17 days ago
    Or you can use STANDARD Informix command.

    onconfig_diff [-d] | [-c -f file_name_1 -s file_name_2]
    -d compare current onconfig to defaults
    -c compare file to another file
    -f file name
    -s second file name

    ------------------------------
    Vicente Salvador Cubedo
    ------------------------------



  • 6.  RE: Onconfig file converter

    Posted 17 days ago

    Vicente: That gives me the differences but doesn't actually generate the new file. Art's script does almost all of the work of building the new file.






  • 7.  RE: Onconfig file converter

    Posted 16 days ago
    Hi Tom,

    I haven't got any code I can share with you but here is are a couple of approaches we use which may be helpful.

    Start with onconfig.std for the reasons you suggest (have all latest parameters and so on).
    Have two key/value config files:
    1. standard adjustments you apply to all your systems.
    2. adjustments specific to a particular server.
    Put these in a git repo or similar.

    Write a program that runs through the onconfig.std and checks for an entry in (2) and, if not, for an entry in (1) and rewrite that value. All the output is written to $ONCONFIG leaving onconfig.std untouched.

    For a variation on this for self-service systems can query the RAM and CPU cores in your server/VM/container and set all memory related parameters according to some logic you write.

    Both approaches don't allow you to change $ONCONFIG on the fly without also updating your configuration files if you want a change to be permanent, but this is how infra-as-code works. I prefer this to taking an old onconfig from the previous installation as a base. You can see what your config is, who changed it, when and why (if suitable comment provided) all in one place.

    Ben.

    ------------------------------
    Benjamin Thompson
    ------------------------------