Saturday, August 8, 2009

ITNM 3.8 Running as SUID root on AIX 6.1 Requires GSKit 7.0.4.14

If you plan to install ITNM 3.8 on AIX 6.1 as a non-root user and have it run as SUID root (as opposed to having the processes actually run as root, which is your other option after you go through the install), you will need to install at least GSKit 7.0.4.11.

The reason I'm posting this is that you may unwittingly encounter these issues:

1. If you've already installed an ITM 6.2.1 agent on your AIX, you've got GSKit installed, but it's the wrong version. The version included with ITM 6.2.1 is 7.0.3.18. This version will cause several of the ITNM processes to fail.

2. ITNM actually ships with the correct GSKit libraries, but it simply copies those libraries to your AIX machine underneath your ITNM install location. So you might think that you can just set your LIBPATH environment variable to use these GSKit libraries. HOWEVER, you would be wrong - when a process is running as SUID root on AIX, the ONLY directories it searches for necessary libraries are those that are HARD-CODED into the binary! You can see this library path for any binary with the command 'dump -Hv executable_file_name'.

3. If you choose to run ITNM as root (rather than SUID root), you won't have this problem because you can just set the LIBPATH environment variable appropriately.

Tuesday, August 4, 2009

Converting TDW Timestamps in MySQL

Hope you read my previous articles on converting TDW Timestamps into "normal" timestamps in DB2 and in JavaScript (BIRT). Recently, I had to re-write this function in MySQL. In case you wonder, ITNM uses MySQL as the poll data collection database and again the same problem manifested.

The solution in MySQL is similar to that of DB2 based solution. Create a function in MySQL database and call that function in your SQL. But here is how to do it.

  1. Bring up MySQL Administrator client and connect to the database in question.
  2. Goto Catalogs in your left pane and select the appropriate database schema.
  3. Goto Stored Procedure tab and click the "Create Stored Proc".
  4. In the name field, give a Name for the function (e.g. TDW_TO_NORMAL_TS) and click "Create FUNCTION" button.
  5. MySQL will create a skeleton function like below.
    CREATE FUNCTION `ncpolldata`.`TDW_TO_NORMAL_TS` () RETURNS INT
    BEGIN
    END
  6. Replace the "CREATE FUNCTION" to look like below.
    CREATE FUNCTION `ncpolldata`.`TDW_TO_NORMAL_TS` (tdw_time bigint) RETURNS DATETIME DETERMINISTIC
  7. Between the "BEGIN" and "END" blocks, paste the following code.
    BEGIN
    Declare normal_time datetime;
    Declare tdw_trunc bigint;
    Set tdw_trunc = substr(tdw_time,2,12);
    Set normal_time = DATE_FORMAT(tdw_trunc, '%y%m%d%H%i%s');
    return(normal_time);
    END
  8. That's it. Click on the "Execute SQL" button to save the newly created function.
  9. Call the function in your SQL Statements like below.
    SELECT TDW_TO_NORMAL_TS(poll_time) from KNP_POLL_DATA_COLLECTION LIMIT 100
Hope you find this useful.