informix database health monitor

albertoalberto Member ✭✭

hello colleagues, we have been asked to perform a balancing between Informix nodes and we are not using the normal health monitor tcp connection because the logs are filled with errors so we have to make a special one and I do not know if anyone has had the same problem and has managed to run any with python from the a10.

I have seen that the ones that exist as templates do not take into account the Informix bbdd.

Thanks in advance for your help.😁

Tagged:

Comments

  • mdunnmdunn Member, A10ers ✭✭✭

    A10 supports external health monitor programs which can be used to execute custom scripts against the backend service. The scripts can be Perl, Shell, Tcl, or Python. Unfortunately, I have not seen an example specifically for Informix. Do you have an Informix health-check script written in one of these languages? If so, we can add the necessary variables to pass slb server and port information to the script.

  • albertoalberto Member ✭✭

    hi @mdunn, thanks for replying, the thing is that I have a python script to make the query, the problem is that I had to install an ibm driver (IBM INFORMIX ODBC DRIVER) on the computer to use it, I understand that this driver which is proprietary ibm, we will not have it in the a10 so I think it will not work, yes, I will pass it to you, thank you very much:

    import pyodbc
    import sys

    conn_str = (
    "DRIVER={IBM INFORMIX ODBC DRIVER};"
    "SERVER=<server_name>;"
    "DATABASE=<dabase_name>;"
    "HOST=<server_host>;"
    "SERVICE=<service_port>;"
    "UID=<user_name>;"
    "PWD=<user_password>;"
    "PROTOCOL=onsoctcp;"
    )

    try:
    conn = pyodbc.connect(conn_str, timeout=5)
    cursor = conn.cursor()
    cursor.execute("SELECT FIRST 1 example FROM example")
    row = cursor.fetchone()
    cursor.close()
    conn.close()

    if row and row[0] == "EU":
    print row[0]
    sys.exit(0) # Health OK
    else:
    if row:
    print "Valor inesperado: %s" % row[0]
    else:
    print "Valor inesperado: sin resultado"
    sys.exit(1) # Health FAIL

    except Exception, e:
    print "Error al conectar o consultar: %s" % str(e)
    sys.exit(1) # Health FAIL

    😁

Sign In or Register to comment.