Menu

#2385 5.4.4 hrSWRunParameters empty on AIX

aix
closed
agent (1105)
5
2012-11-08
2012-07-14
blentz
No

In the below example, hrSWRunParameters for the below PID should contain smbd's "-F" parameter.

[blentz@optaix53ts /home/blentz/build]$ /opt/local/net-snmp/sbin/snmpd -v

NET-SNMP version: 5.4.4
Web: http://www.net-snmp.org/
Email: net-snmp-coders@lists.sourceforge.net

[blentz@optaix53ts /home/blentz/build]$ ps -ef | awk '$2 == 352284 { print $0 }'
root 352284 282774 0 Jun 06 - 0:00 /opt/local/samba/sbin/smbd -F

but when queried:

[blentz@optaixnim01 /home/blentz]$ snmpwalk -v 2c -c aix2011 optaix53ts:16161 | grep 352284
HOST-RESOURCES-MIB::hrSWRunIndex.352284 = INTEGER: 352284
HOST-RESOURCES-MIB::hrSWRunName.352284 = STRING: "smbd"
HOST-RESOURCES-MIB::hrSWRunID.352284 = OID: SNMPv2-SMI::zeroDotZero
HOST-RESOURCES-MIB::hrSWRunPath.352284 = STRING: "smbd"
HOST-RESOURCES-MIB::hrSWRunParameters.352284 = ""
HOST-RESOURCES-MIB::hrSWRunType.352284 = INTEGER: application(4)
HOST-RESOURCES-MIB::hrSWRunStatus.352284 = INTEGER: running(1)
HOST-RESOURCES-MIB::hrSWRunPerfCPU.352284 = INTEGER: 18
HOST-RESOURCES-MIB::hrSWRunPerfMem.352284 = INTEGER: 10848 KBytes

Might be related to 3403433.

Discussion

  • Niels Baggesen

    Niels Baggesen - 2012-08-09

    What variant of host/data_access is used by AIX?

     
  • Niels Baggesen

    Niels Baggesen - 2012-08-12

    Ah, I see it must be swrun_procinfo ...
    Unfortunately I do not think any developer has access to any AIX systems. Can you provide the man pages for getprocs and getargs?

     
  • blentz

    blentz - 2012-08-12

    Yes, I had offered access to a development system on AIX a while back via bug report and mailing list but no takers.

    The documentation for getprocs and getargs are here:

    http://pic.dhe.ibm.com/infocenter/aix/v7r1/index.jsp?topic=%2Fcom.ibm.aix.basetechref%2Fdoc%2Fbasetrf1%2Fgetprocs.htm

    http://pic.dhe.ibm.com/infocenter/aix/v7r1/index.jsp?topic=%2Fcom.ibm.aix.basetechref%2Fdoc%2Fbasetrf1%2Fgetargs.htm

    Also, can you please review this bug as well? I provided a patch on another version and a proof-of-concept program to access the process table on AIX.

    https://sourceforge.net/tracker/?func=detail&atid=312694&aid=3403433&group_id=12694

    #include <stdlib.h>
    #include <string.h>
    #include <procinfo.h></procinfo.h></string.h></stdlib.h>

    extern int getprocs(struct procsinfo *ProcessBuffer, int ProcessSize, struct fdsinfo *FileBuffer, int FileSize, pid_t *IndexPointer, int Count);
    extern int getargs (struct procsinfo *processBuffer, int bufferLen, char *argsBuffer, int argsLen);

    int avail = 1024; /* Size of table to allocate */

    int main (void) {
    struct procsinfo *proc_table;
    pid_t proc_index = 0;
    int nprocs, i;

    char        pentry\[8192\];
    char        \*ppentry;
    
    proc\_table = \(struct procsinfo \*\) malloc\(avail\*\(sizeof\(struct procsinfo\)\)\);
    while \( avail == \(nprocs = getprocs\(proc\_table, sizeof\(struct procsinfo\),
        0, sizeof\(struct fdsinfo\),
        &proc\_index, avail\)\)\) \{
            avail += 1024;
            free\( proc\_table \);
            proc\_table = \(struct procsinfo \*\) malloc\(avail\*\(sizeof\(struct procsinfo\)\)\);
    \}
    
    
    for\(i = 0; i < nprocs; i++\) \{
        memset\(pentry, 0, sizeof\(pentry\)\);                              /\* Empty each time \*/
        if\(\!\(SKPROC & proc\_table\[i\].pi\_flags\)\) \{                          /\* Remove kernel processes \*/
            getargs\(&proc\_table\[i\], sizeof\(struct procsinfo\), pentry, sizeof\(pentry\)\);     /\* Call getargs\(\) \*/
            for\(ppentry = pentry; \!\(\(\*ppentry == '\0'\) && \(\*\(ppentry+1\) == '\0'\)\); ppentry++\) \{   /\* Process until 0x00 0x00 \*/
                if\(\(\*ppentry == '\0'\) && \(\!\(\*\(ppentry+1\) == '\0'\)\)\)                /\* if 0x00 \!0x00 \*/
                    \*ppentry = ' ';                                /\* change to 0x20 \!0x00 \*/
            \}
            printf\("%s\n", pentry\);
        \}
    \}
    
    return 0;
    

    }

     
  • Niels Baggesen

    Niels Baggesen - 2012-08-13

    If your offer for access still holds, I would be glad to try it.
    As far as I can see the current code is based on your patch from 3403433, merged in just on 31. august, but only for the 5.5 or newer branches.
    There are a few things I would like to test and possibly change about the way space is allocated for the proc table and arguments, and from the man page it seems we should upgrade to use the getprocs64 routine in place of getprocs.

     
  • blentz

    blentz - 2012-08-15

    Hi,
    Thanks for your response. I need to get the system back up and operational. I am fine with the patch that's in place now for the 5.5 and later releases, so we can consider this one closed. After I return from vacation I might be able to get you access to a system with AIX 6.1 with gcc.

     

Log in to post a comment.

Auth0 Logo