diff options
author | Joshua Tolley | 2010-11-26 17:22:01 +0000 |
---|---|---|
committer | Joshua Tolley | 2010-11-26 17:22:01 +0000 |
commit | fe9d8f21bbdfb442b8233b4627a0c67dc458a8bd (patch) | |
tree | a88daa49fc47e64777af3d331cf142e0604c2d48 /RDBMS-MIB_src/rdbmsSrvInfoTable |
Diffstat (limited to 'RDBMS-MIB_src/rdbmsSrvInfoTable')
13 files changed, 3307 insertions, 0 deletions
diff --git a/RDBMS-MIB_src/rdbmsSrvInfoTable/README b/RDBMS-MIB_src/rdbmsSrvInfoTable/README new file mode 100644 index 0000000..d2cd2fe --- /dev/null +++ b/RDBMS-MIB_src/rdbmsSrvInfoTable/README @@ -0,0 +1 @@ +For PostgreSQL version 8.0.x, rdbmsSrvInfoStartupTime is not properly reported, because that information is unavailable. diff --git a/RDBMS-MIB_src/rdbmsSrvInfoTable/rdbmsSrvInfoTable.c b/RDBMS-MIB_src/rdbmsSrvInfoTable/rdbmsSrvInfoTable.c new file mode 100644 index 0000000..264eb69 --- /dev/null +++ b/RDBMS-MIB_src/rdbmsSrvInfoTable/rdbmsSrvInfoTable.c @@ -0,0 +1,127 @@ +/*------------------------------------------------------------------------- + * rdbmsSrvInfoTable.c + * + * RDBMSMIB mib module. + * + * Copyright (c) 2004-2007, PostgreSQL Global Development Group + * Author: Joshua Tolley + * + * $Id: rdbmsSrvInfoTable.c,v 1.2 2007/09/13 14:20:44 h-saito Exp $ + * + *------------------------------------------------------------------------- + */ + +#include "pgsnmpd.h" + +/* include our parent header */ +#include "rdbmsSrvInfoTable.h" + +/*#include <net-snmp/agent/mib_modules.h> */ + +#include "rdbmsSrvInfoTable_interface.h" + +oid rdbmsSrvInfoTable_oid[] = { RDBMSSRVINFOTABLE_OID }; +int rdbmsSrvInfoTable_oid_size = OID_LENGTH(rdbmsSrvInfoTable_oid); + +void initialize_table_rdbmsSrvInfoTable(void); + + +/** + * Initializes the rdbmsSrvInfoTable module + */ +void +init_rdbmsSrvInfoTable(void) +{ + DEBUGMSGTL(("verbose:rdbmsSrvInfoTable:init_rdbmsSrvInfoTable","called\n")); + + /* + * TODO:300:o: Perform rdbmsSrvInfoTable one-time module initialization. + */ + + /* + * here we initialize all the tables we're planning on supporting + */ + if (should_init("rdbmsSrvInfoTable")) + initialize_table_rdbmsSrvInfoTable(); + +} /* init_rdbmsSrvInfoTable */ + +/** + * Initialize the table rdbmsSrvInfoTable + * (Define its contents and how it's structured) + */ +void +initialize_table_rdbmsSrvInfoTable(void) +{ + rdbmsSrvInfoTable_registration_ptr user_context; + u_long flags; + + DEBUGMSGTL(("verbose:rdbmsSrvInfoTable:initialize_table_rdbmsSrvInfoTable","called\n")); + + /* + * TODO:301:o: Perform rdbmsSrvInfoTable one-time table initialization. + */ + + /* + * TODO:302:o: |->Initialize rdbmsSrvInfoTable user context + * if you'd like to pass in a pointer to some data for this + * table, allocate or set it up here. + */ + /* + * a netsnmp_data_list is a simple way to store void pointers. A simple + * string token is used to add, find or remove pointers. + */ + user_context = netsnmp_create_data_list("rdbmsSrvInfoTable", NULL, NULL); + + /* + * No support for any flags yet, but in the future you would + * set any flags here. + */ + flags = 0; + + /* + * call interface initialization code + */ + _rdbmsSrvInfoTable_initialize_interface(user_context, flags); +} /* initialize_table_rdbmsSrvInfoTable */ + +/** + * pre-request callback + * + * + * @retval MFD_SUCCESS : success. + * @retval MFD_ERROR : other error + */ +int +rdbmsSrvInfoTable_pre_request(rdbmsSrvInfoTable_registration_ptr user_context) +{ + DEBUGMSGTL(("verbose:rdbmsSrvInfoTable:rdbmsSrvInfoTable_pre_request","called\n")); + + /* + * TODO:510:o: Perform rdbmsSrvInfoTable pre-request actions. + */ + + return MFD_SUCCESS; +} /* rdbmsSrvInfoTable_pre_request */ + +/** + * post-request callback + * + * + * @retval MFD_SUCCESS : success. + * @retval MFD_ERROR : other error (ignored) + */ +int +rdbmsSrvInfoTable_post_request(rdbmsSrvInfoTable_registration_ptr user_context) +{ + DEBUGMSGTL(("verbose:rdbmsSrvInfoTable:rdbmsSrvInfoTable_post_request","called\n")); + + /* + * TODO:511:o: Perform rdbmsSrvInfoTable pos-request actions. + */ + + return MFD_SUCCESS; +} /* rdbmsSrvInfoTable_post_request */ + + +/** @{ */ diff --git a/RDBMS-MIB_src/rdbmsSrvInfoTable/rdbmsSrvInfoTable.h b/RDBMS-MIB_src/rdbmsSrvInfoTable/rdbmsSrvInfoTable.h new file mode 100644 index 0000000..77389c6 --- /dev/null +++ b/RDBMS-MIB_src/rdbmsSrvInfoTable/rdbmsSrvInfoTable.h @@ -0,0 +1,262 @@ +/*------------------------------------------------------------------------- + * rdbmsSrvInfoTable.h + * + * RDBMSMIB mib module. + * + * Copyright (c) 2004-2007, PostgreSQL Global Development Group + * Author: Joshua Tolley + * + * $Id: rdbmsSrvInfoTable.h,v 1.2 2007/09/13 14:20:44 h-saito Exp $ + * + *------------------------------------------------------------------------- + */ + +#ifndef RDBMSSRVINFOTABLE_H +#define RDBMSSRVINFOTABLE_H + +#ifdef __cplusplus +extern "C" { +#endif + + +/** @defgroup misc misc: Miscelaneous routines + * + * @{ + */ +#include <net-snmp/library/asn1.h> + +/* other required module components */ + /* *INDENT-OFF* */ +config_require(RDBMS-MIB/rdbmsSrvInfoTable/rdbmsSrvInfoTable_interface); +config_require(RDBMS-MIB/rdbmsSrvInfoTable/rdbmsSrvInfoTable_data_access); +config_require(RDBMS-MIB/rdbmsSrvInfoTable/rdbmsSrvInfoTable_data_get); +config_require(RDBMS-MIB/rdbmsSrvInfoTable/rdbmsSrvInfoTable_data_set); + /* *INDENT-ON* */ + +/* OID and column number definitions for */ +#include "rdbmsSrvInfoTable_oids.h" + +/* enum definions */ +#include "rdbmsSrvInfoTable_enums.h" + +/* ********************************************************************* + * function declarations + */ +void init_rdbmsSrvInfoTable(void); + +/* ********************************************************************* + * Table declarations + */ +/********************************************************************** + ********************************************************************** + *** + *** Table rdbmsSrvInfoTable + *** + ********************************************************************** + **********************************************************************/ +/* + * rdbmsSrvInfoTable is subid 6 of rdbmsObjects. + * Its status is Current. + * OID: .1.3.6.1.2.1.39.1.6, length: 9 +*/ +/* ********************************************************************* + * When you register your mib, you get to provide a generic + * pointer that will be passed back to you for most of the + * functions calls. + * + * TODO:100:r: Review all context structures + */ + /* + * TODO:101:o: |-> Review rdbmsSrvInfoTable registration context. + */ +typedef netsnmp_data_list * rdbmsSrvInfoTable_registration_ptr; + +/**********************************************************************/ +/* + * TODO:110:r: |-> Review rdbmsSrvInfoTable data context structure. + * This structure is used to represent the data for rdbmsSrvInfoTable. + */ +/* + * This structure contains storage for all the columns defined in the + * rdbmsSrvInfoTable. + */ +typedef struct rdbmsSrvInfoTable_data_s { + + /* + * rdbmsSrvInfoStartupTime(1)/DateAndTime/ASN_OCTET_STR/char(char)//L/A/w/e/R/d/H + */ +/* char rdbmsSrvInfoStartupTime[11]; +size_t rdbmsSrvInfoStartupTime_len; *//* # of char elements, not bytes */ + int startupYear; + int startupMonth; + int startupDay; + int startupHour; + int startupMinutes; + int startupSeconds; + int startupDeciSeconds; + int startupUtcOffsetDirection; + int startupUtcOffsetHours; + int startupUtcOffsetMinutes; + + /* + * rdbmsSrvInfoFinishedTransactions(2)/GAUGE/ASN_GAUGE/u_long(u_long)//l/A/w/e/r/d/h + */ + u_long rdbmsSrvInfoFinishedTransactions; + + /* + * rdbmsSrvInfoDiskReads(3)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h + */ + u_long rdbmsSrvInfoDiskReads; + + /* + * rdbmsSrvInfoLogicalReads(4)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h + */ + u_long rdbmsSrvInfoLogicalReads; + + /* + * rdbmsSrvInfoDiskWrites(5)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h + */ + u_long rdbmsSrvInfoDiskWrites; + + /* + * rdbmsSrvInfoLogicalWrites(6)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h + */ + u_long rdbmsSrvInfoLogicalWrites; + + /* + * rdbmsSrvInfoPageReads(7)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h + */ + u_long rdbmsSrvInfoPageReads; + + /* + * rdbmsSrvInfoPageWrites(8)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h + */ + u_long rdbmsSrvInfoPageWrites; + + /* + * rdbmsSrvInfoDiskOutOfSpaces(9)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h + */ + u_long rdbmsSrvInfoDiskOutOfSpaces; + + /* + * rdbmsSrvInfoHandledRequests(10)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h + */ + u_long rdbmsSrvInfoHandledRequests; + + /* + * rdbmsSrvInfoRequestRecvs(11)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h + */ + u_long rdbmsSrvInfoRequestRecvs; + + /* + * rdbmsSrvInfoRequestSends(12)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h + */ + u_long rdbmsSrvInfoRequestSends; + + /* + * rdbmsSrvInfoHighwaterInboundAssociations(13)/GAUGE/ASN_GAUGE/u_long(u_long)//l/A/w/e/r/d/h + */ + u_long rdbmsSrvInfoHighwaterInboundAssociations; + + /* + * rdbmsSrvInfoMaxInboundAssociations(14)/GAUGE/ASN_GAUGE/u_long(u_long)//l/A/W/e/r/d/h + */ + u_long rdbmsSrvInfoMaxInboundAssociations; + +} rdbmsSrvInfoTable_data; + + +/* + * TODO:120:r: |-> Review rdbmsSrvInfoTable mib index. + * This structure is used to represent the index for rdbmsSrvInfoTable. + */ +typedef struct rdbmsSrvInfoTable_mib_index_s { + + /* + * applIndex(1)/INTEGER/ASN_INTEGER/long(long)//l/a/w/e/R/d/h + */ + long applIndex; + + +} rdbmsSrvInfoTable_mib_index; + + /* + * TODO:121:r: | |-> Review rdbmsSrvInfoTable max index length. + * If you KNOW that your indexes will never exceed a certain + * length, update this macro to that length. +*/ +#define MAX_rdbmsSrvInfoTable_IDX_LEN 1 + + +/* ********************************************************************* + * TODO:130:o: |-> Review rdbmsSrvInfoTable Row request (rowreq) context. + * When your functions are called, you will be passed a + * rdbmsSrvInfoTable_rowreq_ctx pointer. + */ +typedef struct rdbmsSrvInfoTable_rowreq_ctx_s { + + /** this must be first for container compare to work */ + netsnmp_index oid_idx; + oid oid_tmp[MAX_rdbmsSrvInfoTable_IDX_LEN]; + + rdbmsSrvInfoTable_mib_index tbl_idx; + + rdbmsSrvInfoTable_data data; + + /* + * flags per row. Currently, the first (lower) 8 bits are reserved + * for the user. See mfd.h for other flags. + */ + u_int rowreq_flags; + + /* + * implementor's context pointer (provided during registration) + */ + rdbmsSrvInfoTable_registration_ptr rdbmsSrvInfoTable_reg; + + /* + * TODO:131:o: | |-> Add useful data to rdbmsSrvInfoTable rowreq context. + */ + + /* + * storage for future expansion + */ + netsnmp_data_list *rdbmsSrvInfoTable_data_list; + +} rdbmsSrvInfoTable_rowreq_ctx; + +typedef struct rdbmsSrvInfoTable_ref_rowreq_ctx_s { + rdbmsSrvInfoTable_rowreq_ctx *rowreq_ctx; +} rdbmsSrvInfoTable_ref_rowreq_ctx; + +/* ********************************************************************* + * function prototypes + */ + int rdbmsSrvInfoTable_pre_request(rdbmsSrvInfoTable_registration_ptr user_context); + int rdbmsSrvInfoTable_post_request(rdbmsSrvInfoTable_registration_ptr user_context); + + +extern oid rdbmsSrvInfoTable_oid[]; +extern int rdbmsSrvInfoTable_oid_size; + + +#include "rdbmsSrvInfoTable_interface.h" +#include "rdbmsSrvInfoTable_data_access.h" +#include "rdbmsSrvInfoTable_data_get.h" +#include "rdbmsSrvInfoTable_data_set.h" + +/* + * DUMMY markers, ignore + * + * TODO:099:x: ************************************************************* + * TODO:199:x: ************************************************************* + * TODO:299:x: ************************************************************* + * TODO:399:x: ************************************************************* + * TODO:499:x: ************************************************************* + */ + +#ifdef __cplusplus +} +#endif + +#endif /* RDBMSSRVINFOTABLE_H */ diff --git a/RDBMS-MIB_src/rdbmsSrvInfoTable/rdbmsSrvInfoTable_data_access.c b/RDBMS-MIB_src/rdbmsSrvInfoTable/rdbmsSrvInfoTable_data_access.c new file mode 100644 index 0000000..af424be --- /dev/null +++ b/RDBMS-MIB_src/rdbmsSrvInfoTable/rdbmsSrvInfoTable_data_access.c @@ -0,0 +1,340 @@ +/*------------------------------------------------------------------------- + * rdbmsSrvInfoTable_data_access.c + * + * RDBMSMIB mib module. + * + * Copyright (c) 2004-2007, PostgreSQL Global Development Group + * Author: Joshua Tolley + * + * $Id: rdbmsSrvInfoTable_data_access.c,v 1.7 2009/06/06 04:12:10 eggyknap Exp $ + * + *------------------------------------------------------------------------- + */ + +#include "pgsnmpd.h" + +/* include our parent header */ +#include "rdbmsSrvInfoTable.h" + + +#include "rdbmsSrvInfoTable_data_access.h" + +/** @defgroup data_access data_access: Routines to access data + * + * These routines are used to locate the data used to satisfy + * requests. + * + * @{ + */ +/********************************************************************** + ********************************************************************** + *** + *** Table rdbmsSrvInfoTable + *** + ********************************************************************** + **********************************************************************/ +/* + * rdbmsSrvInfoTable is subid 6 of rdbmsObjects. + * Its status is Current. + * OID: .1.3.6.1.2.1.39.1.6, length: 9 +*/ + +/** + * initialization for rdbmsSrvInfoTable data access + * + * This function is called during startup to allow you to + * allocate any resources you need for the data table. + * + * @param rdbmsSrvInfoTable_reg + * Pointer to rdbmsSrvInfoTable_registration + * + * @retval MFD_SUCCESS : success. + * @retval MFD_ERROR : unrecoverable error. + */ +int +rdbmsSrvInfoTable_init_data(rdbmsSrvInfoTable_registration_ptr rdbmsSrvInfoTable_reg) +{ + DEBUGMSGTL(("verbose:rdbmsSrvInfoTable:rdbmsSrvInfoTable_init_data","called\n")); + + return MFD_SUCCESS; +} /* rdbmsSrvInfoTable_init_data */ + +/** + * container-cached overview + * + */ + +/*********************************************************************** + * + * cache + * + ***********************************************************************/ +/** + * container initialization + * + * @param container_ptr_ptr A pointer to a container pointer. If you + * create a custom container, use this parameter to return it + * to the MFD helper. If set to NULL, the MFD helper will + * allocate a container for you. + * @param cache A pointer to a cache structure. You can set the timeout + * and other cache flags using this pointer. + * + * This function is called at startup to allow you to customize certain + * aspects of the access method. For the most part, it is for advanced + * users. The default code should suffice for most cases. If no custom + * container is allocated, the MFD code will create one for your. + * + * This is also the place to set up cache behavior. The default, to + * simply set the cache timeout, will work well with the default + * container. If you are using a custom container, you may want to + * look at the cache helper documentation to see if there are any + * flags you want to set. + * + * @remark + * This would also be a good place to do any initialization needed + * for you data source. For example, opening a connection to another + * process that will supply the data, opening a database, etc. + */ +void +rdbmsSrvInfoTable_container_init(netsnmp_container **container_ptr_ptr, + netsnmp_cache *cache) +{ + DEBUGMSGTL(("verbose:rdbmsSrvInfoTable:rdbmsSrvInfoTable_container_init","called\n")); + + if((NULL == cache) || (NULL == container_ptr_ptr)) { + snmp_log(LOG_ERR,"bad params to rdbmsSrvInfoTable_container_init\n"); + return; + } + + /* + * For advanced users, you can use a custom container. If you + * do not create one, one will be created for you. + */ + *container_ptr_ptr = NULL; + + /* + * TODO:345:A: Set up rdbmsSrvInfoTable cache properties. + * + * Also for advanced users, you can set parameters for the + * cache. Do not change the magic pointer, as it is used + * by the MFD helper. To completely disable caching, set + * cache->enabled to 0. + */ + cache->timeout = RDBMSSRVINFOTABLE_CACHE_TIMEOUT; /* seconds */ +} /* rdbmsSrvInfoTable_container_init */ + +/** + * load cache data + * + * TODO:350:M: Implement rdbmsSrvInfoTable cache load + * + * @param container container to which items should be inserted + * + * @retval MFD_SUCCESS : success. + * @retval MFD_RESOURCE_UNAVAILABLE : Can't access data source + * @retval MFD_ERROR : other error. + * + * This function is called to cache the index(es) (and data, optionally) + * for the every row in the data set. + * + * @remark + * While loading the cache, the only important thing is the indexes. + * If access to your data is cheap/fast (e.g. you have a pointer to a + * structure in memory), it would make sense to update the data here. + * If, however, the accessing the data invovles more work (e.g. parsing + * some other existing data, or peforming calculations to derive the data), + * then you can limit yourself to setting the indexes and saving any + * information you will need later. Then use the saved information in + * rdbmsSrvInfoTable_row_prep() for populating data. + * + * @note + * If you need consistency between rows (like you want statistics + * for each row to be from the same time frame), you should set all + * data here. + * + */ +int +rdbmsSrvInfoTable_cache_load(netsnmp_container *container) +{ + rdbmsSrvInfoTable_rowreq_ctx *rowreq_ctx; + size_t count = 0; + PGresult *pg_db_qry; + static int maxAssociations = 0; + + long applIndex; + int resultCount, tmpInt, rdbmsSrvInfoMaxInboundAssociations = 0, i, errorCode = MFD_SUCCESS; + + DEBUGMSGTL(("verbose:rdbmsSrvInfoTable:rdbmsSrvInfoTable_cache_load","called\n")); + + if (PQstatus(dbconn) == CONNECTION_OK) { + pg_db_qry = PQexec(dbconn, "SELECT setting FROM pg_settings WHERE name = 'max_connections'"); + if (PQresultStatus(pg_db_qry) == PGRES_TUPLES_OK) + rdbmsSrvInfoMaxInboundAssociations = atoi(PQgetvalue(pg_db_qry, 0, 0)); + PQclear(pg_db_qry); + pg_db_qry = PQexec(dbconn, "SELECT setting FROM pg_settings WHERE name = 'superuser_reserved_connections'"); + if (PQresultStatus(pg_db_qry) == PGRES_TUPLES_OK) + rdbmsSrvInfoMaxInboundAssociations -= atoi(PQgetvalue(pg_db_qry, 0, 0)); + PQclear(pg_db_qry); + pg_db_qry = PQexec(dbconn, "SELECT count(1) FROM pg_stat_activity"); + if (PQresultStatus(pg_db_qry) == PGRES_TUPLES_OK) { + tmpInt = atoi(PQgetvalue(pg_db_qry, 0, 0)); + maxAssociations = (tmpInt > maxAssociations) ? tmpInt : maxAssociations; + } + PQclear(pg_db_qry); + if (PQserverVersion(dbconn) < 80100) + pg_db_qry = PQexec(dbconn, "SELECT datid, EXTRACT(YEAR FROM now()), EXTRACT(MONTH FROM now()), EXTRACT(DAY FROM now()), EXTRACT(HOUR FROM now()), EXTRACT(MINUTE FROM now()), EXTRACT(SECOND FROM now()), EXTRACT(MILLISECOND FROM now()), EXTRACT(TIMEZONE_HOUR FROM now()), EXTRACT(TIMEZONE_MINUTE FROM now()), xact_commit, blks_read, blks_read + blks_hit FROM pg_stat_database"); + else + pg_db_qry = PQexec(dbconn, "SELECT datid, EXTRACT(YEAR FROM pg_postmaster_start_time()), EXTRACT(MONTH FROM pg_postmaster_start_time()), EXTRACT(DAY FROM pg_postmaster_start_time()), EXTRACT(HOUR FROM pg_postmaster_start_time()), EXTRACT(MINUTE FROM pg_postmaster_start_time()), EXTRACT(SECOND FROM pg_postmaster_start_time()), EXTRACT(MILLISECOND FROM pg_postmaster_start_time()), EXTRACT(TIMEZONE_HOUR FROM pg_postmaster_start_time()), EXTRACT(TIMEZONE_MINUTE FROM pg_postmaster_start_time()), xact_commit, blks_read, blks_read + blks_hit FROM pg_stat_database"); + } + else { + snmp_log(LOG_ERR, "Can't get connected to the database"); + return -1; + } + if (PQresultStatus(pg_db_qry) != PGRES_TUPLES_OK) { + snmp_log(LOG_ERR, "Didn't get any results from the database"); + PQclear(pg_db_qry); + /*PQfinish(dbconn);*/ + return -1; + } + + resultCount = PQntuples(pg_db_qry); + + /* + * TODO:351:M: |-> Load/update data in the rdbmsSrvInfoTable container. + * loop over your rdbmsSrvInfoTable data, allocate a rowreq context, + * set the index(es) [and data, optionally] and insert into + * the container. + */ + for (i = 0; i < resultCount; i++) { + + /* + * TODO:352:M: | |-> set indexes in new rdbmsSrvInfoTable rowreq context. + */ + rowreq_ctx = rdbmsSrvInfoTable_allocate_rowreq_ctx(); + if (NULL == rowreq_ctx) { + snmp_log(LOG_ERR, "memory allocation failed\n"); + errorCode = MFD_RESOURCE_UNAVAILABLE; + break; + } + applIndex = atoi(PQgetvalue(pg_db_qry, i, 0)); + if(MFD_SUCCESS != rdbmsSrvInfoTable_indexes_set(rowreq_ctx + , applIndex + )) { + snmp_log(LOG_ERR,"error setting index while loading " + "rdbmsSrvInfoTable cache.\n"); + rdbmsSrvInfoTable_release_rowreq_ctx(rowreq_ctx); + continue; + } + + rowreq_ctx->data.startupYear = atoi(PQgetvalue(pg_db_qry, i, 1)); + rowreq_ctx->data.startupMonth = atoi(PQgetvalue(pg_db_qry, i, 2)); + rowreq_ctx->data.startupDay = atoi(PQgetvalue(pg_db_qry, i, 3)); + rowreq_ctx->data.startupHour = atoi(PQgetvalue(pg_db_qry, i, 4)); + rowreq_ctx->data.startupMinutes = atoi(PQgetvalue(pg_db_qry, i, 5)); + rowreq_ctx->data.startupSeconds = atoi(PQgetvalue(pg_db_qry, i, 6)); + rowreq_ctx->data.startupDeciSeconds = atoi(PQgetvalue(pg_db_qry, i, 7)); + rowreq_ctx->data.startupUtcOffsetHours = atoi(PQgetvalue(pg_db_qry, i, 8)); + rowreq_ctx->data.startupUtcOffsetMinutes = atoi(PQgetvalue(pg_db_qry, i, 9)); + tmpInt = rowreq_ctx->data.startupUtcOffsetHours * 60 + rowreq_ctx->data.startupUtcOffsetMinutes; + if (tmpInt == 0) + rowreq_ctx->data.startupUtcOffsetDirection = 0; + else + rowreq_ctx->data.startupUtcOffsetDirection = (tmpInt > 0 ? 1 : -1); + + rowreq_ctx->data.rdbmsSrvInfoFinishedTransactions = atoi(PQgetvalue(pg_db_qry, i, 10)); + + rowreq_ctx->data.rdbmsSrvInfoDiskReads = atoi(PQgetvalue(pg_db_qry, i, 11)); + + rowreq_ctx->data.rdbmsSrvInfoLogicalReads = atoi(PQgetvalue(pg_db_qry, i, 12)); + + /* Skip this unless someone comes up with a way to get these data */ + /*rowreq_ctx->data.rdbmsSrvInfoDiskWrites = rdbmsSrvInfoDiskWrites; + + rowreq_ctx->data.rdbmsSrvInfoLogicalWrites = rdbmsSrvInfoLogicalWrites; */ + + rowreq_ctx->data.rdbmsSrvInfoPageReads = rowreq_ctx->data.rdbmsSrvInfoDiskReads; + + /*rowreq_ctx->data.rdbmsSrvInfoPageWrites = rdbmsSrvInfoPageWrites; */ + + /* pgsql will have a fatal error if this happens, so the value must be 0 if we're connected to a db server */ + rowreq_ctx->data.rdbmsSrvInfoDiskOutOfSpaces = 0; + + /* rowreq_ctx->data.rdbmsSrvInfoHandledRequests = rdbmsSrvInfoHandledRequests; + + rowreq_ctx->data.rdbmsSrvInfoRequestRecvs = rdbmsSrvInfoRequestRecvs; + + rowreq_ctx->data.rdbmsSrvInfoRequestSends = rdbmsSrvInfoRequestSends; */ + + rowreq_ctx->data.rdbmsSrvInfoHighwaterInboundAssociations = maxAssociations; + + rowreq_ctx->data.rdbmsSrvInfoMaxInboundAssociations = rdbmsSrvInfoMaxInboundAssociations; + + + /* + * insert into table container + */ + CONTAINER_INSERT(container, rowreq_ctx); + ++count; + } + + + DEBUGMSGT(("verbose:rdbmsSrvInfoTable:rdbmsSrvInfoTable_cache_load", + "inserted %d records\n", count)); + + PQclear(pg_db_qry); + return errorCode; +} /* rdbmsSrvInfoTable_cache_load */ + +/** + * cache clean up + * + * @param container container with all current items + * + * This optional callback is called prior to all + * item's being removed from the container. If you + * need to do any processing before that, do it here. + * + * @note + * The MFD helper will take care of releasing all the row contexts. + * + */ +void +rdbmsSrvInfoTable_cache_free(netsnmp_container *container) +{ + DEBUGMSGTL(("verbose:rdbmsSrvInfoTable:rdbmsSrvInfoTable_cache_free","called\n")); + + /* + * TODO:380:M: Free rdbmsSrvInfoTable cache. + */ +} /* rdbmsSrvInfoTable_cache_free */ + +/** + * prepare row for processing. + * + * When the agent has located the row for a request, this function is + * called to prepare the row for processing. If you fully populated + * the data context during the index setup phase, you may not need to + * do anything. + * + * @param rowreq_ctx pointer to a context. + * + * @retval MFD_SUCCESS : success. + * @retval MFD_ERROR : other error. + */ +int +rdbmsSrvInfoTable_row_prep( rdbmsSrvInfoTable_rowreq_ctx *rowreq_ctx) +{ + DEBUGMSGTL(("verbose:rdbmsSrvInfoTable:rdbmsSrvInfoTable_row_prep","called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + /* + * TODO:390:o: Prepare row for request. + * If populating row data was delayed, this is the place to + * fill in the row for this request. + */ + + return MFD_SUCCESS; +} /* rdbmsSrvInfoTable_row_prep */ + +/** @} */ diff --git a/RDBMS-MIB_src/rdbmsSrvInfoTable/rdbmsSrvInfoTable_data_access.h b/RDBMS-MIB_src/rdbmsSrvInfoTable/rdbmsSrvInfoTable_data_access.h new file mode 100644 index 0000000..51b463b --- /dev/null +++ b/RDBMS-MIB_src/rdbmsSrvInfoTable/rdbmsSrvInfoTable_data_access.h @@ -0,0 +1,77 @@ +/*------------------------------------------------------------------------- + * rdbmsSrvInfoTable_data_access.h + * + * RDBMSMIB mib module. + * + * Copyright (c) 2004-2007, PostgreSQL Global Development Group + * Author: Joshua Tolley + * + * $Id: rdbmsSrvInfoTable_data_access.h,v 1.3 2007/09/13 14:20:44 h-saito Exp $ + * + *------------------------------------------------------------------------- + */ + +#ifndef RDBMSSRVINFOTABLE_DATA_ACCESS_H +#define RDBMSSRVINFOTABLE_DATA_ACCESS_H + +#ifdef __cplusplus +extern "C" { +#endif + + +/* ********************************************************************* + * function declarations + */ + +/* ********************************************************************* + * Table declarations + */ +/********************************************************************** + ********************************************************************** + *** + *** Table rdbmsSrvInfoTable + *** + ********************************************************************** + **********************************************************************/ +/* + * rdbmsSrvInfoTable is subid 6 of rdbmsObjects. + * Its status is Current. + * OID: .1.3.6.1.2.1.39.1.6, length: 9 +*/ + + + int rdbmsSrvInfoTable_init_data(rdbmsSrvInfoTable_registration_ptr rdbmsSrvInfoTable_reg); + + +/* + * TODO:180:o: Review rdbmsSrvInfoTable cache timeout. + * The number of seconds before the cache times out + */ +#define RDBMSSRVINFOTABLE_CACHE_TIMEOUT 10 + +void rdbmsSrvInfoTable_container_init(netsnmp_container **container_ptr_ptr, + netsnmp_cache *cache); +int rdbmsSrvInfoTable_cache_load(netsnmp_container *container); +void rdbmsSrvInfoTable_cache_free(netsnmp_container *container); + + /* + *************************************************** + *** START EXAMPLE CODE *** + ***---------------------------------------------***/ +/* ********************************************************************* + * Since we have no idea how you really access your data, we'll go with + * a worst case example: a flat text file. + */ +#define MAX_LINE_SIZE 256 + /* + ***---------------------------------------------*** + *** END EXAMPLE CODE *** + ***************************************************/ + int rdbmsSrvInfoTable_row_prep( rdbmsSrvInfoTable_rowreq_ctx *rowreq_ctx); + + +#ifdef __cplusplus +} +#endif + +#endif /* RDBMSSRVINFOTABLE_DATA_ACCESS_H */ diff --git a/RDBMS-MIB_src/rdbmsSrvInfoTable/rdbmsSrvInfoTable_data_get.c b/RDBMS-MIB_src/rdbmsSrvInfoTable/rdbmsSrvInfoTable_data_get.c new file mode 100644 index 0000000..e0ff3bc --- /dev/null +++ b/RDBMS-MIB_src/rdbmsSrvInfoTable/rdbmsSrvInfoTable_data_get.c @@ -0,0 +1,1429 @@ +/*------------------------------------------------------------------------- + * rdbmsSrvInfoTable_data_get.c + * + * RDBMSMIB mib module. + * + * Copyright (c) 2004-2007, PostgreSQL Global Development Group + * Author: Joshua Tolley + * + * $Id: rdbmsSrvInfoTable_data_get.c,v 1.4 2007/09/13 14:20:44 h-saito Exp $ + * + *------------------------------------------------------------------------- + */ + +#include "pgsnmpd.h" + +/* include our parent header */ +#include "rdbmsSrvInfoTable.h" + + +/** @defgroup data_get data_get: Routines to get data + * + * TODO:230:M: Implement rdbmsSrvInfoTable get routines. + * TODO:240:M: Implement rdbmsSrvInfoTable mapping routines (if any). + * + * These routine are used to get the value for individual objects. The + * row context is passed, along with a pointer to the memory where the + * value should be copied. + * + * @{ + */ +/********************************************************************** + ********************************************************************** + *** + *** Table rdbmsSrvInfoTable + *** + ********************************************************************** + **********************************************************************/ +/* + * rdbmsSrvInfoTable is subid 6 of rdbmsObjects. + * Its status is Current. + * OID: .1.3.6.1.2.1.39.1.6, length: 9 +*/ + +/* --------------------------------------------------------------------- + * TODO:200:r: Implement rdbmsSrvInfoTable data context functions. + */ + +/** + * set mib index(es) + * + * @param tbl_idx mib index structure + * + * @retval MFD_SUCCESS : success. + * @retval MFD_ERROR : other error. + * + * @remark + * This convenience function is useful for setting all the MIB index + * components with a single function call. It is assume that the C values + * have already been mapped from their native/rawformat to the MIB format. + */ +int +rdbmsSrvInfoTable_indexes_set_tbl_idx(rdbmsSrvInfoTable_mib_index *tbl_idx, long applIndex_val) +{ + DEBUGMSGTL(("verbose:rdbmsSrvInfoTable:rdbmsSrvInfoTable_indexes_set_tbl_idx","called\n")); + + /* applIndex(1)/INTEGER/ASN_INTEGER/long(long)//l/a/w/e/R/d/h */ + tbl_idx->applIndex = applIndex_val; + + + return MFD_SUCCESS; +} /* rdbmsSrvInfoTable_indexes_set_tbl_idx */ + +/** + * @internal + * set row context indexes + * + * @param reqreq_ctx the row context that needs updated indexes + * + * @retval MFD_SUCCESS : success. + * @retval MFD_ERROR : other error. + * + * @remark + * This function sets the mib indexs, then updates the oid indexs + * from the mib index. + */ +int +rdbmsSrvInfoTable_indexes_set(rdbmsSrvInfoTable_rowreq_ctx *rowreq_ctx, long applIndex_val) +{ + DEBUGMSGTL(("verbose:rdbmsSrvInfoTable:rdbmsSrvInfoTable_indexes_set","called\n")); + + if(MFD_SUCCESS != rdbmsSrvInfoTable_indexes_set_tbl_idx(&rowreq_ctx->tbl_idx + , applIndex_val + )) + return MFD_ERROR; + + /* + * convert mib index to oid index + */ + rowreq_ctx->oid_idx.len = sizeof(rowreq_ctx->oid_tmp) / sizeof(oid); + if(0 != rdbmsSrvInfoTable_index_to_oid(&rowreq_ctx->oid_idx, + &rowreq_ctx->tbl_idx)) { + return MFD_ERROR; + } + + return MFD_SUCCESS; +} /* rdbmsSrvInfoTable_indexes_set */ + + +/*--------------------------------------------------------------------- + * RDBMS-MIB::rdbmsSrvInfoEntry.rdbmsSrvInfoStartupTime + * rdbmsSrvInfoStartupTime is subid 1 of rdbmsSrvInfoEntry. + * Its status is Current, and its access level is ReadOnly. + * OID: .1.3.6.1.2.1.39.1.6.1.1 + * Description: +The date and time at which this server was last started. + * + * Attributes: + * accessible 1 isscalar 0 enums 0 hasdefval 0 + * readable 1 iscolumn 1 ranges 1 hashint 1 + * settable 0 + * hint: 2d-1d-1d,1d:1d:1d.1d,1a1d:1d + * + * Ranges: 8, 11; + * + * Its syntax is DateAndTime (based on perltype OCTETSTR) + * The net-snmp type is ASN_OCTET_STR. The C type decl is char (char) + * This data type requires a length. (Max 11) + */ +/** + * map a value from its original native format to the MIB format. + * + * @retval MFD_SUCCESS : success + * @retval MFD_ERROR : Any other error + * + * @note parameters follow the memset convention (dest, src). + * + * @note generation and use of this function can be turned off by re-running + * mib2c after adding the following line to the file + * default-node-rdbmsSrvInfoStartupTime.m2d : + * @eval $m2c_node_skip_mapping = 1@ + * + * @remark + * If the values for your data type don't exactly match the + * possible values defined by the mib, you should map them here. + * Otherwise, just do a direct copy. + */ +int +rdbmsSrvInfoStartupTime_map(char **mib_rdbmsSrvInfoStartupTime_val_ptr_ptr, size_t *mib_rdbmsSrvInfoStartupTime_val_ptr_len_ptr, char *raw_rdbmsSrvInfoStartupTime_val_ptr, size_t raw_rdbmsSrvInfoStartupTime_val_ptr_len, int allow_realloc) +{ + int converted_len; + + netsnmp_assert(NULL != raw_rdbmsSrvInfoStartupTime_val_ptr); + netsnmp_assert((NULL != mib_rdbmsSrvInfoStartupTime_val_ptr_ptr) && (NULL != mib_rdbmsSrvInfoStartupTime_val_ptr_len_ptr)); + + DEBUGMSGTL(("verbose:rdbmsSrvInfoTable:rdbmsSrvInfoStartupTime_map","called\n")); + + /* + * TODO:241:r: |-> Implement rdbmsSrvInfoStartupTime non-integer mapping + * it is hard to autogenerate code for mapping types that are not simple + * integers, so here is an idea of what you might need to do. It will + * probably need some tweaking to get right. + */ + /* + * if the length of the raw data doesn't directly correspond with + * the length of the mib data, set converted_len to the + * space required. + */ + converted_len = raw_rdbmsSrvInfoStartupTime_val_ptr_len; /* assume equal */ + if((NULL == *mib_rdbmsSrvInfoStartupTime_val_ptr_ptr) || (*mib_rdbmsSrvInfoStartupTime_val_ptr_len_ptr < converted_len)) { + if(! allow_realloc) { + snmp_log(LOG_ERR,"not enough space for value mapping\n"); + return SNMP_ERR_GENERR; + } + *mib_rdbmsSrvInfoStartupTime_val_ptr_ptr = realloc( *mib_rdbmsSrvInfoStartupTime_val_ptr_ptr, converted_len * sizeof(**mib_rdbmsSrvInfoStartupTime_val_ptr_ptr)); + if(NULL == *mib_rdbmsSrvInfoStartupTime_val_ptr_ptr) { + snmp_log(LOG_ERR,"could not allocate memory\n"); + return SNMP_ERR_GENERR; + } + } + *mib_rdbmsSrvInfoStartupTime_val_ptr_len_ptr = converted_len; + memcpy( *mib_rdbmsSrvInfoStartupTime_val_ptr_ptr, raw_rdbmsSrvInfoStartupTime_val_ptr, converted_len ); + + return MFD_SUCCESS; +} /* rdbmsSrvInfoStartupTime_map */ + +/** + * Extract the current value of the rdbmsSrvInfoStartupTime data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param rdbmsSrvInfoStartupTime_val_ptr_ptr + * Pointer to storage for a char variable + * @param rdbmsSrvInfoStartupTime_val_ptr_len_ptr + * Pointer to a size_t. On entry, it will contain the size (in bytes) + * pointed to by rdbmsSrvInfoStartupTime. + * On exit, this value should contain the data size (in bytes). + * + * @retval MFD_SUCCESS : success + * @retval MFD_SKIP : skip this node (no value for now) + * @retval MFD_ERROR : Any other error +* + * @note If you need more than (*rdbmsSrvInfoStartupTime_val_ptr_len_ptr) bytes of memory, + * allocate it using malloc() and update rdbmsSrvInfoStartupTime_val_ptr_ptr. + * <b>DO NOT</b> free the previous pointer. + * The MFD helper will release the memory you allocate. + * + * @remark If you call this function yourself, you are responsible + * for checking if the pointer changed, and freeing any + * previously allocated memory. (Not necessary if you pass + * in a pointer to static memory, obviously.) + */ +int +rdbmsSrvInfoStartupTime_get( rdbmsSrvInfoTable_rowreq_ctx *rowreq_ctx, char **rdbmsSrvInfoStartupTime_val_ptr_ptr, size_t *rdbmsSrvInfoStartupTime_val_ptr_len_ptr ) +{ + int rc; + /** we should have a pointer and enough storage */ + netsnmp_assert( (NULL != rdbmsSrvInfoStartupTime_val_ptr_ptr) && (NULL != *rdbmsSrvInfoStartupTime_val_ptr_ptr)); + netsnmp_assert( (NULL != rdbmsSrvInfoStartupTime_val_ptr_len_ptr) && ((* rdbmsSrvInfoStartupTime_val_ptr_len_ptr) >= 11)); + + /* call convenience function to set data */ + rc = netsnmp_dateandtime_set_buf_from_vars((u_char *)*rdbmsSrvInfoStartupTime_val_ptr_ptr, rdbmsSrvInfoStartupTime_val_ptr_len_ptr, + rowreq_ctx->data.startupYear, + rowreq_ctx->data.startupMonth, + rowreq_ctx->data.startupDay, + rowreq_ctx->data.startupHour, + rowreq_ctx->data.startupMinutes, + rowreq_ctx->data.startupSeconds, + rowreq_ctx->data.startupDeciSeconds, + rowreq_ctx->data.startupUtcOffsetDirection, + rowreq_ctx->data.startupUtcOffsetHours, + rowreq_ctx->data.startupUtcOffsetMinutes); + if(rc != SNMP_ERR_NOERROR) + return rc; + + + return MFD_SUCCESS; +} /* rdbmsSrvInfoStartupTime_get */ + +/*--------------------------------------------------------------------- + * RDBMS-MIB::rdbmsSrvInfoEntry.rdbmsSrvInfoFinishedTransactions + * rdbmsSrvInfoFinishedTransactions is subid 2 of rdbmsSrvInfoEntry. + * Its status is Current, and its access level is ReadOnly. + * OID: .1.3.6.1.2.1.39.1.6.1.2 + * Description: +The number of transactions visible to this server that have + been completed by either commit or abort. Some database + operations, such as read-only queries, may not result in the + creation of a transaction. + * + * Attributes: + * accessible 1 isscalar 0 enums 0 hasdefval 0 + * readable 1 iscolumn 1 ranges 0 hashint 0 + * settable 0 + * + * + * Its syntax is GAUGE (based on perltype GAUGE) + * The net-snmp type is ASN_GAUGE. The C type decl is u_long (u_long) + */ +/** + * map a value from its original native format to the MIB format. + * + * @retval MFD_SUCCESS : success + * @retval MFD_ERROR : Any other error + * + * @note parameters follow the memset convention (dest, src). + * + * @note generation and use of this function can be turned off by re-running + * mib2c after adding the following line to the file + * default-node-rdbmsSrvInfoFinishedTransactions.m2d : + * @eval $m2c_node_skip_mapping = 1@ + * + * @remark + * If the values for your data type don't exactly match the + * possible values defined by the mib, you should map them here. + * Otherwise, just do a direct copy. + */ +int +rdbmsSrvInfoFinishedTransactions_map(u_long *mib_rdbmsSrvInfoFinishedTransactions_val_ptr, u_long raw_rdbmsSrvInfoFinishedTransactions_val) +{ + netsnmp_assert(NULL != mib_rdbmsSrvInfoFinishedTransactions_val_ptr); + + DEBUGMSGTL(("verbose:rdbmsSrvInfoTable:rdbmsSrvInfoFinishedTransactions_map","called\n")); + + /* + * TODO:241:o: |-> Implement rdbmsSrvInfoFinishedTransactions mapping. + * If the values for your data type don't exactly match the + * possible values defined by the mib, you should map them here. + */ + (*mib_rdbmsSrvInfoFinishedTransactions_val_ptr) = raw_rdbmsSrvInfoFinishedTransactions_val; + + return MFD_SUCCESS; +} /* rdbmsSrvInfoFinishedTransactions_map */ + +/** + * Extract the current value of the rdbmsSrvInfoFinishedTransactions data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param rdbmsSrvInfoFinishedTransactions_val_ptr + * Pointer to storage for a u_long variable + * + * @retval MFD_SUCCESS : success + * @retval MFD_SKIP : skip this node (no value for now) + * @retval MFD_ERROR : Any other error + */ +int +rdbmsSrvInfoFinishedTransactions_get( rdbmsSrvInfoTable_rowreq_ctx *rowreq_ctx, u_long * rdbmsSrvInfoFinishedTransactions_val_ptr ) +{ + /** we should have a non-NULL pointer */ + netsnmp_assert( NULL != rdbmsSrvInfoFinishedTransactions_val_ptr ); + + + DEBUGMSGTL(("verbose:rdbmsSrvInfoTable:rdbmsSrvInfoFinishedTransactions_get","called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + +/* + * TODO:231:o: |-> Extract the current value of the rdbmsSrvInfoFinishedTransactions data. + * set (* rdbmsSrvInfoFinishedTransactions_val_ptr ) from rowreq_ctx->data + */ + (* rdbmsSrvInfoFinishedTransactions_val_ptr ) = rowreq_ctx->data.rdbmsSrvInfoFinishedTransactions; + + return MFD_SUCCESS; +} /* rdbmsSrvInfoFinishedTransactions_get */ + +/*--------------------------------------------------------------------- + * RDBMS-MIB::rdbmsSrvInfoEntry.rdbmsSrvInfoDiskReads + * rdbmsSrvInfoDiskReads is subid 3 of rdbmsSrvInfoEntry. + * Its status is Current, and its access level is ReadOnly. + * OID: .1.3.6.1.2.1.39.1.6.1.3 + * Description: +The total number of reads of database files issued to the + operating system by this server since startup. Numbers are + not comparable between products. What constitutes a + readand how it is accounted is product-specific. + * + * Attributes: + * accessible 1 isscalar 0 enums 0 hasdefval 0 + * readable 1 iscolumn 1 ranges 0 hashint 0 + * settable 0 + * + * + * Its syntax is COUNTER (based on perltype COUNTER) + * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) + */ +/** + * map a value from its original native format to the MIB format. + * + * @retval MFD_SUCCESS : success + * @retval MFD_ERROR : Any other error + * + * @note parameters follow the memset convention (dest, src). + * + * @note generation and use of this function can be turned off by re-running + * mib2c after adding the following line to the file + * default-node-rdbmsSrvInfoDiskReads.m2d : + * @eval $m2c_node_skip_mapping = 1@ + * + * @remark + * If the values for your data type don't exactly match the + * possible values defined by the mib, you should map them here. + * Otherwise, just do a direct copy. + */ +int +rdbmsSrvInfoDiskReads_map(u_long *mib_rdbmsSrvInfoDiskReads_val_ptr, u_long raw_rdbmsSrvInfoDiskReads_val) +{ + netsnmp_assert(NULL != mib_rdbmsSrvInfoDiskReads_val_ptr); + + DEBUGMSGTL(("verbose:rdbmsSrvInfoTable:rdbmsSrvInfoDiskReads_map","called\n")); + + /* + * TODO:241:o: |-> Implement rdbmsSrvInfoDiskReads mapping. + * If the values for your data type don't exactly match the + * possible values defined by the mib, you should map them here. + */ + (*mib_rdbmsSrvInfoDiskReads_val_ptr) = raw_rdbmsSrvInfoDiskReads_val; + + return MFD_SUCCESS; +} /* rdbmsSrvInfoDiskReads_map */ + +/** + * Extract the current value of the rdbmsSrvInfoDiskReads data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param rdbmsSrvInfoDiskReads_val_ptr + * Pointer to storage for a u_long variable + * + * @retval MFD_SUCCESS : success + * @retval MFD_SKIP : skip this node (no value for now) + * @retval MFD_ERROR : Any other error + */ +int +rdbmsSrvInfoDiskReads_get( rdbmsSrvInfoTable_rowreq_ctx *rowreq_ctx, u_long * rdbmsSrvInfoDiskReads_val_ptr ) +{ + /** we should have a non-NULL pointer */ + netsnmp_assert( NULL != rdbmsSrvInfoDiskReads_val_ptr ); + + + DEBUGMSGTL(("verbose:rdbmsSrvInfoTable:rdbmsSrvInfoDiskReads_get","called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + +/* + * TODO:231:o: |-> Extract the current value of the rdbmsSrvInfoDiskReads data. + * set (* rdbmsSrvInfoDiskReads_val_ptr ) from rowreq_ctx->data + */ + (* rdbmsSrvInfoDiskReads_val_ptr ) = rowreq_ctx->data.rdbmsSrvInfoDiskReads; + + return MFD_SUCCESS; +} /* rdbmsSrvInfoDiskReads_get */ + +/*--------------------------------------------------------------------- + * RDBMS-MIB::rdbmsSrvInfoEntry.rdbmsSrvInfoLogicalReads + * rdbmsSrvInfoLogicalReads is subid 4 of rdbmsSrvInfoEntry. + * Its status is Current, and its access level is ReadOnly. + * OID: .1.3.6.1.2.1.39.1.6.1.4 + * Description: +The total number of logical reads of database files made + internally by this server since startup. The values of this + object and those of rdbmsSrvInfoDiskReads reveal the effect + of caching on read operation. Numbers are not comparable + between products, and may only be meaningful when aggregated + across all servers sharing a common cache. + * + * Attributes: + * accessible 1 isscalar 0 enums 0 hasdefval 0 + * readable 1 iscolumn 1 ranges 0 hashint 0 + * settable 0 + * + * + * Its syntax is COUNTER (based on perltype COUNTER) + * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) + */ +/** + * map a value from its original native format to the MIB format. + * + * @retval MFD_SUCCESS : success + * @retval MFD_ERROR : Any other error + * + * @note parameters follow the memset convention (dest, src). + * + * @note generation and use of this function can be turned off by re-running + * mib2c after adding the following line to the file + * default-node-rdbmsSrvInfoLogicalReads.m2d : + * @eval $m2c_node_skip_mapping = 1@ + * + * @remark + * If the values for your data type don't exactly match the + * possible values defined by the mib, you should map them here. + * Otherwise, just do a direct copy. + */ +int +rdbmsSrvInfoLogicalReads_map(u_long *mib_rdbmsSrvInfoLogicalReads_val_ptr, u_long raw_rdbmsSrvInfoLogicalReads_val) +{ + netsnmp_assert(NULL != mib_rdbmsSrvInfoLogicalReads_val_ptr); + + DEBUGMSGTL(("verbose:rdbmsSrvInfoTable:rdbmsSrvInfoLogicalReads_map","called\n")); + + /* + * TODO:241:o: |-> Implement rdbmsSrvInfoLogicalReads mapping. + * If the values for your data type don't exactly match the + * possible values defined by the mib, you should map them here. + */ + (*mib_rdbmsSrvInfoLogicalReads_val_ptr) = raw_rdbmsSrvInfoLogicalReads_val; + + return MFD_SUCCESS; +} /* rdbmsSrvInfoLogicalReads_map */ + +/** + * Extract the current value of the rdbmsSrvInfoLogicalReads data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param rdbmsSrvInfoLogicalReads_val_ptr + * Pointer to storage for a u_long variable + * + * @retval MFD_SUCCESS : success + * @retval MFD_SKIP : skip this node (no value for now) + * @retval MFD_ERROR : Any other error + */ +int +rdbmsSrvInfoLogicalReads_get( rdbmsSrvInfoTable_rowreq_ctx *rowreq_ctx, u_long * rdbmsSrvInfoLogicalReads_val_ptr ) +{ + /** we should have a non-NULL pointer */ + netsnmp_assert( NULL != rdbmsSrvInfoLogicalReads_val_ptr ); + + + DEBUGMSGTL(("verbose:rdbmsSrvInfoTable:rdbmsSrvInfoLogicalReads_get","called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + +/* + * TODO:231:o: |-> Extract the current value of the rdbmsSrvInfoLogicalReads data. + * set (* rdbmsSrvInfoLogicalReads_val_ptr ) from rowreq_ctx->data + */ + (* rdbmsSrvInfoLogicalReads_val_ptr ) = rowreq_ctx->data.rdbmsSrvInfoLogicalReads; + + return MFD_SUCCESS; +} /* rdbmsSrvInfoLogicalReads_get */ + +/*--------------------------------------------------------------------- + * RDBMS-MIB::rdbmsSrvInfoEntry.rdbmsSrvInfoDiskWrites + * rdbmsSrvInfoDiskWrites is subid 5 of rdbmsSrvInfoEntry. + * Its status is Current, and its access level is ReadOnly. + * OID: .1.3.6.1.2.1.39.1.6.1.5 + * Description: +The total number of writes to database files issued to the + operating system by this server since startup. Numbers are + not comparable between products. + * + * Attributes: + * accessible 1 isscalar 0 enums 0 hasdefval 0 + * readable 1 iscolumn 1 ranges 0 hashint 0 + * settable 0 + * + * + * Its syntax is COUNTER (based on perltype COUNTER) + * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) + */ +/** + * map a value from its original native format to the MIB format. + * + * @retval MFD_SUCCESS : success + * @retval MFD_ERROR : Any other error + * + * @note parameters follow the memset convention (dest, src). + * + * @note generation and use of this function can be turned off by re-running + * mib2c after adding the following line to the file + * default-node-rdbmsSrvInfoDiskWrites.m2d : + * @eval $m2c_node_skip_mapping = 1@ + * + * @remark + * If the values for your data type don't exactly match the + * possible values defined by the mib, you should map them here. + * Otherwise, just do a direct copy. + */ +int +rdbmsSrvInfoDiskWrites_map(u_long *mib_rdbmsSrvInfoDiskWrites_val_ptr, u_long raw_rdbmsSrvInfoDiskWrites_val) +{ + netsnmp_assert(NULL != mib_rdbmsSrvInfoDiskWrites_val_ptr); + + DEBUGMSGTL(("verbose:rdbmsSrvInfoTable:rdbmsSrvInfoDiskWrites_map","called\n")); + + /* + * TODO:241:o: |-> Implement rdbmsSrvInfoDiskWrites mapping. + * If the values for your data type don't exactly match the + * possible values defined by the mib, you should map them here. + */ + (*mib_rdbmsSrvInfoDiskWrites_val_ptr) = raw_rdbmsSrvInfoDiskWrites_val; + + return MFD_SUCCESS; +} /* rdbmsSrvInfoDiskWrites_map */ + +/** + * Extract the current value of the rdbmsSrvInfoDiskWrites data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param rdbmsSrvInfoDiskWrites_val_ptr + * Pointer to storage for a u_long variable + * + * @retval MFD_SUCCESS : success + * @retval MFD_SKIP : skip this node (no value for now) + * @retval MFD_ERROR : Any other error + */ +int +rdbmsSrvInfoDiskWrites_get( rdbmsSrvInfoTable_rowreq_ctx *rowreq_ctx, u_long * rdbmsSrvInfoDiskWrites_val_ptr ) +{ + return MFD_SKIP; + /** we should have a non-NULL pointer */ + netsnmp_assert( NULL != rdbmsSrvInfoDiskWrites_val_ptr ); + + + DEBUGMSGTL(("verbose:rdbmsSrvInfoTable:rdbmsSrvInfoDiskWrites_get","called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + +/* + * TODO:231:o: |-> Extract the current value of the rdbmsSrvInfoDiskWrites data. + * set (* rdbmsSrvInfoDiskWrites_val_ptr ) from rowreq_ctx->data + */ + (* rdbmsSrvInfoDiskWrites_val_ptr ) = rowreq_ctx->data.rdbmsSrvInfoDiskWrites; + + return MFD_SUCCESS; +} /* rdbmsSrvInfoDiskWrites_get */ + +/*--------------------------------------------------------------------- + * RDBMS-MIB::rdbmsSrvInfoEntry.rdbmsSrvInfoLogicalWrites + * rdbmsSrvInfoLogicalWrites is subid 6 of rdbmsSrvInfoEntry. + * Its status is Current, and its access level is ReadOnly. + * OID: .1.3.6.1.2.1.39.1.6.1.6 + * Description: +The total number of times parts of the database files have + been marked 'dirty' and in need of writing to the disk. This + value and rdbmsSrvInfoDiskWrites give some indication of the + effect of 'write-behind' strategies in reducing the number of + disk writes compared to database operations. Because the + writes may be done by servers other than those marking the + parts of the database files dirty, these values may only be + meaningful when aggregated across all servers sharing a + common cache. Numbers are not comparable between products. + * + * Attributes: + * accessible 1 isscalar 0 enums 0 hasdefval 0 + * readable 1 iscolumn 1 ranges 0 hashint 0 + * settable 0 + * + * + * Its syntax is COUNTER (based on perltype COUNTER) + * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) + */ +/** + * map a value from its original native format to the MIB format. + * + * @retval MFD_SUCCESS : success + * @retval MFD_ERROR : Any other error + * + * @note parameters follow the memset convention (dest, src). + * + * @note generation and use of this function can be turned off by re-running + * mib2c after adding the following line to the file + * default-node-rdbmsSrvInfoLogicalWrites.m2d : + * @eval $m2c_node_skip_mapping = 1@ + * + * @remark + * If the values for your data type don't exactly match the + * possible values defined by the mib, you should map them here. + * Otherwise, just do a direct copy. + */ +int +rdbmsSrvInfoLogicalWrites_map(u_long *mib_rdbmsSrvInfoLogicalWrites_val_ptr, u_long raw_rdbmsSrvInfoLogicalWrites_val) +{ + netsnmp_assert(NULL != mib_rdbmsSrvInfoLogicalWrites_val_ptr); + + DEBUGMSGTL(("verbose:rdbmsSrvInfoTable:rdbmsSrvInfoLogicalWrites_map","called\n")); + + /* + * TODO:241:o: |-> Implement rdbmsSrvInfoLogicalWrites mapping. + * If the values for your data type don't exactly match the + * possible values defined by the mib, you should map them here. + */ + (*mib_rdbmsSrvInfoLogicalWrites_val_ptr) = raw_rdbmsSrvInfoLogicalWrites_val; + + return MFD_SUCCESS; +} /* rdbmsSrvInfoLogicalWrites_map */ + +/** + * Extract the current value of the rdbmsSrvInfoLogicalWrites data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param rdbmsSrvInfoLogicalWrites_val_ptr + * Pointer to storage for a u_long variable + * + * @retval MFD_SUCCESS : success + * @retval MFD_SKIP : skip this node (no value for now) + * @retval MFD_ERROR : Any other error + */ +int +rdbmsSrvInfoLogicalWrites_get( rdbmsSrvInfoTable_rowreq_ctx *rowreq_ctx, u_long * rdbmsSrvInfoLogicalWrites_val_ptr ) +{ + return MFD_SKIP; + /** we should have a non-NULL pointer */ + netsnmp_assert( NULL != rdbmsSrvInfoLogicalWrites_val_ptr ); + + + DEBUGMSGTL(("verbose:rdbmsSrvInfoTable:rdbmsSrvInfoLogicalWrites_get","called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + +/* + * TODO:231:o: |-> Extract the current value of the rdbmsSrvInfoLogicalWrites data. + * set (* rdbmsSrvInfoLogicalWrites_val_ptr ) from rowreq_ctx->data + */ + (* rdbmsSrvInfoLogicalWrites_val_ptr ) = rowreq_ctx->data.rdbmsSrvInfoLogicalWrites; + + return MFD_SUCCESS; +} /* rdbmsSrvInfoLogicalWrites_get */ + +/*--------------------------------------------------------------------- + * RDBMS-MIB::rdbmsSrvInfoEntry.rdbmsSrvInfoPageReads + * rdbmsSrvInfoPageReads is subid 7 of rdbmsSrvInfoEntry. + * Its status is Current, and its access level is ReadOnly. + * OID: .1.3.6.1.2.1.39.1.6.1.7 + * Description: +The total number of pages in database files read by this + server since startup. 'Pages' are product specific units of + disk i/o operations. This value, along with + rdbmsSrvInfoDiskReads, reveals the effect of any grouping + read-ahead that may be used to enhance performance of some + queries, such as scans. + * + * Attributes: + * accessible 1 isscalar 0 enums 0 hasdefval 0 + * readable 1 iscolumn 1 ranges 0 hashint 0 + * settable 0 + * + * + * Its syntax is COUNTER (based on perltype COUNTER) + * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) + */ +/** + * map a value from its original native format to the MIB format. + * + * @retval MFD_SUCCESS : success + * @retval MFD_ERROR : Any other error + * + * @note parameters follow the memset convention (dest, src). + * + * @note generation and use of this function can be turned off by re-running + * mib2c after adding the following line to the file + * default-node-rdbmsSrvInfoPageReads.m2d : + * @eval $m2c_node_skip_mapping = 1@ + * + * @remark + * If the values for your data type don't exactly match the + * possible values defined by the mib, you should map them here. + * Otherwise, just do a direct copy. + */ +int +rdbmsSrvInfoPageReads_map(u_long *mib_rdbmsSrvInfoPageReads_val_ptr, u_long raw_rdbmsSrvInfoPageReads_val) +{ + netsnmp_assert(NULL != mib_rdbmsSrvInfoPageReads_val_ptr); + + DEBUGMSGTL(("verbose:rdbmsSrvInfoTable:rdbmsSrvInfoPageReads_map","called\n")); + + /* + * TODO:241:o: |-> Implement rdbmsSrvInfoPageReads mapping. + * If the values for your data type don't exactly match the + * possible values defined by the mib, you should map them here. + */ + (*mib_rdbmsSrvInfoPageReads_val_ptr) = raw_rdbmsSrvInfoPageReads_val; + + return MFD_SUCCESS; +} /* rdbmsSrvInfoPageReads_map */ + +/** + * Extract the current value of the rdbmsSrvInfoPageReads data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param rdbmsSrvInfoPageReads_val_ptr + * Pointer to storage for a u_long variable + * + * @retval MFD_SUCCESS : success + * @retval MFD_SKIP : skip this node (no value for now) + * @retval MFD_ERROR : Any other error + */ +int +rdbmsSrvInfoPageReads_get( rdbmsSrvInfoTable_rowreq_ctx *rowreq_ctx, u_long * rdbmsSrvInfoPageReads_val_ptr ) +{ + /** we should have a non-NULL pointer */ + netsnmp_assert( NULL != rdbmsSrvInfoPageReads_val_ptr ); + + + DEBUGMSGTL(("verbose:rdbmsSrvInfoTable:rdbmsSrvInfoPageReads_get","called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + +/* + * TODO:231:o: |-> Extract the current value of the rdbmsSrvInfoPageReads data. + * set (* rdbmsSrvInfoPageReads_val_ptr ) from rowreq_ctx->data + */ + (* rdbmsSrvInfoPageReads_val_ptr ) = rowreq_ctx->data.rdbmsSrvInfoPageReads; + + return MFD_SUCCESS; +} /* rdbmsSrvInfoPageReads_get */ + +/*--------------------------------------------------------------------- + * RDBMS-MIB::rdbmsSrvInfoEntry.rdbmsSrvInfoPageWrites + * rdbmsSrvInfoPageWrites is subid 8 of rdbmsSrvInfoEntry. + * Its status is Current, and its access level is ReadOnly. + * OID: .1.3.6.1.2.1.39.1.6.1.8 + * Description: +The total number of pages in database files written by this + server since startup. Pages are product-specific units of + disk I/O. This value, with rdbmsSrvInfoDiskWrites, shows the + effect of write strategies that collapse logical writes of + contiguous pages into single calls to the operating system. + * + * Attributes: + * accessible 1 isscalar 0 enums 0 hasdefval 0 + * readable 1 iscolumn 1 ranges 0 hashint 0 + * settable 0 + * + * + * Its syntax is COUNTER (based on perltype COUNTER) + * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) + */ +/** + * map a value from its original native format to the MIB format. + * + * @retval MFD_SUCCESS : success + * @retval MFD_ERROR : Any other error + * + * @note parameters follow the memset convention (dest, src). + * + * @note generation and use of this function can be turned off by re-running + * mib2c after adding the following line to the file + * default-node-rdbmsSrvInfoPageWrites.m2d : + * @eval $m2c_node_skip_mapping = 1@ + * + * @remark + * If the values for your data type don't exactly match the + * possible values defined by the mib, you should map them here. + * Otherwise, just do a direct copy. + */ +int +rdbmsSrvInfoPageWrites_map(u_long *mib_rdbmsSrvInfoPageWrites_val_ptr, u_long raw_rdbmsSrvInfoPageWrites_val) +{ + netsnmp_assert(NULL != mib_rdbmsSrvInfoPageWrites_val_ptr); + + DEBUGMSGTL(("verbose:rdbmsSrvInfoTable:rdbmsSrvInfoPageWrites_map","called\n")); + + /* + * TODO:241:o: |-> Implement rdbmsSrvInfoPageWrites mapping. + * If the values for your data type don't exactly match the + * possible values defined by the mib, you should map them here. + */ + (*mib_rdbmsSrvInfoPageWrites_val_ptr) = raw_rdbmsSrvInfoPageWrites_val; + + return MFD_SUCCESS; +} /* rdbmsSrvInfoPageWrites_map */ + +/** + * Extract the current value of the rdbmsSrvInfoPageWrites data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param rdbmsSrvInfoPageWrites_val_ptr + * Pointer to storage for a u_long variable + * + * @retval MFD_SUCCESS : success + * @retval MFD_SKIP : skip this node (no value for now) + * @retval MFD_ERROR : Any other error + */ +int +rdbmsSrvInfoPageWrites_get( rdbmsSrvInfoTable_rowreq_ctx *rowreq_ctx, u_long * rdbmsSrvInfoPageWrites_val_ptr ) +{ + return MFD_SKIP; + /** we should have a non-NULL pointer */ + netsnmp_assert( NULL != rdbmsSrvInfoPageWrites_val_ptr ); + + + DEBUGMSGTL(("verbose:rdbmsSrvInfoTable:rdbmsSrvInfoPageWrites_get","called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + +/* + * TODO:231:o: |-> Extract the current value of the rdbmsSrvInfoPageWrites data. + * set (* rdbmsSrvInfoPageWrites_val_ptr ) from rowreq_ctx->data + */ + (* rdbmsSrvInfoPageWrites_val_ptr ) = rowreq_ctx->data.rdbmsSrvInfoPageWrites; + + return MFD_SUCCESS; +} /* rdbmsSrvInfoPageWrites_get */ + +/*--------------------------------------------------------------------- + * RDBMS-MIB::rdbmsSrvInfoEntry.rdbmsSrvInfoDiskOutOfSpaces + * rdbmsSrvInfoDiskOutOfSpaces is subid 9 of rdbmsSrvInfoEntry. + * Its status is Current, and its access level is ReadOnly. + * OID: .1.3.6.1.2.1.39.1.6.1.9 + * Description: +The total number of times the server has been unable to + obtain disk space that it wanted, since server startup. This + would be inspected by an agent on receipt of an + rdbmsOutOfSpace trap. + * + * Attributes: + * accessible 1 isscalar 0 enums 0 hasdefval 0 + * readable 1 iscolumn 1 ranges 0 hashint 0 + * settable 0 + * + * + * Its syntax is COUNTER (based on perltype COUNTER) + * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) + */ +/** + * map a value from its original native format to the MIB format. + * + * @retval MFD_SUCCESS : success + * @retval MFD_ERROR : Any other error + * + * @note parameters follow the memset convention (dest, src). + * + * @note generation and use of this function can be turned off by re-running + * mib2c after adding the following line to the file + * default-node-rdbmsSrvInfoDiskOutOfSpaces.m2d : + * @eval $m2c_node_skip_mapping = 1@ + * + * @remark + * If the values for your data type don't exactly match the + * possible values defined by the mib, you should map them here. + * Otherwise, just do a direct copy. + */ +int +rdbmsSrvInfoDiskOutOfSpaces_map(u_long *mib_rdbmsSrvInfoDiskOutOfSpaces_val_ptr, u_long raw_rdbmsSrvInfoDiskOutOfSpaces_val) +{ + netsnmp_assert(NULL != mib_rdbmsSrvInfoDiskOutOfSpaces_val_ptr); + + DEBUGMSGTL(("verbose:rdbmsSrvInfoTable:rdbmsSrvInfoDiskOutOfSpaces_map","called\n")); + + /* + * TODO:241:o: |-> Implement rdbmsSrvInfoDiskOutOfSpaces mapping. + * If the values for your data type don't exactly match the + * possible values defined by the mib, you should map them here. + */ + (*mib_rdbmsSrvInfoDiskOutOfSpaces_val_ptr) = raw_rdbmsSrvInfoDiskOutOfSpaces_val; + + return MFD_SUCCESS; +} /* rdbmsSrvInfoDiskOutOfSpaces_map */ + +/** + * Extract the current value of the rdbmsSrvInfoDiskOutOfSpaces data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param rdbmsSrvInfoDiskOutOfSpaces_val_ptr + * Pointer to storage for a u_long variable + * + * @retval MFD_SUCCESS : success + * @retval MFD_SKIP : skip this node (no value for now) + * @retval MFD_ERROR : Any other error + */ +int +rdbmsSrvInfoDiskOutOfSpaces_get( rdbmsSrvInfoTable_rowreq_ctx *rowreq_ctx, u_long * rdbmsSrvInfoDiskOutOfSpaces_val_ptr ) +{ + /** we should have a non-NULL pointer */ + netsnmp_assert( NULL != rdbmsSrvInfoDiskOutOfSpaces_val_ptr ); + + + DEBUGMSGTL(("verbose:rdbmsSrvInfoTable:rdbmsSrvInfoDiskOutOfSpaces_get","called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + +/* + * TODO:231:o: |-> Extract the current value of the rdbmsSrvInfoDiskOutOfSpaces data. + * set (* rdbmsSrvInfoDiskOutOfSpaces_val_ptr ) from rowreq_ctx->data + */ + (* rdbmsSrvInfoDiskOutOfSpaces_val_ptr ) = rowreq_ctx->data.rdbmsSrvInfoDiskOutOfSpaces; + + return MFD_SUCCESS; +} /* rdbmsSrvInfoDiskOutOfSpaces_get */ + +/*--------------------------------------------------------------------- + * RDBMS-MIB::rdbmsSrvInfoEntry.rdbmsSrvInfoHandledRequests + * rdbmsSrvInfoHandledRequests is subid 10 of rdbmsSrvInfoEntry. + * Its status is Current, and its access level is ReadOnly. + * OID: .1.3.6.1.2.1.39.1.6.1.10 + * Description: +The total number of requests made to the server on inbound + associations. The meaning of 'requests' is product specific, + and is not comparable between products. + + This is intended to encapsulate high level semantic + operations between clients and servers, or between peers. + For instance, one request might correspond to a 'select' or + an 'insert' statement. It is not intended to capture disk + i/o described in rdbmsSrvInfoDiskReads and + rdbmsSrvInfoDiskWrites. + * + * Attributes: + * accessible 1 isscalar 0 enums 0 hasdefval 0 + * readable 1 iscolumn 1 ranges 0 hashint 0 + * settable 0 + * + * + * Its syntax is COUNTER (based on perltype COUNTER) + * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) + */ +/** + * map a value from its original native format to the MIB format. + * + * @retval MFD_SUCCESS : success + * @retval MFD_ERROR : Any other error + * + * @note parameters follow the memset convention (dest, src). + * + * @note generation and use of this function can be turned off by re-running + * mib2c after adding the following line to the file + * default-node-rdbmsSrvInfoHandledRequests.m2d : + * @eval $m2c_node_skip_mapping = 1@ + * + * @remark + * If the values for your data type don't exactly match the + * possible values defined by the mib, you should map them here. + * Otherwise, just do a direct copy. + */ +int +rdbmsSrvInfoHandledRequests_map(u_long *mib_rdbmsSrvInfoHandledRequests_val_ptr, u_long raw_rdbmsSrvInfoHandledRequests_val) +{ + netsnmp_assert(NULL != mib_rdbmsSrvInfoHandledRequests_val_ptr); + + DEBUGMSGTL(("verbose:rdbmsSrvInfoTable:rdbmsSrvInfoHandledRequests_map","called\n")); + + /* + * TODO:241:o: |-> Implement rdbmsSrvInfoHandledRequests mapping. + * If the values for your data type don't exactly match the + * possible values defined by the mib, you should map them here. + */ + (*mib_rdbmsSrvInfoHandledRequests_val_ptr) = raw_rdbmsSrvInfoHandledRequests_val; + + return MFD_SUCCESS; +} /* rdbmsSrvInfoHandledRequests_map */ + +/** + * Extract the current value of the rdbmsSrvInfoHandledRequests data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param rdbmsSrvInfoHandledRequests_val_ptr + * Pointer to storage for a u_long variable + * + * @retval MFD_SUCCESS : success + * @retval MFD_SKIP : skip this node (no value for now) + * @retval MFD_ERROR : Any other error + */ +int +rdbmsSrvInfoHandledRequests_get( rdbmsSrvInfoTable_rowreq_ctx *rowreq_ctx, u_long * rdbmsSrvInfoHandledRequests_val_ptr ) +{ + /** we should have a non-NULL pointer */ + netsnmp_assert( NULL != rdbmsSrvInfoHandledRequests_val_ptr ); + + + DEBUGMSGTL(("verbose:rdbmsSrvInfoTable:rdbmsSrvInfoHandledRequests_get","called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + +/* + * TODO:231:o: |-> Extract the current value of the rdbmsSrvInfoHandledRequests data. + * set (* rdbmsSrvInfoHandledRequests_val_ptr ) from rowreq_ctx->data + */ + (* rdbmsSrvInfoHandledRequests_val_ptr ) = rowreq_ctx->data.rdbmsSrvInfoHandledRequests; + + return MFD_SUCCESS; +} /* rdbmsSrvInfoHandledRequests_get */ + +/*--------------------------------------------------------------------- + * RDBMS-MIB::rdbmsSrvInfoEntry.rdbmsSrvInfoRequestRecvs + * rdbmsSrvInfoRequestRecvs is subid 11 of rdbmsSrvInfoEntry. + * Its status is Current, and its access level is ReadOnly. + * OID: .1.3.6.1.2.1.39.1.6.1.11 + * Description: +The number of receive operations made processing any requests + on inbound associations. The meaning of operations is product + specific, and is not comparable between products. + + This is intended to capture lower-level i/o operations than + shown by HandledRequests, between clients and servers, or + between peers. For instance, it might roughly correspond to + the amount of data given with an 'insert' statement. It is + not intended to capture disk i/o described in + rdbmsSrvInfoDiskReads and rdbmsSrvInfoDiskWrites. + * + * Attributes: + * accessible 1 isscalar 0 enums 0 hasdefval 0 + * readable 1 iscolumn 1 ranges 0 hashint 0 + * settable 0 + * + * + * Its syntax is COUNTER (based on perltype COUNTER) + * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) + */ +/** + * map a value from its original native format to the MIB format. + * + * @retval MFD_SUCCESS : success + * @retval MFD_ERROR : Any other error + * + * @note parameters follow the memset convention (dest, src). + * + * @note generation and use of this function can be turned off by re-running + * mib2c after adding the following line to the file + * default-node-rdbmsSrvInfoRequestRecvs.m2d : + * @eval $m2c_node_skip_mapping = 1@ + * + * @remark + * If the values for your data type don't exactly match the + * possible values defined by the mib, you should map them here. + * Otherwise, just do a direct copy. + */ +int +rdbmsSrvInfoRequestRecvs_map(u_long *mib_rdbmsSrvInfoRequestRecvs_val_ptr, u_long raw_rdbmsSrvInfoRequestRecvs_val) +{ + netsnmp_assert(NULL != mib_rdbmsSrvInfoRequestRecvs_val_ptr); + + DEBUGMSGTL(("verbose:rdbmsSrvInfoTable:rdbmsSrvInfoRequestRecvs_map","called\n")); + + /* + * TODO:241:o: |-> Implement rdbmsSrvInfoRequestRecvs mapping. + * If the values for your data type don't exactly match the + * possible values defined by the mib, you should map them here. + */ + (*mib_rdbmsSrvInfoRequestRecvs_val_ptr) = raw_rdbmsSrvInfoRequestRecvs_val; + + return MFD_SUCCESS; +} /* rdbmsSrvInfoRequestRecvs_map */ + +/** + * Extract the current value of the rdbmsSrvInfoRequestRecvs data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param rdbmsSrvInfoRequestRecvs_val_ptr + * Pointer to storage for a u_long variable + * + * @retval MFD_SUCCESS : success + * @retval MFD_SKIP : skip this node (no value for now) + * @retval MFD_ERROR : Any other error + */ +int +rdbmsSrvInfoRequestRecvs_get( rdbmsSrvInfoTable_rowreq_ctx *rowreq_ctx, u_long * rdbmsSrvInfoRequestRecvs_val_ptr ) +{ + /** we should have a non-NULL pointer */ + netsnmp_assert( NULL != rdbmsSrvInfoRequestRecvs_val_ptr ); + + + DEBUGMSGTL(("verbose:rdbmsSrvInfoTable:rdbmsSrvInfoRequestRecvs_get","called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + +/* + * TODO:231:o: |-> Extract the current value of the rdbmsSrvInfoRequestRecvs data. + * set (* rdbmsSrvInfoRequestRecvs_val_ptr ) from rowreq_ctx->data + */ + (* rdbmsSrvInfoRequestRecvs_val_ptr ) = rowreq_ctx->data.rdbmsSrvInfoRequestRecvs; + + return MFD_SUCCESS; +} /* rdbmsSrvInfoRequestRecvs_get */ + +/*--------------------------------------------------------------------- + * RDBMS-MIB::rdbmsSrvInfoEntry.rdbmsSrvInfoRequestSends + * rdbmsSrvInfoRequestSends is subid 12 of rdbmsSrvInfoEntry. + * Its status is Current, and its access level is ReadOnly. + * OID: .1.3.6.1.2.1.39.1.6.1.12 + * Description: +The number of send operations made processing requests + handled on inbound associations. The meaning of operations + is product specific, and is not comparable between products. + + This is intended to capture lower-level i/o operations than + shown by HandledRequests, between between clients and + servers, or between peers. It might roughly correspond to + the number of rows returned by a 'select' statement. It is + not intended to capture disk i/o described in DiskReads. + * + * Attributes: + * accessible 1 isscalar 0 enums 0 hasdefval 0 + * readable 1 iscolumn 1 ranges 0 hashint 0 + * settable 0 + * + * + * Its syntax is COUNTER (based on perltype COUNTER) + * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) + */ +/** + * map a value from its original native format to the MIB format. + * + * @retval MFD_SUCCESS : success + * @retval MFD_ERROR : Any other error + * + * @note parameters follow the memset convention (dest, src). + * + * @note generation and use of this function can be turned off by re-running + * mib2c after adding the following line to the file + * default-node-rdbmsSrvInfoRequestSends.m2d : + * @eval $m2c_node_skip_mapping = 1@ + * + * @remark + * If the values for your data type don't exactly match the + * possible values defined by the mib, you should map them here. + * Otherwise, just do a direct copy. + */ +int +rdbmsSrvInfoRequestSends_map(u_long *mib_rdbmsSrvInfoRequestSends_val_ptr, u_long raw_rdbmsSrvInfoRequestSends_val) +{ + netsnmp_assert(NULL != mib_rdbmsSrvInfoRequestSends_val_ptr); + + DEBUGMSGTL(("verbose:rdbmsSrvInfoTable:rdbmsSrvInfoRequestSends_map","called\n")); + + /* + * TODO:241:o: |-> Implement rdbmsSrvInfoRequestSends mapping. + * If the values for your data type don't exactly match the + * possible values defined by the mib, you should map them here. + */ + (*mib_rdbmsSrvInfoRequestSends_val_ptr) = raw_rdbmsSrvInfoRequestSends_val; + + return MFD_SUCCESS; +} /* rdbmsSrvInfoRequestSends_map */ + +/** + * Extract the current value of the rdbmsSrvInfoRequestSends data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param rdbmsSrvInfoRequestSends_val_ptr + * Pointer to storage for a u_long variable + * + * @retval MFD_SUCCESS : success + * @retval MFD_SKIP : skip this node (no value for now) + * @retval MFD_ERROR : Any other error + */ +int +rdbmsSrvInfoRequestSends_get( rdbmsSrvInfoTable_rowreq_ctx *rowreq_ctx, u_long * rdbmsSrvInfoRequestSends_val_ptr ) +{ + /** we should have a non-NULL pointer */ + netsnmp_assert( NULL != rdbmsSrvInfoRequestSends_val_ptr ); + + + DEBUGMSGTL(("verbose:rdbmsSrvInfoTable:rdbmsSrvInfoRequestSends_get","called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + +/* + * TODO:231:o: |-> Extract the current value of the rdbmsSrvInfoRequestSends data. + * set (* rdbmsSrvInfoRequestSends_val_ptr ) from rowreq_ctx->data + */ + (* rdbmsSrvInfoRequestSends_val_ptr ) = rowreq_ctx->data.rdbmsSrvInfoRequestSends; + + return MFD_SUCCESS; +} /* rdbmsSrvInfoRequestSends_get */ + +/*--------------------------------------------------------------------- + * RDBMS-MIB::rdbmsSrvInfoEntry.rdbmsSrvInfoHighwaterInboundAssociations + * rdbmsSrvInfoHighwaterInboundAssociations is subid 13 of rdbmsSrvInfoEntry. + * Its status is Current, and its access level is ReadOnly. + * OID: .1.3.6.1.2.1.39.1.6.1.13 + * Description: +The greatest number of inbound associations that have been + simultaneously open to this server since startup. + * + * Attributes: + * accessible 1 isscalar 0 enums 0 hasdefval 0 + * readable 1 iscolumn 1 ranges 0 hashint 0 + * settable 0 + * + * + * Its syntax is GAUGE (based on perltype GAUGE) + * The net-snmp type is ASN_GAUGE. The C type decl is u_long (u_long) + */ +/** + * map a value from its original native format to the MIB format. + * + * @retval MFD_SUCCESS : success + * @retval MFD_ERROR : Any other error + * + * @note parameters follow the memset convention (dest, src). + * + * @note generation and use of this function can be turned off by re-running + * mib2c after adding the following line to the file + * default-node-rdbmsSrvInfoHighwaterInboundAssociations.m2d : + * @eval $m2c_node_skip_mapping = 1@ + * + * @remark + * If the values for your data type don't exactly match the + * possible values defined by the mib, you should map them here. + * Otherwise, just do a direct copy. + */ +int +rdbmsSrvInfoHighwaterInboundAssociations_map(u_long *mib_rdbmsSrvInfoHighwaterInboundAssociations_val_ptr, u_long raw_rdbmsSrvInfoHighwaterInboundAssociations_val) +{ + netsnmp_assert(NULL != mib_rdbmsSrvInfoHighwaterInboundAssociations_val_ptr); + + DEBUGMSGTL(("verbose:rdbmsSrvInfoTable:rdbmsSrvInfoHighwaterInboundAssociations_map","called\n")); + + /* + * TODO:241:o: |-> Implement rdbmsSrvInfoHighwaterInboundAssociations mapping. + * If the values for your data type don't exactly match the + * possible values defined by the mib, you should map them here. + */ + (*mib_rdbmsSrvInfoHighwaterInboundAssociations_val_ptr) = raw_rdbmsSrvInfoHighwaterInboundAssociations_val; + + return MFD_SUCCESS; +} /* rdbmsSrvInfoHighwaterInboundAssociations_map */ + +/** + * Extract the current value of the rdbmsSrvInfoHighwaterInboundAssociations data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param rdbmsSrvInfoHighwaterInboundAssociations_val_ptr + * Pointer to storage for a u_long variable + * + * @retval MFD_SUCCESS : success + * @retval MFD_SKIP : skip this node (no value for now) + * @retval MFD_ERROR : Any other error + */ +int +rdbmsSrvInfoHighwaterInboundAssociations_get( rdbmsSrvInfoTable_rowreq_ctx *rowreq_ctx, u_long * rdbmsSrvInfoHighwaterInboundAssociations_val_ptr ) +{ + /** we should have a non-NULL pointer */ + netsnmp_assert( NULL != rdbmsSrvInfoHighwaterInboundAssociations_val_ptr ); + + + DEBUGMSGTL(("verbose:rdbmsSrvInfoTable:rdbmsSrvInfoHighwaterInboundAssociations_get","called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + +/* + * TODO:231:o: |-> Extract the current value of the rdbmsSrvInfoHighwaterInboundAssociations data. + * set (* rdbmsSrvInfoHighwaterInboundAssociations_val_ptr ) from rowreq_ctx->data + */ + (* rdbmsSrvInfoHighwaterInboundAssociations_val_ptr ) = rowreq_ctx->data.rdbmsSrvInfoHighwaterInboundAssociations; + + return MFD_SUCCESS; +} /* rdbmsSrvInfoHighwaterInboundAssociations_get */ + +/*--------------------------------------------------------------------- + * RDBMS-MIB::rdbmsSrvInfoEntry.rdbmsSrvInfoMaxInboundAssociations + * rdbmsSrvInfoMaxInboundAssociations is subid 14 of rdbmsSrvInfoEntry. + * Its status is Current, and its access level is ReadWrite. + * OID: .1.3.6.1.2.1.39.1.6.1.14 + * Description: +The greatest number of inbound associations that can be + simultaneously open with this server. If there is no limit, + then the value should be zero. + + Note that a compliant agent does not need to + allow write access to this object. + * + * Attributes: + * accessible 1 isscalar 0 enums 0 hasdefval 0 + * readable 1 iscolumn 1 ranges 0 hashint 0 + * settable 1 + * + * + * Its syntax is GAUGE (based on perltype GAUGE) + * The net-snmp type is ASN_GAUGE. The C type decl is u_long (u_long) + */ +/** + * map a value from its original native format to the MIB format. + * + * @retval MFD_SUCCESS : success + * @retval MFD_ERROR : Any other error + * + * @note parameters follow the memset convention (dest, src). + * + * @note generation and use of this function can be turned off by re-running + * mib2c after adding the following line to the file + * default-node-rdbmsSrvInfoMaxInboundAssociations.m2d : + * @eval $m2c_node_skip_mapping = 1@ + * + * @remark + * If the values for your data type don't exactly match the + * possible values defined by the mib, you should map them here. + * Otherwise, just do a direct copy. + */ +int +rdbmsSrvInfoMaxInboundAssociations_map(u_long *mib_rdbmsSrvInfoMaxInboundAssociations_val_ptr, u_long raw_rdbmsSrvInfoMaxInboundAssociations_val) +{ + netsnmp_assert(NULL != mib_rdbmsSrvInfoMaxInboundAssociations_val_ptr); + + DEBUGMSGTL(("verbose:rdbmsSrvInfoTable:rdbmsSrvInfoMaxInboundAssociations_map","called\n")); + + /* + * TODO:241:o: |-> Implement rdbmsSrvInfoMaxInboundAssociations mapping. + * If the values for your data type don't exactly match the + * possible values defined by the mib, you should map them here. + */ + (*mib_rdbmsSrvInfoMaxInboundAssociations_val_ptr) = raw_rdbmsSrvInfoMaxInboundAssociations_val; + + return MFD_SUCCESS; +} /* rdbmsSrvInfoMaxInboundAssociations_map */ + +/** + * Extract the current value of the rdbmsSrvInfoMaxInboundAssociations data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param rdbmsSrvInfoMaxInboundAssociations_val_ptr + * Pointer to storage for a u_long variable + * + * @retval MFD_SUCCESS : success + * @retval MFD_SKIP : skip this node (no value for now) + * @retval MFD_ERROR : Any other error + */ +int +rdbmsSrvInfoMaxInboundAssociations_get( rdbmsSrvInfoTable_rowreq_ctx *rowreq_ctx, u_long * rdbmsSrvInfoMaxInboundAssociations_val_ptr ) +{ + /** we should have a non-NULL pointer */ + netsnmp_assert( NULL != rdbmsSrvInfoMaxInboundAssociations_val_ptr ); + + + DEBUGMSGTL(("verbose:rdbmsSrvInfoTable:rdbmsSrvInfoMaxInboundAssociations_get","called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + +/* + * TODO:231:o: |-> Extract the current value of the rdbmsSrvInfoMaxInboundAssociations data. + * set (* rdbmsSrvInfoMaxInboundAssociations_val_ptr ) from rowreq_ctx->data + */ + (* rdbmsSrvInfoMaxInboundAssociations_val_ptr ) = rowreq_ctx->data.rdbmsSrvInfoMaxInboundAssociations; + + return MFD_SUCCESS; +} /* rdbmsSrvInfoMaxInboundAssociations_get */ + + + +/** @} */ diff --git a/RDBMS-MIB_src/rdbmsSrvInfoTable/rdbmsSrvInfoTable_data_get.h b/RDBMS-MIB_src/rdbmsSrvInfoTable/rdbmsSrvInfoTable_data_get.h new file mode 100644 index 0000000..68b5b5e --- /dev/null +++ b/RDBMS-MIB_src/rdbmsSrvInfoTable/rdbmsSrvInfoTable_data_get.h @@ -0,0 +1,86 @@ +/*------------------------------------------------------------------------- + * rdbmsSrvInfoTable_data_get.h + * + * RDBMSMIB mib module. + * + * Copyright (c) 2004-2007, PostgreSQL Global Development Group + * Author: Joshua Tolley + * + * $Id: rdbmsSrvInfoTable_data_get.h,v 1.2 2007/09/13 14:20:44 h-saito Exp $ + * + *------------------------------------------------------------------------- + */ + +#ifndef RDBMSSRVINFOTABLE_DATA_GET_H +#define RDBMSSRVINFOTABLE_DATA_GET_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* ********************************************************************* + * GET function declarations + */ + +/* ********************************************************************* + * GET Table declarations + */ +/********************************************************************** + ********************************************************************** + *** + *** Table rdbmsSrvInfoTable + *** + ********************************************************************** + **********************************************************************/ +/* + * rdbmsSrvInfoTable is subid 6 of rdbmsObjects. + * Its status is Current. + * OID: .1.3.6.1.2.1.39.1.6, length: 9 +*/ + /* + * indexes + */ + int applIndex_map(long *mib_applIndex_val_ptr, long raw_applIndex_val); + + int rdbmsSrvInfoStartupTime_map(char **mib_rdbmsSrvInfoStartupTime_val_ptr_ptr, size_t *mib_rdbmsSrvInfoStartupTime_val_ptr_len_ptr, char *raw_rdbmsSrvInfoStartupTime_val_ptr, size_t raw_rdbmsSrvInfoStartupTime_val_ptr_len, int allow_realloc); + int rdbmsSrvInfoStartupTime_get( rdbmsSrvInfoTable_rowreq_ctx *rowreq_ctx, char **rdbmsSrvInfoStartupTime_val_ptr_ptr, size_t *rdbmsSrvInfoStartupTime_val_ptr_len_ptr ); + int rdbmsSrvInfoFinishedTransactions_map(u_long *mib_rdbmsSrvInfoFinishedTransactions_val_ptr, u_long raw_rdbmsSrvInfoFinishedTransactions_val); + int rdbmsSrvInfoFinishedTransactions_get( rdbmsSrvInfoTable_rowreq_ctx *rowreq_ctx, u_long * rdbmsSrvInfoFinishedTransactions_val_ptr ); + int rdbmsSrvInfoDiskReads_map(u_long *mib_rdbmsSrvInfoDiskReads_val_ptr, u_long raw_rdbmsSrvInfoDiskReads_val); + int rdbmsSrvInfoDiskReads_get( rdbmsSrvInfoTable_rowreq_ctx *rowreq_ctx, u_long * rdbmsSrvInfoDiskReads_val_ptr ); + int rdbmsSrvInfoLogicalReads_map(u_long *mib_rdbmsSrvInfoLogicalReads_val_ptr, u_long raw_rdbmsSrvInfoLogicalReads_val); + int rdbmsSrvInfoLogicalReads_get( rdbmsSrvInfoTable_rowreq_ctx *rowreq_ctx, u_long * rdbmsSrvInfoLogicalReads_val_ptr ); + int rdbmsSrvInfoDiskWrites_map(u_long *mib_rdbmsSrvInfoDiskWrites_val_ptr, u_long raw_rdbmsSrvInfoDiskWrites_val); + int rdbmsSrvInfoDiskWrites_get( rdbmsSrvInfoTable_rowreq_ctx *rowreq_ctx, u_long * rdbmsSrvInfoDiskWrites_val_ptr ); + int rdbmsSrvInfoLogicalWrites_map(u_long *mib_rdbmsSrvInfoLogicalWrites_val_ptr, u_long raw_rdbmsSrvInfoLogicalWrites_val); + int rdbmsSrvInfoLogicalWrites_get( rdbmsSrvInfoTable_rowreq_ctx *rowreq_ctx, u_long * rdbmsSrvInfoLogicalWrites_val_ptr ); + int rdbmsSrvInfoPageReads_map(u_long *mib_rdbmsSrvInfoPageReads_val_ptr, u_long raw_rdbmsSrvInfoPageReads_val); + int rdbmsSrvInfoPageReads_get( rdbmsSrvInfoTable_rowreq_ctx *rowreq_ctx, u_long * rdbmsSrvInfoPageReads_val_ptr ); + int rdbmsSrvInfoPageWrites_map(u_long *mib_rdbmsSrvInfoPageWrites_val_ptr, u_long raw_rdbmsSrvInfoPageWrites_val); + int rdbmsSrvInfoPageWrites_get( rdbmsSrvInfoTable_rowreq_ctx *rowreq_ctx, u_long * rdbmsSrvInfoPageWrites_val_ptr ); + int rdbmsSrvInfoDiskOutOfSpaces_map(u_long *mib_rdbmsSrvInfoDiskOutOfSpaces_val_ptr, u_long raw_rdbmsSrvInfoDiskOutOfSpaces_val); + int rdbmsSrvInfoDiskOutOfSpaces_get( rdbmsSrvInfoTable_rowreq_ctx *rowreq_ctx, u_long * rdbmsSrvInfoDiskOutOfSpaces_val_ptr ); + int rdbmsSrvInfoHandledRequests_map(u_long *mib_rdbmsSrvInfoHandledRequests_val_ptr, u_long raw_rdbmsSrvInfoHandledRequests_val); + int rdbmsSrvInfoHandledRequests_get( rdbmsSrvInfoTable_rowreq_ctx *rowreq_ctx, u_long * rdbmsSrvInfoHandledRequests_val_ptr ); + int rdbmsSrvInfoRequestRecvs_map(u_long *mib_rdbmsSrvInfoRequestRecvs_val_ptr, u_long raw_rdbmsSrvInfoRequestRecvs_val); + int rdbmsSrvInfoRequestRecvs_get( rdbmsSrvInfoTable_rowreq_ctx *rowreq_ctx, u_long * rdbmsSrvInfoRequestRecvs_val_ptr ); + int rdbmsSrvInfoRequestSends_map(u_long *mib_rdbmsSrvInfoRequestSends_val_ptr, u_long raw_rdbmsSrvInfoRequestSends_val); + int rdbmsSrvInfoRequestSends_get( rdbmsSrvInfoTable_rowreq_ctx *rowreq_ctx, u_long * rdbmsSrvInfoRequestSends_val_ptr ); + int rdbmsSrvInfoHighwaterInboundAssociations_map(u_long *mib_rdbmsSrvInfoHighwaterInboundAssociations_val_ptr, u_long raw_rdbmsSrvInfoHighwaterInboundAssociations_val); + int rdbmsSrvInfoHighwaterInboundAssociations_get( rdbmsSrvInfoTable_rowreq_ctx *rowreq_ctx, u_long * rdbmsSrvInfoHighwaterInboundAssociations_val_ptr ); + int rdbmsSrvInfoMaxInboundAssociations_map(u_long *mib_rdbmsSrvInfoMaxInboundAssociations_val_ptr, u_long raw_rdbmsSrvInfoMaxInboundAssociations_val); + int rdbmsSrvInfoMaxInboundAssociations_get( rdbmsSrvInfoTable_rowreq_ctx *rowreq_ctx, u_long * rdbmsSrvInfoMaxInboundAssociations_val_ptr ); + + +int rdbmsSrvInfoTable_indexes_set_tbl_idx(rdbmsSrvInfoTable_mib_index *tbl_idx, long applIndex_val); +int rdbmsSrvInfoTable_indexes_set(rdbmsSrvInfoTable_rowreq_ctx *rowreq_ctx, long applIndex_val); + + + + +#ifdef __cplusplus +} +#endif + +#endif /* RDBMSSRVINFOTABLE_DATA_GET_H */ +/** @} */ diff --git a/RDBMS-MIB_src/rdbmsSrvInfoTable/rdbmsSrvInfoTable_data_set.c b/RDBMS-MIB_src/rdbmsSrvInfoTable/rdbmsSrvInfoTable_data_set.c new file mode 100644 index 0000000..8422736 --- /dev/null +++ b/RDBMS-MIB_src/rdbmsSrvInfoTable/rdbmsSrvInfoTable_data_set.c @@ -0,0 +1,30 @@ +/*------------------------------------------------------------------------- + * rdbmsSrvInfoTable_data_set.c + * + * RDBMSMIB mib module. + * + * Copyright (c) 2004-2007, PostgreSQL Global Development Group + * Author: Joshua Tolley + * + * $Id: rdbmsSrvInfoTable_data_set.c,v 1.2 2007/09/13 14:20:44 h-saito Exp $ + * + *------------------------------------------------------------------------- + */ + +/* standard Net-SNMP includes */ +#include <net-snmp/net-snmp-config.h> +#include <net-snmp/net-snmp-includes.h> +#include <net-snmp/agent/net-snmp-agent-includes.h> + +/* include our parent header */ +#include "rdbmsSrvInfoTable.h" + + +/** @defgroup data_set data_set: Routines to set data + * + * These routines are used to set the value for individual objects. The + * row context is passed, along with the new value. + * + * @{ + */ +/** @} */ diff --git a/RDBMS-MIB_src/rdbmsSrvInfoTable/rdbmsSrvInfoTable_data_set.h b/RDBMS-MIB_src/rdbmsSrvInfoTable/rdbmsSrvInfoTable_data_set.h new file mode 100644 index 0000000..1383e6e --- /dev/null +++ b/RDBMS-MIB_src/rdbmsSrvInfoTable/rdbmsSrvInfoTable_data_set.h @@ -0,0 +1,34 @@ +/*------------------------------------------------------------------------- + * rdbmsSrvInfoTable_data_set.h + * + * RDBMSMIB mib module. + * + * Copyright (c) 2004-2007, PostgreSQL Global Development Group + * Author: Joshua Tolley + * + * $Id: rdbmsSrvInfoTable_data_set.h,v 1.2 2007/09/13 14:20:44 h-saito Exp $ + * + *------------------------------------------------------------------------- + */ + +#ifndef RDBMSSRVINFOTABLE_DATA_SET_H +#define RDBMSSRVINFOTABLE_DATA_SET_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* ********************************************************************* + * SET function declarations + */ + +/* ********************************************************************* + * SET Table declarations + */ + + +#ifdef __cplusplus +} +#endif + +#endif /* RDBMSSRVINFOTABLE_DATA_SET_H */ diff --git a/RDBMS-MIB_src/rdbmsSrvInfoTable/rdbmsSrvInfoTable_enums.h b/RDBMS-MIB_src/rdbmsSrvInfoTable/rdbmsSrvInfoTable_enums.h new file mode 100644 index 0000000..16b2302 --- /dev/null +++ b/RDBMS-MIB_src/rdbmsSrvInfoTable/rdbmsSrvInfoTable_enums.h @@ -0,0 +1,47 @@ +/*------------------------------------------------------------------------- + * rdbmsSrvInfoTable_enums.h + * + * RDBMSMIB mib module. + * + * Copyright (c) 2004-2007, PostgreSQL Global Development Group + * Author: Joshua Tolley + * + * $Id: rdbmsSrvInfoTable_enums.h,v 1.2 2007/09/13 14:20:44 h-saito Exp $ + * + *------------------------------------------------------------------------- + */ + +#ifndef RDBMSSRVINFOTABLE_ENUMS_H +#define RDBMSSRVINFOTABLE_ENUMS_H + +#ifdef __cplusplus +extern "C" { +#endif + + /* + * NOTES on enums + * ============== + * + * Value Mapping + * ------------- + * If the values for your data type don't exactly match the + * possible values defined by the mib, you should map them + * below. For example, a boolean flag (1/0) is usually represented + * as a TruthValue in a MIB, which maps to the values (1/2). + * + */ +/************************************************************************* + ************************************************************************* + * + * enum definitions for table rdbmsSrvInfoTable + * + ************************************************************************* + *************************************************************************/ + + + +#ifdef __cplusplus +} +#endif + +#endif /* RDBMSSRVINFOTABLE_ENUMS_H */ diff --git a/RDBMS-MIB_src/rdbmsSrvInfoTable/rdbmsSrvInfoTable_interface.c b/RDBMS-MIB_src/rdbmsSrvInfoTable/rdbmsSrvInfoTable_interface.c new file mode 100644 index 0000000..3ed81dc --- /dev/null +++ b/RDBMS-MIB_src/rdbmsSrvInfoTable/rdbmsSrvInfoTable_interface.c @@ -0,0 +1,777 @@ +/*------------------------------------------------------------------------- + * rdbmsSrvInfoTable_interface.c + * + * RDBMSMIB mib module. + * + * Copyright (c) 2004-2007, PostgreSQL Global Development Group + * Author: Joshua Tolley + * + * $Id: rdbmsSrvInfoTable_interface.c,v 1.2 2007/09/13 14:20:44 h-saito Exp $ + * + *------------------------------------------------------------------------- + */ + +#include "pgsnmpd.h" +/* include our parent header */ +#include "rdbmsSrvInfoTable.h" + + +#include <net-snmp/library/container.h> + +#include "rdbmsSrvInfoTable_interface.h" + +/********************************************************************** + ********************************************************************** + *** + *** Table rdbmsSrvInfoTable + *** + ********************************************************************** + **********************************************************************/ +/* + * rdbmsSrvInfoTable is subid 6 of rdbmsObjects. + * Its status is Current. + * OID: .1.3.6.1.2.1.39.1.6, length: 9 +*/ +typedef struct rdbmsSrvInfoTable_interface_ctx_s { + + netsnmp_container *container; + netsnmp_cache *cache; /* optional cache */ + + rdbmsSrvInfoTable_registration_ptr user_ctx; + + netsnmp_table_registration_info tbl_info; + + netsnmp_baby_steps_access_methods access_multiplexer; + +} rdbmsSrvInfoTable_interface_ctx; + +static rdbmsSrvInfoTable_interface_ctx rdbmsSrvInfoTable_if_ctx; + +static void _rdbmsSrvInfoTable_container_init( + rdbmsSrvInfoTable_interface_ctx *if_ctx); + + +static Netsnmp_Node_Handler _mfd_rdbmsSrvInfoTable_pre_request; +static Netsnmp_Node_Handler _mfd_rdbmsSrvInfoTable_post_request; +static Netsnmp_Node_Handler _mfd_rdbmsSrvInfoTable_object_lookup; +static Netsnmp_Node_Handler _mfd_rdbmsSrvInfoTable_get_values; +/** + * @internal + * Initialize the table rdbmsSrvInfoTable + * (Define its contents and how it's structured) + */ +void +_rdbmsSrvInfoTable_initialize_interface(rdbmsSrvInfoTable_registration_ptr reg_ptr, u_long flags) +{ + netsnmp_baby_steps_access_methods *access_multiplexer = + &rdbmsSrvInfoTable_if_ctx.access_multiplexer; + netsnmp_table_registration_info *tbl_info = &rdbmsSrvInfoTable_if_ctx.tbl_info; + netsnmp_handler_registration *reginfo; + netsnmp_mib_handler *handler; + int mfd_modes = 0; + + DEBUGMSGTL(("internal:rdbmsSrvInfoTable:_rdbmsSrvInfoTable_initialize_interface","called\n")); + + + /************************************************* + * + * save interface context for rdbmsSrvInfoTable + */ + /* + * Setting up the table's definition + */ + netsnmp_table_helper_add_indexes(tbl_info, + ASN_INTEGER, /** index: applIndex */ + 0); + + /* Define the minimum and maximum accessible columns. This + optimizes retrival. */ + tbl_info->min_column = RDBMSSRVINFOTABLE_MIN_COL; + tbl_info->max_column = RDBMSSRVINFOTABLE_MAX_COL; + + /* + * save users context + */ + rdbmsSrvInfoTable_if_ctx.user_ctx = reg_ptr; + + /* + * call data access initialization code + */ + rdbmsSrvInfoTable_init_data(reg_ptr); + + /* + * set up the container + */ + _rdbmsSrvInfoTable_container_init(&rdbmsSrvInfoTable_if_ctx); + if (NULL == rdbmsSrvInfoTable_if_ctx.container) { + snmp_log(LOG_ERR,"could not initialize container for rdbmsSrvInfoTable\n"); + return; + } + + /* + * access_multiplexer: REQUIRED wrapper for get request handling + */ + access_multiplexer->object_lookup = _mfd_rdbmsSrvInfoTable_object_lookup; + access_multiplexer->get_values = _mfd_rdbmsSrvInfoTable_get_values; + + /* + * no wrappers yet + */ + access_multiplexer->pre_request = _mfd_rdbmsSrvInfoTable_pre_request; + access_multiplexer->post_request = _mfd_rdbmsSrvInfoTable_post_request; + + + /************************************************* + * + * Create a registration, save our reg data, register table. + */ + DEBUGMSGTL(("rdbmsSrvInfoTable:init_rdbmsSrvInfoTable", + "Registering rdbmsSrvInfoTable as a mibs-for-dummies table.\n")); + handler = netsnmp_baby_steps_access_multiplexer_get(access_multiplexer); + reginfo = netsnmp_handler_registration_create("rdbmsSrvInfoTable", handler, + rdbmsSrvInfoTable_oid, + rdbmsSrvInfoTable_oid_size, + HANDLER_CAN_BABY_STEP | + HANDLER_CAN_RONLY + ); + if(NULL == reginfo) { + snmp_log(LOG_ERR,"error registering table rdbmsSrvInfoTable\n"); + return; + } + reginfo->my_reg_void = &rdbmsSrvInfoTable_if_ctx; + + /************************************************* + * + * set up baby steps handler, create it and inject it + */ + if( access_multiplexer->object_lookup ) + mfd_modes |= BABY_STEP_OBJECT_LOOKUP; + if( access_multiplexer->set_values ) + mfd_modes |= BABY_STEP_SET_VALUES; + if( access_multiplexer->irreversible_commit ) + mfd_modes |= BABY_STEP_IRREVERSIBLE_COMMIT; + if( access_multiplexer->object_syntax_checks ) + mfd_modes |= BABY_STEP_CHECK_OBJECT; + + if( access_multiplexer->pre_request ) + mfd_modes |= BABY_STEP_PRE_REQUEST; + if( access_multiplexer->post_request ) + mfd_modes |= BABY_STEP_POST_REQUEST; + + if( access_multiplexer->undo_setup ) + mfd_modes |= BABY_STEP_UNDO_SETUP; + if( access_multiplexer->undo_cleanup ) + mfd_modes |= BABY_STEP_UNDO_CLEANUP; + if( access_multiplexer->undo_sets ) + mfd_modes |= BABY_STEP_UNDO_SETS; + + if( access_multiplexer->row_creation ) + mfd_modes |= BABY_STEP_ROW_CREATE; + if( access_multiplexer->consistency_checks ) + mfd_modes |= BABY_STEP_CHECK_CONSISTENCY; + if( access_multiplexer->commit ) + mfd_modes |= BABY_STEP_COMMIT; + if( access_multiplexer->undo_commit ) + mfd_modes |= BABY_STEP_UNDO_COMMIT; + + handler = netsnmp_baby_steps_handler_get(mfd_modes); + netsnmp_inject_handler(reginfo, handler); + + /************************************************* + * + * inject row_merge helper with prefix rootoid_len + 2 (entry.col) + */ + handler = netsnmp_get_row_merge_handler(reginfo->rootoid_len + 2); + netsnmp_inject_handler(reginfo, handler); + + /************************************************* + * + * inject container_table helper + */ + handler = + netsnmp_container_table_handler_get(tbl_info, + rdbmsSrvInfoTable_if_ctx.container, + TABLE_CONTAINER_KEY_NETSNMP_INDEX); + netsnmp_inject_handler( reginfo, handler ); + + /************************************************* + * + * inject cache helper + */ + if(NULL != rdbmsSrvInfoTable_if_ctx.cache) { + handler = netsnmp_cache_handler_get(rdbmsSrvInfoTable_if_ctx.cache); + netsnmp_inject_handler( reginfo, handler ); + } + + /* + * register table + */ + netsnmp_register_table(reginfo, tbl_info); +} /* _rdbmsSrvInfoTable_initialize_interface */ + +void +rdbmsSrvInfoTable_valid_columns_set(netsnmp_column_info *vc) +{ + rdbmsSrvInfoTable_if_ctx.tbl_info.valid_columns = vc; +} /* rdbmsSrvInfoTable_valid_columns_set */ + +/** + * @internal + * convert the index component stored in the context to an oid + */ +int +rdbmsSrvInfoTable_index_to_oid(netsnmp_index *oid_idx, + rdbmsSrvInfoTable_mib_index *mib_idx) +{ + int err = SNMP_ERR_NOERROR; + + /* + * temp storage for parsing indexes + */ + /* + * applIndex(1)/INTEGER/ASN_INTEGER/long(long)//l/a/w/e/R/d/h + */ + netsnmp_variable_list var_applIndex; + + /* + * set up varbinds + */ + memset( &var_applIndex, 0x00, sizeof(var_applIndex) ); + var_applIndex.type = ASN_INTEGER; + + /* + * chain temp index varbinds together + */ + var_applIndex.next_variable = NULL; + + + DEBUGMSGTL(("verbose:rdbmsSrvInfoTable:rdbmsSrvInfoTable_index_to_oid","called\n")); + + /* applIndex(1)/INTEGER/ASN_INTEGER/long(long)//l/a/w/e/R/d/h */ + snmp_set_var_value(&var_applIndex, (u_char*)&mib_idx->applIndex, + sizeof(mib_idx->applIndex)); + + + err = build_oid_noalloc(oid_idx->oids, oid_idx->len, (size_t *)&oid_idx->len, + NULL, 0, &var_applIndex); + if(err) + snmp_log(LOG_ERR,"error %d converting index to oid\n", err); + + /* + * parsing may have allocated memory. free it. + */ + snmp_reset_var_buffers( &var_applIndex ); + + return err; +} /* rdbmsSrvInfoTable_index_to_oid */ + +/** + * extract rdbmsSrvInfoTable indexes from a netsnmp_index + * + * @retval SNMP_ERR_NOERROR : no error + * @retval SNMP_ERR_GENERR : error + */ +int +rdbmsSrvInfoTable_index_from_oid(netsnmp_index *oid_idx, + rdbmsSrvInfoTable_mib_index *mib_idx) +{ + int err = SNMP_ERR_NOERROR; + + /* + * temp storage for parsing indexes + */ + /* + * applIndex(1)/INTEGER/ASN_INTEGER/long(long)//l/a/w/e/R/d/h + */ + netsnmp_variable_list var_applIndex; + + /* + * set up varbinds + */ + memset( &var_applIndex, 0x00, sizeof(var_applIndex) ); + var_applIndex.type = ASN_INTEGER; + + /* + * chain temp index varbinds together + */ + var_applIndex.next_variable = NULL; + + + DEBUGMSGTL(("verbose:rdbmsSrvInfoTable:rdbmsSrvInfoTable_index_from_oid","called\n")); + + /* + * parse the oid into the individual index components + */ + err = parse_oid_indexes( oid_idx->oids, oid_idx->len, + &var_applIndex ); + if (err == SNMP_ERR_NOERROR) { + /* + * copy out values + */ + mib_idx->applIndex = *((long *)var_applIndex.val.string); + + + } + + /* + * parsing may have allocated memory. free it. + */ + snmp_reset_var_buffers( &var_applIndex ); + + return err; +} /* rdbmsSrvInfoTable_index_from_oid */ + + +/* ********************************************************************* + * @internal + * allocate resources for a rdbmsSrvInfoTable_rowreq_ctx + */ +rdbmsSrvInfoTable_rowreq_ctx * +rdbmsSrvInfoTable_allocate_rowreq_ctx(void) +{ + rdbmsSrvInfoTable_rowreq_ctx *rowreq_ctx = + SNMP_MALLOC_TYPEDEF(rdbmsSrvInfoTable_rowreq_ctx); + + DEBUGMSGTL(("internal:rdbmsSrvInfoTable:rdbmsSrvInfoTable_allocate_rowreq_ctx","called\n")); + + if(NULL == rowreq_ctx) { + snmp_log(LOG_ERR,"Couldn't allocate memory for a " + "rdbmsSrvInfoTable_rowreq_ctx.\n"); + } + + rowreq_ctx->oid_idx.oids = rowreq_ctx->oid_tmp; + + rowreq_ctx->rdbmsSrvInfoTable_data_list = NULL; + rowreq_ctx->rdbmsSrvInfoTable_reg = rdbmsSrvInfoTable_if_ctx.user_ctx; + + + return rowreq_ctx; +} /* rdbmsSrvInfoTable_allocate_rowreq_ctx */ + +/* + * @internal + * release resources for a rdbmsSrvInfoTable_rowreq_ctx + */ +void +rdbmsSrvInfoTable_release_rowreq_ctx(rdbmsSrvInfoTable_rowreq_ctx *rowreq_ctx) +{ + DEBUGMSGTL(("internal:rdbmsSrvInfoTable:rdbmsSrvInfoTable_release_rowreq_ctx","called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + + /* + * free index oid pointer + */ + if(rowreq_ctx->oid_idx.oids != rowreq_ctx->oid_tmp) + free(rowreq_ctx->oid_idx.oids); + + SNMP_FREE(rowreq_ctx); +} /* rdbmsSrvInfoTable_release_rowreq_ctx */ + +/** + * @internal + * wrapper + */ +static int +_mfd_rdbmsSrvInfoTable_pre_request(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info *agtreq_info, + netsnmp_request_info *requests) +{ + int rc = rdbmsSrvInfoTable_pre_request(rdbmsSrvInfoTable_if_ctx.user_ctx); + if (MFD_SUCCESS != rc) { + /* + * nothing we can do about it but log it + */ + DEBUGMSGTL(("internal:rdbmsSrvInfoTable","error %d from " + "rdbmsSrvInfoTable_pre_request\n", rc)); + netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc)); + } + + return SNMP_ERR_NOERROR; +} /* _mfd_rdbmsSrvInfoTable_pre_request */ + +/** + * @internal + * wrapper + */ +static int +_mfd_rdbmsSrvInfoTable_post_request(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info *agtreq_info, + netsnmp_request_info *requests) +{ + rdbmsSrvInfoTable_rowreq_ctx *rowreq_ctx; + int rc = rdbmsSrvInfoTable_post_request(rdbmsSrvInfoTable_if_ctx.user_ctx); + if (MFD_SUCCESS != rc) { + /* + * nothing we can do about it but log it + */ + DEBUGMSGTL(("internal:rdbmsSrvInfoTable","error %d from " + "rdbmsSrvInfoTable_post_request\n", rc)); + } + + /* + * if there are no errors, check for and handle row creation/deletion + */ + rc = netsnmp_check_requests_error(requests); + if ((SNMP_ERR_NOERROR == rc) && + (NULL != + (rowreq_ctx = netsnmp_container_table_row_extract(requests)))) { + if (rowreq_ctx->rowreq_flags & MFD_ROW_CREATED) { + rowreq_ctx->rowreq_flags &= ~MFD_ROW_CREATED; + CONTAINER_INSERT(rdbmsSrvInfoTable_if_ctx.container, rowreq_ctx); + } + else if (rowreq_ctx->rowreq_flags & MFD_ROW_DELETED) { + CONTAINER_REMOVE(rdbmsSrvInfoTable_if_ctx.container, rowreq_ctx); + rdbmsSrvInfoTable_release_rowreq_ctx(rowreq_ctx); + } + } + + return SNMP_ERR_NOERROR; +} /* _mfd_rdbmsSrvInfoTable_post_request */ + +/** + * @internal + * wrapper + */ +static int +_mfd_rdbmsSrvInfoTable_object_lookup(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info *agtreq_info, + netsnmp_request_info *requests) +{ + rdbmsSrvInfoTable_rowreq_ctx *rowreq_ctx = + netsnmp_container_table_row_extract(requests); + + DEBUGMSGTL(("internal:rdbmsSrvInfoTable:_mfd_rdbmsSrvInfoTable_object_lookup","called\n")); + + /* + * get our context from mfd + * rdbmsSrvInfoTable_interface_ctx *if_ctx = + * (rdbmsSrvInfoTable_interface_ctx *)reginfo->my_reg_void; + */ + + if(NULL == rowreq_ctx) { + netsnmp_request_set_error_all(requests, SNMP_ERR_NOCREATION); + } + else { + rdbmsSrvInfoTable_row_prep(rowreq_ctx); + } + + return SNMP_ERR_NOERROR; +} /* _mfd_rdbmsSrvInfoTable_object_lookup */ + +/*********************************************************************** + * + * GET processing + * + ***********************************************************************/ +/* + * @internal + * Retrieve the value for a particular column + */ +NETSNMP_STATIC_INLINE int +_rdbmsSrvInfoTable_get_column( rdbmsSrvInfoTable_rowreq_ctx *rowreq_ctx, + netsnmp_variable_list *var, int column ) +{ + int rc = SNMPERR_SUCCESS; + + DEBUGMSGTL(("internal:rdbmsSrvInfoTable:_mfd_rdbmsSrvInfoTable_get_column","called\n")); + + + netsnmp_assert(NULL != rowreq_ctx); + + switch(column) { + + /* rdbmsSrvInfoStartupTime(1)/DateAndTime/ASN_OCTET_STR/char(char)//L/A/w/e/R/d/H */ + case COLUMN_RDBMSSRVINFOSTARTUPTIME: + var->type = ASN_OCTET_STR; +rc = rdbmsSrvInfoStartupTime_get(rowreq_ctx, (char **)&var->val.string, &var->val_len ); + break; + + /* rdbmsSrvInfoFinishedTransactions(2)/GAUGE/ASN_GAUGE/u_long(u_long)//l/A/w/e/r/d/h */ + case COLUMN_RDBMSSRVINFOFINISHEDTRANSACTIONS: + var->val_len = sizeof(u_long); + var->type = ASN_GAUGE; +rc = rdbmsSrvInfoFinishedTransactions_get(rowreq_ctx, (u_long *)var->val.string ); + break; + + /* rdbmsSrvInfoDiskReads(3)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h */ + case COLUMN_RDBMSSRVINFODISKREADS: + var->val_len = sizeof(u_long); + var->type = ASN_COUNTER; +rc = rdbmsSrvInfoDiskReads_get(rowreq_ctx, (u_long *)var->val.string ); + break; + + /* rdbmsSrvInfoLogicalReads(4)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h */ + case COLUMN_RDBMSSRVINFOLOGICALREADS: + var->val_len = sizeof(u_long); + var->type = ASN_COUNTER; +rc = rdbmsSrvInfoLogicalReads_get(rowreq_ctx, (u_long *)var->val.string ); + break; + + /* rdbmsSrvInfoDiskWrites(5)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h */ + case COLUMN_RDBMSSRVINFODISKWRITES: + var->val_len = sizeof(u_long); + var->type = ASN_COUNTER; +rc = rdbmsSrvInfoDiskWrites_get(rowreq_ctx, (u_long *)var->val.string ); + break; + + /* rdbmsSrvInfoLogicalWrites(6)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h */ + case COLUMN_RDBMSSRVINFOLOGICALWRITES: + var->val_len = sizeof(u_long); + var->type = ASN_COUNTER; +rc = rdbmsSrvInfoLogicalWrites_get(rowreq_ctx, (u_long *)var->val.string ); + break; + + /* rdbmsSrvInfoPageReads(7)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h */ + case COLUMN_RDBMSSRVINFOPAGEREADS: + var->val_len = sizeof(u_long); + var->type = ASN_COUNTER; +rc = rdbmsSrvInfoPageReads_get(rowreq_ctx, (u_long *)var->val.string ); + break; + + /* rdbmsSrvInfoPageWrites(8)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h */ + case COLUMN_RDBMSSRVINFOPAGEWRITES: + var->val_len = sizeof(u_long); + var->type = ASN_COUNTER; +rc = rdbmsSrvInfoPageWrites_get(rowreq_ctx, (u_long *)var->val.string ); + break; + + /* rdbmsSrvInfoDiskOutOfSpaces(9)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h */ + case COLUMN_RDBMSSRVINFODISKOUTOFSPACES: + var->val_len = sizeof(u_long); + var->type = ASN_COUNTER; +rc = rdbmsSrvInfoDiskOutOfSpaces_get(rowreq_ctx, (u_long *)var->val.string ); + break; + + /* rdbmsSrvInfoHandledRequests(10)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h */ + case COLUMN_RDBMSSRVINFOHANDLEDREQUESTS: + var->val_len = sizeof(u_long); + var->type = ASN_COUNTER; +rc = rdbmsSrvInfoHandledRequests_get(rowreq_ctx, (u_long *)var->val.string ); + break; + + /* rdbmsSrvInfoRequestRecvs(11)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h */ + case COLUMN_RDBMSSRVINFOREQUESTRECVS: + var->val_len = sizeof(u_long); + var->type = ASN_COUNTER; +rc = rdbmsSrvInfoRequestRecvs_get(rowreq_ctx, (u_long *)var->val.string ); + break; + + /* rdbmsSrvInfoRequestSends(12)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h */ + case COLUMN_RDBMSSRVINFOREQUESTSENDS: + var->val_len = sizeof(u_long); + var->type = ASN_COUNTER; +rc = rdbmsSrvInfoRequestSends_get(rowreq_ctx, (u_long *)var->val.string ); + break; + + /* rdbmsSrvInfoHighwaterInboundAssociations(13)/GAUGE/ASN_GAUGE/u_long(u_long)//l/A/w/e/r/d/h */ + case COLUMN_RDBMSSRVINFOHIGHWATERINBOUNDASSOCIATIONS: + var->val_len = sizeof(u_long); + var->type = ASN_GAUGE; +rc = rdbmsSrvInfoHighwaterInboundAssociations_get(rowreq_ctx, (u_long *)var->val.string ); + break; + + /* rdbmsSrvInfoMaxInboundAssociations(14)/GAUGE/ASN_GAUGE/u_long(u_long)//l/A/W/e/r/d/h */ + case COLUMN_RDBMSSRVINFOMAXINBOUNDASSOCIATIONS: + var->val_len = sizeof(u_long); + var->type = ASN_GAUGE; +rc = rdbmsSrvInfoMaxInboundAssociations_get(rowreq_ctx, (u_long *)var->val.string ); + break; + + default: + snmp_log(LOG_ERR,"unknown column %d in _rdbmsSrvInfoTable_get_column\n", column); + break; + } + + return rc; +} /* _rdbmsSrvInfoTable_get_column */ + +int +_mfd_rdbmsSrvInfoTable_get_values(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info *agtreq_info, + netsnmp_request_info *requests) +{ + rdbmsSrvInfoTable_rowreq_ctx *rowreq_ctx = + netsnmp_container_table_row_extract(requests); + netsnmp_table_request_info * tri; + u_char * old_string; + void (*dataFreeHook)(void *); + int rc; + + DEBUGMSGTL(("internal:rdbmsSrvInfoTable:_mfd_rdbmsSrvInfoTable_get_values","called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + for(;requests; requests = requests->next) { + /* + * save old pointer, so we can free it if replaced + */ + old_string = requests->requestvb->val.string; + dataFreeHook = requests->requestvb->dataFreeHook; + if(NULL == requests->requestvb->val.string) { + requests->requestvb->val.string = requests->requestvb->buf; + requests->requestvb->val_len = sizeof(requests->requestvb->buf); + } + else if(requests->requestvb->buf == requests->requestvb->val.string) { + if(requests->requestvb->val_len != sizeof(requests->requestvb->buf)) + requests->requestvb->val_len = sizeof(requests->requestvb->buf); + } + + /* + * get column data + */ + tri = netsnmp_extract_table_info(requests); + if(NULL == tri) + continue; + + rc = _rdbmsSrvInfoTable_get_column(rowreq_ctx, requests->requestvb, tri->colnum); + if(rc) { + if(MFD_SKIP == rc) { + requests->requestvb->type = ASN_PRIV_RETRY; + rc = SNMP_ERR_NOERROR; + } + } + else if (NULL == requests->requestvb->val.string) { + snmp_log(LOG_ERR,"NULL varbind data pointer!\n"); + rc = SNMP_ERR_GENERR; + } + if(rc) + netsnmp_request_set_error(requests, SNMP_VALIDATE_ERR(rc)); + + /* + * if the buffer wasn't used previously for the old data (i.e. it + * was allcoated memory) and the get routine replaced the pointer, + * we need to free the previous pointer. + */ + if(old_string && (old_string != requests->requestvb->buf) && + (requests->requestvb->val.string != old_string)) { + if(dataFreeHook) + (*dataFreeHook)(old_string); + else + free(old_string); + } + } /* for results */ + + return SNMP_ERR_NOERROR; +} /* _mfd_rdbmsSrvInfoTable_get_values */ + +/*********************************************************************** + * + * SET processing + * + ***********************************************************************/ + +/* + * NOT APPLICABLE (per MIB or user setting) + */ +/*********************************************************************** + * + * DATA ACCESS + * + ***********************************************************************/ +/** + * @internal + */ +static int +_cache_load(netsnmp_cache *cache, void *vmagic) +{ + DEBUGMSGTL(("internal:rdbmsSrvInfoTable:_cache_load","called\n")); + + if((NULL == cache) || (NULL == cache->magic)) { + snmp_log(LOG_ERR, "invalid cache for rdbmsSrvInfoTable_cache_load\n"); + return -1; + } + + /** should only be called for an invalid or expired cache */ + netsnmp_assert((0 == cache->valid) || (1 == cache->expired)); + + /* + * call user code + */ + return rdbmsSrvInfoTable_cache_load((netsnmp_container*)cache->magic); +} /* _cache_load */ + +/** + * @internal + */ +static void +_cache_item_free(rdbmsSrvInfoTable_rowreq_ctx *rowreq_ctx, void *context) +{ + DEBUGMSGTL(("internal:rdbmsSrvInfoTable:_cache_item_free","called\n")); + + if(NULL == rowreq_ctx) + return; + + rdbmsSrvInfoTable_release_rowreq_ctx(rowreq_ctx); +} /* _cache_item_free */ + +/** + * @internal + */ +static void +_cache_free(netsnmp_cache *cache, void *magic) +{ + netsnmp_container *container; + + DEBUGMSGTL(("internal:rdbmsSrvInfoTable:_cache_free","called\n")); + + if((NULL == cache) || (NULL == cache->magic)) { + snmp_log(LOG_ERR, "invalid cache in rdbmsSrvInfoTable_cache_free\n"); + return; + } + + container = (netsnmp_container*)cache->magic; + + /* + * call user code + */ + rdbmsSrvInfoTable_cache_free(container); + + /* + * free all items. inefficient, but easy. + */ + CONTAINER_CLEAR(container, + (netsnmp_container_obj_func *)_cache_item_free, + NULL); +} /* _cache_free */ + +/** + * @internal + * initialize the iterator container with functions or wrappers + */ +void +_rdbmsSrvInfoTable_container_init(rdbmsSrvInfoTable_interface_ctx *if_ctx) +{ + DEBUGMSGTL(("internal:rdbmsSrvInfoTable:_rdbmsSrvInfoTable_container_init","called\n")); + + /* + * set up the cache + */ + if_ctx->cache = netsnmp_cache_create(30, /* timeout in seconds */ + _cache_load, _cache_free, + rdbmsSrvInfoTable_oid, + rdbmsSrvInfoTable_oid_size); + + if(NULL == if_ctx->cache) { + snmp_log(LOG_ERR, "error creating cache for rdbmsSrvInfoTable\n"); + return; + } + + if_ctx->cache->flags = NETSNMP_CACHE_DONT_INVALIDATE_ON_SET; + + rdbmsSrvInfoTable_container_init(&if_ctx->container, if_ctx->cache); + if(NULL == if_ctx->container) + if_ctx->container = netsnmp_container_find("rdbmsSrvInfoTable:table_container"); + if(NULL == if_ctx->container) { + snmp_log(LOG_ERR,"error creating container in " + "rdbmsSrvInfoTable_container_init\n"); + return; + } + if_ctx->cache->magic = (void*)if_ctx->container; +} /* _rdbmsSrvInfoTable_container_init */ + diff --git a/RDBMS-MIB_src/rdbmsSrvInfoTable/rdbmsSrvInfoTable_interface.h b/RDBMS-MIB_src/rdbmsSrvInfoTable/rdbmsSrvInfoTable_interface.h new file mode 100644 index 0000000..6fa8668 --- /dev/null +++ b/RDBMS-MIB_src/rdbmsSrvInfoTable/rdbmsSrvInfoTable_interface.h @@ -0,0 +1,50 @@ +/*------------------------------------------------------------------------- + * rdbmsSrvInfoTable_interface.h + * + * RDBMSMIB mib module. + * + * Copyright (c) 2004-2007, PostgreSQL Global Development Group + * Author: Joshua Tolley + * + * $Id: rdbmsSrvInfoTable_interface.h,v 1.2 2007/09/13 14:20:44 h-saito Exp $ + * + *------------------------------------------------------------------------- + */ + +#ifndef RDBMSSRVINFOTABLE_INTERFACE_H +#define RDBMSSRVINFOTABLE_INTERFACE_H + +#ifdef __cplusplus +extern "C" { +#endif + + +#include "rdbmsSrvInfoTable.h" + +/* ******************************************************************** + * Table declarations + */ + +/* PUBLIC interface initialization routine */ +void _rdbmsSrvInfoTable_initialize_interface(rdbmsSrvInfoTable_registration_ptr user_ctx, + u_long flags); + + rdbmsSrvInfoTable_rowreq_ctx * rdbmsSrvInfoTable_allocate_rowreq_ctx(void); +void rdbmsSrvInfoTable_release_rowreq_ctx(rdbmsSrvInfoTable_rowreq_ctx *rowreq_ctx); + +int rdbmsSrvInfoTable_index_to_oid(netsnmp_index *oid_idx, + rdbmsSrvInfoTable_mib_index *mib_idx); +int rdbmsSrvInfoTable_index_from_oid(netsnmp_index *oid_idx, + rdbmsSrvInfoTable_mib_index *mib_idx); + +/* + * access to certain internals. use with caution! + */ +void rdbmsSrvInfoTable_valid_columns_set(netsnmp_column_info *vc); + + +#ifdef __cplusplus +} +#endif + +#endif /* RDBMSSRVINFOTABLE_INTERFACE_H */ diff --git a/RDBMS-MIB_src/rdbmsSrvInfoTable/rdbmsSrvInfoTable_oids.h b/RDBMS-MIB_src/rdbmsSrvInfoTable/rdbmsSrvInfoTable_oids.h new file mode 100644 index 0000000..c61920e --- /dev/null +++ b/RDBMS-MIB_src/rdbmsSrvInfoTable/rdbmsSrvInfoTable_oids.h @@ -0,0 +1,47 @@ +/*------------------------------------------------------------------------- + * rdbmsSrvInfoTable_oids.h + * + * RDBMSMIB mib module. + * + * Copyright (c) 2004-2007, PostgreSQL Global Development Group + * Author: Joshua Tolley + * + * $Id: rdbmsSrvInfoTable_oids.h,v 1.2 2007/09/13 14:20:44 h-saito Exp $ + * + *------------------------------------------------------------------------- + */ + +#ifndef RDBMSSRVINFOTABLE_OIDS_H +#define RDBMSSRVINFOTABLE_OIDS_H + +#ifdef __cplusplus +extern "C" { +#endif + + +/* column number definitions for table rdbmsSrvInfoTable */ +#define RDBMSSRVINFOTABLE_OID 1,3,6,1,2,1,39,1,6 +#define COLUMN_RDBMSSRVINFOSTARTUPTIME 1 +#define COLUMN_RDBMSSRVINFOFINISHEDTRANSACTIONS 2 +#define COLUMN_RDBMSSRVINFODISKREADS 3 +#define COLUMN_RDBMSSRVINFOLOGICALREADS 4 +#define COLUMN_RDBMSSRVINFODISKWRITES 5 +#define COLUMN_RDBMSSRVINFOLOGICALWRITES 6 +#define COLUMN_RDBMSSRVINFOPAGEREADS 7 +#define COLUMN_RDBMSSRVINFOPAGEWRITES 8 +#define COLUMN_RDBMSSRVINFODISKOUTOFSPACES 9 +#define COLUMN_RDBMSSRVINFOHANDLEDREQUESTS 10 +#define COLUMN_RDBMSSRVINFOREQUESTRECVS 11 +#define COLUMN_RDBMSSRVINFOREQUESTSENDS 12 +#define COLUMN_RDBMSSRVINFOHIGHWATERINBOUNDASSOCIATIONS 13 +#define COLUMN_RDBMSSRVINFOMAXINBOUNDASSOCIATIONS 14 + +#define RDBMSSRVINFOTABLE_MIN_COL COLUMN_RDBMSSRVINFOSTARTUPTIME +#define RDBMSSRVINFOTABLE_MAX_COL COLUMN_RDBMSSRVINFOMAXINBOUNDASSOCIATIONS + + +#ifdef __cplusplus +} +#endif + +#endif /* RDBMSSRVINFOTABLE_OIDS_H */ |