-----Messaggio originale----- Da: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] conto di Dave Shield Inviato: venerdì 10 novembre 2006 0.25 A: Enzo Arlati Cc: net-snmp-users@lists.sourceforge.net Oggetto: Re: help about this warning : Wrong Type (should be INTEGER): ""
On 09/11/06, Enzo Arlati <[EMAIL PROTECTED]> wrote: > The snmpwalk issue on my subagent give me some warning when queries string > under the node .1.3.6.1.4.1.17377.35.10.1 > .1.3.6.1.4.1.17377.35.10.1.1.8.1 = Wrong Type (should be INTEGER): "" > .1.3.6.1.4.1.17377.35.10.1.1.8.2 = Wrong Type (should be INTEGER): "" What's the MIB definition of this particular object? What does the code that registers and implements this object look like? Dave I'm trying to use a trick like this: I need more tables crTableDevices of the same types so I 'm trying to call several times the initializa_table routine as show belowe: void init_aesys_crTableDevices(void) { DEBUGMSGTL(("aesys", "[init_aesys_crTableDevices] ----- START ----- \n")); aesys_initialize_table_crTableDevices( 0 ); aesys_initialize_table_crTableDevices( 1 ); DEBUGMSGTL(("aesys", "[init_aesys_crTableDevices] ----- END ----- \n")); } Inside the aesys_initialize_table_crTableDevices i changed the oid of the table accordingly to value of the passed args so I will have .1.3.6.1.4.1.17377.35.10.1. .1.3.6.1.4.1.17377.35.10.2. .1.3.6.1.4.1.17377.35.10.ecc.... This work for values greater than 1, while .1.3.6.1.4.1.17377.35.10.1... seems to expects only integer values .1.3.6.1.4.1.17377.35.10.1.1.8.2 = Wrong Type (should be INTEGER): STRING: "G" .1.3.6.1.4.1.17377.35.10.1.1.8.3 = Wrong Type (should be INTEGER): STRING: "H" Belowe I put the whole MIB and code used. I hope in your help. regards, Enzo AESYS-MIB DEFINITIONS ::=BEGIN -- -- -- Author : Enzo Arlati -- Last update: 02.11.2006 -- -- -- File name : AESYS-MIB.txt -- full path: /net-snmp/mibs/AESYS-MIB.txt & /usr/local/share/snmp/mibs/AESYS-MIB.txt -- ASN.1 Description file * -- Version 1.0 * -- -- Description :Define the aesys MIB SR1 -- IMPORTS enterprises FROM SNMPv2-SMI, MODULE-IDENTITY FROM SNMPv2-SMI MODULE-COMPLIANCE, OBJECT-GROUP FROM SNMPv2-CONF; -- aesys OBJECT IDENTIFIER ::={enterprises 17377 } aesys MODULE-IDENTITY LAST-UPDATED "0911060000Z" -- 09 nov 2006 ORGANIZATION "AESYS" CONTACT-INFO " Author: Enzo Arlati email: [EMAIL PROTECTED] " DESCRIPTION "MIB for PMV aesys spa for aesys " ::={enterprises 17377 } --groups in aesys cmv OBJECT IDENTIFIER ::={aesys 35 } -- -- CMV subsystem -- crNumber OBJECT-TYPE SYNTAX INTEGER ACCESS read-only STATUS mandatory DESCRIPTION "The number of running process." ::={cmv 1 } crVersion OBJECT-TYPE --SYNTAX DisplayString(SIZE (0..79)) SYNTAX OCTET STRING ACCESS read-only STATUS mandatory DESCRIPTION "The software version of the linux o.s." ::={cmv 2 } crStartime OBJECT-TYPE SYNTAX TimeTicks ACCESS read-only STATUS mandatory DESCRIPTION "The time since the cr01 was last started up." ::={cmv 3 } crDiskusage OBJECT-TYPE SYNTAX INTEGER ACCESS read-only STATUS mandatory DESCRIPTION "The disk space percentage used on linux-box." ::={cmv 4 } crActive OBJECT-TYPE SYNTAX INTEGER ACCESS read-only STATUS mandatory DESCRIPTION "A toggle to start or stop the subsystem (shutdown/restart all bcm processes)." ::={cmv 5 } -- ---------------------------- -- Tabella dei processi bcm -- ---------------------------- crProcTable OBJECT-TYPE SYNTAX SEQUENCE OF crProcEntry ACCESS read-only STATUS mandatory DESCRIPTION "Tabella dei processi bcm" INDEX { crIndexProcess } ::={cmv 6 } crProcEntry OBJECT-TYPE SYNTAX crProcEntry ACCESS read-only STATUS mandatory DESCRIPTION "Record con i parametri di un processo." ::={crProcTable 1 } crProcEntry ::= SEQUENCE { crIndexProcess INTEGER, stato INTEGER, nome OCTET STRING } crIndexProcess OBJECT-TYPE SYNTAX INTEGER ACCESS not-accessible STATUS current DESCRIPTION "Indice del processo." ::= { crProcEntry 1 } stato OBJECT-TYPE SYNTAX INTEGER { lvlNull(0), lvlOk(1), lvlDegrado(2), lvlSpento(3) } ACCESS read-only STATUS mandatory DESCRIPTION "Livello di servizio del singolo device/displaty ( valori ammessi 1-Funzionante,2-degrado,3-Spento ) " ::={crProcEntry 2 } nome OBJECT-TYPE --SYNTAX DisplayString (SIZE (0..199)) SYNTAX OCTET STRING ACCESS read-only STATUS mandatory DESCRIPTION "Testo descrittivo del processo " ::={crProcEntry 3 } -- -- ---------------------------------- -- ---------------------------------- -- crTipoPMV OBJECT-TYPE SYNTAX DisplayString (SIZE (0..4)) ACCESS read-only STATUS mandatory DESCRIPTION "Tipologia PMV ( es 430, 431 )." ::={cmv 7 } crSottoTipoPMV OBJECT-TYPE SYNTAX DisplayString (SIZE (0..1)) ACCESS read-only STATUS mandatory DESCRIPTION "Sottotipo Tipologia PMV ( es *, 1,2... )." ::={cmv 8 } crStatus OBJECT-TYPE SYNTAX INTEGER { lvlNull(0), lvlOk(1), lvlDegraded(2), lvlOff(3), lvlMaintenance(4) } ACCESS read-only STATUS mandatory DESCRIPTION "Livello di servizio del PMV " ::={cmv 9 } -- ----------------------------- -- Tabella dei device/display -- ----------------------------- crTableDevices OBJECT-TYPE SYNTAX SEQUENCE OF crEntryDevice ACCESS read-only STATUS mandatory DESCRIPTION "Tabella dei device/display" INDEX { crIndexDevices } ::={cmv 10 } crEntryDevice OBJECT-TYPE SYNTAX crEntryDevice ACCESS read-only STATUS mandatory DESCRIPTION "Record con i parametri connessi ad uno specifico device/display" ::={crTableDevices 1 } crEntryDevice ::= SEQUENCE { crIndexDevices INTEGER, crIndex INTEGER, crType INTEGER, crStatus INTEGER, crDescr OCTET STRING } crIndexDevices OBJECT-TYPE SYNTAX INTEGER ACCESS not-accessible STATUS current DESCRIPTION "Indice del device." ::= { crEntryDevice 1 } crIndex OBJECT-TYPE SYNTAX INTEGER ACCESS read-only STATUS mandatory DESCRIPTION "The number of device of a specified type ( ex Pitto1 = 0, Pitto2 = 1 )." ::={crEntryDevice 2 } crType OBJECT-TYPE SYNTAX INTEGER { devAlfanumerico(44), devPittogramma(45), devCentralina(46), devFrecciaCroce(47) } ACCESS read-only STATUS mandatory DESCRIPTION "Type del dispositivo ( 44=alfa, 45=pitto, 46=centralina, 47=frecciaCroce ) " ::={crEntryDevice 3 } crStatus OBJECT-TYPE SYNTAX INTEGER { lvlNull(0), lvlOk(1), lvlDegraded(2), lvlOff(3), lvlMaintenance(4) } ACCESS read-only STATUS mandatory DESCRIPTION "Livello di servizio del singolo device/displaty ( valori ammessi 1-ok,2-degrado,3-Off,4-manutenzione ) " ::={crEntryDevice 4 } crDescr OBJECT-TYPE SYNTAX OCTET STRING ACCESS read-only STATUS mandatory DESCRIPTION "Testo descrittivo del dispositivo " ::={crEntryDevice 5 } crStatoVisualizzazione OBJECT-TYPE SYNTAX INTEGER ACCESS read-only STATUS mandatory DESCRIPTION "Indica lo stato della visualizzazione ( T=testo impostato, B=blank voluto, A=blank per accensione, P=blank per assenza polling )." ::={crEntryDevice 6 } crStatoFlag OBJECT-TYPE SYNTAX INTEGER ACCESS read-only STATUS mandatory DESCRIPTION "Flag di stato del display definito nel comando RPO." ::={crEntryDevice 7 } crMessaggioVisualizzato OBJECT-TYPE SYNTAX OCTET STRING ACCESS read-only STATUS mandatory DESCRIPTION "Messaggio completo visualizzato dal display " ::={crEntryDevice 8 } crFirmwareDisplay OBJECT-TYPE SYNTAX OCTET STRING ACCESS read-only STATUS mandatory DESCRIPTION "Revisione del firmware installato sul display " ::={crEntryDevice 9 } crIndexPanel OBJECT-TYPE SYNTAX INTEGER ACCESS read-only STATUS mandatory DESCRIPTION "Il numero di cartello(panel) a cui appartiene il display ( valori ammessi da 0 a 9 )." ::={crEntryDevice 10 } -- -------------------------------------------------------- -- -------------------------------------------------------- -- TRAPs pmv aesys -- -------------------------------------------------------- -- -------------------------------------------------------- trapPmv OBJECT IDENTIFIER ::={aesys 36 } -- -------------------------------------------------------- -- avvio/spegnimento sistema -- -------------------------------------------------------- A0 NOTIFICATION-TYPE -- STATUS current OBJECTS { crActive } DESCRIPTION "Restart del sistema pmv" ::= { trapPmv 1701 } A1 NOTIFICATION-TYPE STATUS current OBJECTS { crActive } DESCRIPTION "Caduta del sistema pmv" ::= { trapPmv 1702 } -- -------------------------------------------------------- -- soglie file system -- -------------------------------------------------------- A2 NOTIFICATION-TYPE STATUS current OBJECTS { crDiskusage } DESCRIPTION "Superamento della prima soglia di occupazione del file-system" ::= { trapPmv 1703 } A3 NOTIFICATION-TYPE STATUS current OBJECTS { crDiskusage } DESCRIPTION "Superamento della seconda soglia di occupazione del file-system (Inviato ogni 5 minuti fino a quando persiste la condizione di errore)" ::= { trapPmv 1704 } -- -------------------------------------------------------- -- variazioni livello servizio generale ( da valutare ) -- -------------------------------------------------------- A4 NOTIFICATION-TYPE STATUS current OBJECTS { crStatus } DESCRIPTION "Variazione di stato del PMV che diventa efficente " ::= { trapPmv 1705 } A5 NOTIFICATION-TYPE STATUS current OBJECTS { crStatus } DESCRIPTION "Variazione di stato del PMV che va in degrado " ::= { trapPmv 1706 } A6 NOTIFICATION-TYPE STATUS current OBJECTS { crStatus } DESCRIPTION "Variazione di stato del PMV che va in avaria " ::= { trapPmv 1707 } -- -------------------------------------------------------- -- variazioni livello servizio cartello 0 -- -------------------------------------------------------- LS04 NOTIFICATION-TYPE STATUS current OBJECTS { crStatus } DESCRIPTION "Variazione di stato del Cartello che diventa efficente " ::= { trapPmv 1710 } LS05 NOTIFICATION-TYPE STATUS current OBJECTS { crStatus } DESCRIPTION "Variazione di stato del Cartello che va in degrado " ::= { trapPmv 1711 } LS06 NOTIFICATION-TYPE STATUS current OBJECTS { crStatus } DESCRIPTION "Variazione di stato del Cartello che va in avaria " ::= { trapPmv 1712 } -- -------------------------------------------------------- -- variazioni livello servizio cartello 1 -- -------------------------------------------------------- LS14 NOTIFICATION-TYPE STATUS current OBJECTS { crStatus } DESCRIPTION "Variazione di stato del Cartello che diventa efficente " ::= { trapPmv 1713 } LS15 NOTIFICATION-TYPE STATUS current OBJECTS { crStatus } DESCRIPTION "Variazione di stato del Cartello che va in degrado " ::= { trapPmv 1714 } LS16 NOTIFICATION-TYPE STATUS current OBJECTS { crStatus } DESCRIPTION "Variazione di stato del Cartello che va in avaria " ::= { trapPmv 1715 } -- -------------------------------------------------------- -- variazioni livello servizio cartello 2 -- -------------------------------------------------------- LS24 NOTIFICATION-TYPE STATUS current OBJECTS { crStatus } DESCRIPTION "Variazione di stato del Cartello che diventa efficente " ::= { trapPmv 1716 } LS25 NOTIFICATION-TYPE STATUS current OBJECTS { crStatus } DESCRIPTION "Variazione di stato del Cartello che va in degrado " ::= { trapPmv 1717 } LS26 NOTIFICATION-TYPE STATUS current OBJECTS { crStatus } DESCRIPTION "Variazione di stato del Cartello che va in avaria " ::= { trapPmv 1718 } -- -------------------------------------------------------- -- variazioni livello servizio cartello 9 -- -------------------------------------------------------- LS94 NOTIFICATION-TYPE STATUS current OBJECTS { crStatus } DESCRIPTION "Variazione di stato del Cartello che diventa efficente " ::= { trapPmv 1737 } LS95 NOTIFICATION-TYPE STATUS current OBJECTS { crStatus } DESCRIPTION "Variazione di stato del Cartello che va in degrado " ::= { trapPmv 1738 } LS96 NOTIFICATION-TYPE STATUS current OBJECTS { crStatus } DESCRIPTION "Variazione di stato del Cartello che va in avaria " ::= { trapPmv 1739 } END ====================================================== /* =============================================== FILE: aesys_crTableDevices.c =============================================== */ #include <net-snmp/net-snmp-config.h> #include <net-snmp/net-snmp-includes.h> #include <net-snmp/agent/net-snmp-agent-includes.h> #include "aesys_crTableDevices.h" netsnmp_table_data_set *aesys_table_set_devices_devices; netsnmp_table_row * rows[TABLEDEVICE_NUMROWS]; /************************************************************************** Initializes the crTableDevices module **************************************************************************/ void init_aesys_crTableDevices(void) { DEBUGMSGTL(("aesys", "[init_aesys_crTableDevices] ----- START ----- \n")); aesys_initialize_table_crTableDevices( 0 ); aesys_initialize_table_crTableDevices( 1 ); aesys_initialize_table_crTableDevices( 2 ); DEBUGMSGTL(("aesys", "[init_aesys_crTableDevices] ----- END ----- \n")); } /************************************************************************** Initialize the crTableDevices table by defining its contents and how it's structured *************************************************************************/ void aesys_initialize_table_crTableDevices( int idPanel ) { static oid crTableDevices_oid[] = { ENTERPRISE_MIB_AESYS, 35, 10, 1 }; size_t crTableDevices_oid_len = OID_LENGTH(crTableDevices_oid); char stmp[200], sOid[200], descr[200], msgvis[512], rev_fw[64]; int idx, ivar, ilvl, stato_vis, stato_flag; char table_name[100]; netsnmp_handler_registration * reginfo = 0; crTableDevices_oid[POS_ENTERPRISE_ID] = ent_oid; aesys_OidToChar( crTableDevices_oid, OID_LENGTH(crTableDevices_oid), sOid ); DEBUGMSGTL(("aesys", "[initialize_table_crTableDevices] EnterpriseOid = %d (cmv_oid=%s) idPanel=%d \n", ent_oid, sOid, idPanel )); crTableDevices_oid[POS_ENTERPRISE_ID+3] = idPanel+1; aesys_OidToChar( crTableDevices_oid, OID_LENGTH(crTableDevices_oid), sOid ); DEBUGMSGTL(("aesys", "[initialize_table_crTableDevices] EnterpriseOid = %d (cmv_oid=%s)\n", ent_oid, sOid )); //*************************************************** // * create the table structure itself //*************************************************** sprintf( table_name, "crTableDevices_%d", idPanel ); aesys_table_set_devices_devices = netsnmp_create_table_data_set( table_name ); if( aesys_table_set_devices_devices == 0 ) { DEBUGMSGTL(("aesys", "[initialize_table_crTableDevices] FAILED netsnmp_create_table_data_set( %s ) \n", table_name )); return; } //*************************************************** // * comment this out or delete if you don't support creation of new rows //*************************************************** aesys_table_set_devices_devices->allow_creation = 1; //*************************************************** // Adding indexes //*************************************************** DEBUGMSGTL(("aesys", "[initialize_table_crTableDevices] adding indexes to table %s \n", table_name )); //netsnmp_aesys_table_set_devices_devices_add_indexes(aesys_table_set_devices_devices, ASN_OCTET_STR); netsnmp_table_dataset_add_index(aesys_table_set_devices_devices, ASN_INTEGER ); DEBUGMSGTL(("aesys", "[initialize_table_crTableDevices] adding column types to table %s \n", table_name )); netsnmp_table_set_multi_add_default_row(aesys_table_set_devices_devices, //COLUMN_INDEXDEVICES, ASN_INTEGER, 0, NULL, 0, COLUMN_INDEX, ASN_INTEGER, 0, NULL, 0, COLUMN_TYPE, ASN_INTEGER, 0, NULL, 0, COLUMN_STATUS, ASN_INTEGER, 0, NULL, 0, COLUMN_DESCR, ASN_OCTET_STR, 0, NULL, 0, COLUMN_STATO_VIS, ASN_INTEGER, 0, NULL, 0, COLUMN_STATO_FLAG, ASN_INTEGER, 0, NULL, 0, COLUMN_MSG_VIS, ASN_OCTET_STR, 0, NULL, 0, COLUMN_REV_FW, ASN_OCTET_STR, 0, NULL, 0, COLUMN_IDX_PANEL, ASN_INTEGER, 0, NULL, 0, 0); //*************************************************** // * registering the table with the master agent // * note: if you don't need a subhandler to deal with any aspects // * of the request, change crTableDevices_handler to "NULL" //*************************************************** reginfo = netsnmp_create_handler_registration ( table_name, aesys_crTableDevices_handler, crTableDevices_oid, crTableDevices_oid_len, HANDLER_CAN_RWRITE); if( reginfo == 0 ) { DEBUGMSGTL(("aesys", "[initialize_table_crTableDevices] FAILED netsnmp_create_handler_registration( %s ) \n", table_name )); return; } // ----------------------------------------------------------------------- netsnmp_register_table_data_set( reginfo, aesys_table_set_devices_devices, NULL); // ----------------------------------------------------------------------- ilvl = 0; strcpy( msgvis, " " ); strcpy( rev_fw, " **** " ); strcpy( descr, "??Alfanumerico" ); aesys_UpdateRowTableDevice( DEVICE_ALFA1, idPanel, 0, CODICE_ALFA, ilvl, stato_vis, stato_flag, msgvis, rev_fw, descr ); strcpy( descr, "??Pittogramma" ); aesys_UpdateRowTableDevice( DEVICE_PITTO1, idPanel, 0, CODICE_PITTO, ilvl, stato_vis, stato_flag, msgvis, rev_fw, descr ); aesys_UpdateRowTableDevice( DEVICE_PITTO2, idPanel, 1, CODICE_PITTO, ilvl, stato_vis, stato_flag, msgvis, rev_fw, descr ); strcpy( descr, "??Centralina" ); aesys_UpdateRowTableDevice( DEVICE_CENTRALINA, idPanel, 0, CODICE_CENTRALINA, ilvl, stato_vis, stato_flag, msgvis, rev_fw, descr ); aesys_UpdateRowTableDevice( DEVICE_FRECCIACROCE, idPanel, 0, CODICE_FRECCIACROCE, ilvl, stato_vis, stato_flag, msgvis, rev_fw, descr ); // ----------------------------------------------------------------------- // DEBUGMSGTL(("aesys", "[initialize_table_crTableDevices] netsnmp_register_auto_data_table\n")); // netsnmp_register_auto_data_table( aesys_table_set_devices_devices, NULL ); // ----------------------------------------------------------------------- } /************************************************************* *************************************************************/ void aesys_UpdateRowTableDevice( int idx, int idPanel, int id_dev, int cod_dev, int ilvl, int stato_vis, int stato_flag, char * msg_vis, char * rev_fw, char * sdescr ) { //if( rows[idx] ) netsnmp_table_data_delete_row( rows[idx] ); DEBUGMSGTL(("aesys", "[UpdateRowTableDevice] indexes = %d name = %s \n", idx, sdescr )); rows[idx] = netsnmp_create_table_data_row(); //DEBUGMSGTL(("aesys", "netsnmp_table_row_add_index\n" )); netsnmp_table_row_add_index( rows[idx], ASN_INTEGER, &idx, sizeof(idx)); // netsnmp_set_row_column( netsnmp_table_row *row, unsigned int column, int type, const char *value, size_t value_len) netsnmp_set_row_column( rows[idx], COLUMN_INDEX, ASN_INTEGER, (const char * ) &id_dev, sizeof(id_dev)); netsnmp_set_row_column( rows[idx], COLUMN_TYPE, ASN_INTEGER, (const char * ) &cod_dev, sizeof(cod_dev)); netsnmp_set_row_column( rows[idx], COLUMN_STATUS, ASN_INTEGER, (const char * ) &ilvl, sizeof(ilvl)); netsnmp_set_row_column( rows[idx], COLUMN_DESCR, ASN_OCTET_STR,(const char * ) sdescr, strlen(sdescr)); netsnmp_set_row_column( rows[idx], COLUMN_STATO_VIS, ASN_INTEGER, (const char * ) &stato_vis, sizeof(stato_vis)); netsnmp_set_row_column( rows[idx], COLUMN_STATO_FLAG, ASN_INTEGER, (const char * ) &stato_flag, sizeof(stato_flag)); netsnmp_set_row_column( rows[idx], COLUMN_MSG_VIS, ASN_OCTET_STR,(const char * ) msg_vis, strlen(msg_vis)); netsnmp_set_row_column( rows[idx], COLUMN_REV_FW, ASN_OCTET_STR,(const char * ) msg_vis, strlen(rev_fw)); netsnmp_set_row_column( rows[idx], COLUMN_IDX_PANEL, ASN_INTEGER, (const char * ) &idPanel, sizeof(idPanel)); netsnmp_table_dataset_add_row( aesys_table_set_devices_devices, rows[idx] ); } // ______ void UpdateRowTableDevice( ) /**************************************************************** handles requests for the crTableDevices table, if anything else needs to be done ****************************************************************/ int aesys_crTableDevices_handler(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests) { netsnmp_variable_list *var; netsnmp_table_request_info * table_info; char fcrString[4096]; char * pString; char stmp[4096]; char buff[4096]; char sOid[200]; char sOidReq[200]; int irow, icol, ilvl, fcrInteger, len_tmp; char fcrChar; StructStatoCartello * pssc = 0; int idPanel = 0; pString = fcrString; var = requests->requestvb; table_info = netsnmp_extract_table_info( requests ); aesys_OidToChar( var->name, var->name_length, sOid ); aesys_OidToChar( table_info->index_oid, table_info->index_oid_len, sOidReq ); irow = var->name[ var->name_length-1]; icol = table_info->colnum; // DEBUGMSGTL(("aesys", "[aesys_crTableDevices_handler] (row=%d ,col=%d) [sOid=%s] [sOidReq=%s]\n", irow, icol, sOid, sOidReq )); idPanel = var->name[POS_ENTERPRISE_ID+3]; idPanel--; //DEBUGMSGTL(("aesys", "[aesys_crTableDevices_handler] idPanel=%d [%s]\n", idPanel, sOid )); // ----------------------------------------------------------------- if( ! stato_impianto ) { DEBUGMSGTL(("aesys", "[aesys_crTableDevices_handler] *** ERRORE *** ( stato_impianto == NULL ) \n" )); return SNMP_ERR_GENERR; } // ----------------------------------------------------------------- pssc = & stato_impianto->cartelli[idPanel]; if( ! pssc ) { DEBUGMSGTL(("aesys", "[aesys_crTableDevices_handler] *** ERRORE *** ( pssc == NULL ) \n" )); return SNMP_ERR_GENERR; } // ----------------------------------------------------------------- switch (reqinfo->mode) { case MODE_GET: // DEBUGMSGTL(("aesys", "MODE_GET (row=%d ,col=%d) (%s) \n", irow, icol, sOid )); if ( var->type == ASN_OCTET_STR ) { switch( icol ) { // ------------------------------------------------------- case COLUMN_DESCR: { switch( irow ) { case DEVICE_ALFA1: sprintf( fcrString, "%s", pssc->dy_alfa.nome_display ); break; case DEVICE_PITTO1: sprintf( fcrString, "%s", pssc->dy_pitto1.nome_display ); break; case DEVICE_PITTO2: sprintf( fcrString, "%s", pssc->dy_pitto2.nome_display ); break; case DEVICE_CENTRALINA: sprintf( fcrString, "%s", "Centralina" ); break; case DEVICE_FRECCIACROCE: sprintf( fcrString, "%s", pssc->dy_frecciacroce.nome_display ); break; } pString = strcat( pString, " " ); snmp_set_var_typed_value( var, ASN_OCTET_STR, (u_char *) pString, strlen(pString) - 1 ); break; } // ------------------------------------------------------- case COLUMN_MSG_VIS: { switch( irow ) { case DEVICE_ALFA1: DEBUGMSGTL(("aesys", "MODE_GET-DEVICE_ALFA1 idPanel=%d [msg=%s] \n", idPanel, pssc->dy_alfa.last_valid_msg_displayed )); len_tmp = strlen( pssc->dy_alfa.last_valid_msg_displayed ); aesys_string_to_hex( pssc->dy_alfa.last_valid_msg_displayed, len_tmp, buff ); sprintf( fcrString, "%s", buff ); DEBUGMSGTL(("aesys", "MODE_GET-DEVICE_ALFA1 [msg=%s] \n\n", fcrString )); break; case DEVICE_PITTO1: sprintf( fcrString, "%s", pssc->dy_pitto1.codice_pitto_visualizzato ); break; case DEVICE_PITTO2: sprintf( fcrString, "%s", pssc->dy_pitto2.codice_pitto_visualizzato ); break; case DEVICE_CENTRALINA: sprintf( fcrString, "%s", " " ); break; case DEVICE_FRECCIACROCE: sprintf( fcrString, "%s", pssc->dy_frecciacroce.codice_pitto_visualizzato ); //fcrInteger = pssc->dy_frecciacroce.codice_pitto_visualizzato; break; } pString = strcat( pString, " " ); snmp_set_var_typed_value( var, ASN_OCTET_STR, (u_char *) pString, strlen(pString) - 1 ); break; } // ------------------------------------------------------- case COLUMN_REV_FW: { switch( irow ) { case DEVICE_ALFA1: sprintf( fcrString, "%s", pssc->dy_alfa.revisione_fw ); break; case DEVICE_PITTO1: sprintf( fcrString, "%s", pssc->dy_pitto1.revisione_fw ); break; case DEVICE_PITTO2: sprintf( fcrString, "%s", pssc->dy_pitto2.revisione_fw ); break; case DEVICE_CENTRALINA: sprintf( buff, "%s %s", REVISIONE, ULTIMO_AGGIORNAMENTO ); sprintf( fcrString, "%s", buff ); break; case DEVICE_FRECCIACROCE: sprintf( fcrString, "%s", pssc->dy_frecciacroce.revisione_fw ); break; } pString = strcat( pString, " " ); snmp_set_var_typed_value( var, ASN_OCTET_STR, (u_char *) pString, strlen(pString) - 1 ); break; } // ------------------------------------------------------- } } else if ( var->type == ASN_INTEGER ) { //DEBUGMSGTL(("aesys", "[aesys] MODE_GET ASN_INTEGER \n" )); switch( icol ) { // ------------------------------------------------------- case COLUMN_INDEX: { switch( irow ) { case DEVICE_ALFA1: fcrInteger = 0; break; case DEVICE_PITTO1: fcrInteger = 0; break; case DEVICE_PITTO2: fcrInteger = 1; break; case DEVICE_CENTRALINA: fcrInteger = 0; break; case DEVICE_FRECCIACROCE: fcrInteger = 0; break; } snmp_set_var_typed_value( var, ASN_INTEGER, (u_char *) &fcrInteger, sizeof(fcrInteger)); break; } // ------------------------------------------------------- case COLUMN_TYPE: { switch( irow ) { case DEVICE_ALFA1: fcrInteger = CODICE_ALFA; break; case DEVICE_PITTO1: fcrInteger = CODICE_PITTO; break; case DEVICE_PITTO2: fcrInteger = CODICE_PITTO; break; case DEVICE_CENTRALINA: fcrInteger = CODICE_CENTRALINA; break; case DEVICE_FRECCIACROCE: fcrInteger = CODICE_FRECCIACROCE; break; } snmp_set_var_typed_value( var, ASN_INTEGER, (u_char *) &fcrInteger, sizeof(fcrInteger)); break; } // ------------------------------------------------------- case COLUMN_STATUS: { switch( irow ) { case DEVICE_ALFA1: fcrInteger = pssc->dy_alfa.livello_servizio; break; case DEVICE_PITTO1: fcrInteger = pssc->dy_pitto1.livello_servizio; break; case DEVICE_PITTO2: fcrInteger = pssc->dy_pitto2.livello_servizio; break; case DEVICE_CENTRALINA: fcrInteger = 1; break; case DEVICE_FRECCIACROCE: fcrInteger = pssc->dy_frecciacroce.livello_servizio; break; } snmp_set_var_typed_value( var, ASN_INTEGER, (u_char *) &fcrInteger, sizeof(fcrInteger)); break; } // ------------------------------------------------------- case COLUMN_STATO_VIS: { switch( irow ) { case DEVICE_ALFA1: fcrInteger = pssc->dy_alfa.displayStateVis_; break; case DEVICE_PITTO1: fcrInteger = pssc->dy_pitto1.displayStateVis_; break; case DEVICE_PITTO2: fcrInteger = pssc->dy_pitto2.displayStateVis_; break; case DEVICE_CENTRALINA: fcrInteger = 0; break; case DEVICE_FRECCIACROCE: fcrInteger = pssc->dy_frecciacroce.displayStateVis_; break; } snmp_set_var_typed_value( var, ASN_INTEGER, (u_char *) &fcrInteger, sizeof(fcrInteger)); break; } // ------------------------------------------------------- case COLUMN_STATO_FLAG: { switch( irow ) { case DEVICE_ALFA1: fcrInteger = pssc->dy_alfa.stato_RPO; break; case DEVICE_PITTO1: fcrInteger = pssc->dy_pitto1.stato_RPO; break; case DEVICE_PITTO2: fcrInteger = pssc->dy_pitto2.stato_RPO; break; case DEVICE_CENTRALINA: fcrInteger = 0; break; case DEVICE_FRECCIACROCE: fcrInteger = pssc->dy_frecciacroce.stato_RPO; break; } snmp_set_var_typed_value( var, ASN_INTEGER, (u_char *) &fcrInteger, sizeof(fcrInteger)); break; } // ------------------------------------------------------- } // end ... switch( icol ) } else DEBUGMSGTL(("aesys", "[aesys] MODE_GET requests->requestvb->type (%d) unhandled \n", (int)var->type )); //DEBUGMSGTL(("aesys", "[aesys] MODE_GET: %s\n", fcrString )); break; case MODE_GETNEXT: DEBUGMSGTL(("aesys", "[aesys] MODE_GETNEXT \n" )); break; case MODE_SET_ACTION: DEBUGMSGTL(("aesys", "[aesys] MODE_SET_ACTION \n" )); break; case MODE_SET_RESERVE1: DEBUGMSGTL(("aesys", "[aesys] MODE_SET_RESERVE1 \n" )); // if ( requests->requestvb->type != ASN_OCTET_STR ) //{ //netsnmp_set_request_error(reqinfo, requests, SNMP_ERR_WRONGTYPE ); //return; //} break; case MODE_SET_RESERVE2: DEBUGMSGTL(("aesys", "[aesys] MODE_SET_RESERVE2 \n" )); break; case MODE_SET_UNDO: DEBUGMSGTL(("aesys", "[aesys] MODE_SET_UNDO \n" )); break; case MODE_SET_COMMIT: DEBUGMSGTL(("aesys", "[aesys] MODE_SET_COMMIT \n" )); break; case MODE_SET_FREE: DEBUGMSGTL(("aesys", "[aesys] MODE_SET_FREE \n" )); break; default: DEBUGMSGTL(("aesys", "[aesys] *** DEFAULT *** ( reqinfo->mode = %d )\n", (int)reqinfo->mode )); return SNMP_ERR_GENERR; } return SNMP_ERR_NOERROR; } // ___________ int crTableDevices_handler(netsnmp_mib_handler *handler,... ) ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Net-snmp-users mailing list Net-snmp-users@lists.sourceforge.net Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users