aboutsummaryrefslogtreecommitdiff
path: root/src/mysqlstat_mib.mib2c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2016-06-07 08:01:46 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2016-06-07 08:01:46 +0300
commit757b835af8984c1fa796aec1789b484bd307bb8a (patch)
tree7f37eec457262277ff2fe856eb2907155fded780 /src/mysqlstat_mib.mib2c
parentec36698ad30b99a05104952f011cf471faf83e56 (diff)
downloadmysqlstat-757b835af8984c1fa796aec1789b484bd307bb8a.tar.gz
mysqlstat-757b835af8984c1fa796aec1789b484bd307bb8a.tar.bz2
Keep MySQL connection open as long as possible. Implement new OIDs.
* src/MYSQL-STAT-MIB.txt: New OIDs: processTotalCount, processActiveCount, and processSlaveCount * src/mysqlstat.c (mysqlstat_connect): Keep connection open. (mysqlstat_disconnect): Remove. (get_process_list, process_first, process_next): New functions. Keep a cached list of processes and iterate through it. All functions updated. (process_total_count,process_active_count) (process_slave_count): New functions. * src/mysqlstat.h (process_total_count,process_active_count) (process_slave_count): New protos. * src/mysqlstat_mib.mib2c (handle_$i): Update.
Diffstat (limited to 'src/mysqlstat_mib.mib2c')
-rw-r--r--src/mysqlstat_mib.mib2c114
1 files changed, 23 insertions, 91 deletions
diff --git a/src/mysqlstat_mib.mib2c b/src/mysqlstat_mib.mib2c
index 7f00d9b..733f977 100644
--- a/src/mysqlstat_mib.mib2c
+++ b/src/mysqlstat_mib.mib2c
@@ -23,81 +23,9 @@
@enddefine@
@startperl@
$vars{'mysqlstat_translate_table'} = {
- replSlaveIOState =>
- q{mysqlstat_get(MYSQLSTAT_CACHE_REPL, "Slave_IO_State")},
- replMasterLogFile =>
- q{mysqlstat_get(MYSQLSTAT_CACHE_REPL, "Master_Log_File")},
- replReadMasterLogPos =>
- q{mysqlstat_get(MYSQLSTAT_CACHE_REPL, "Read_Master_Log_Pos")},
- replRelayLogFile =>
- q{mysqlstat_get(MYSQLSTAT_CACHE_REPL, "Relay_Log_File")},
- replRelayLogPos =>
- q{mysqlstat_get(MYSQLSTAT_CACHE_REPL, "Relay_Log_Pos")},
- replRelayMasterLogFile =>
- q{mysqlstat_get(MYSQLSTAT_CACHE_REPL, "Relay_Master_Log_File")},
- replSlaveIORunning =>
- q{mysqlstat_get(MYSQLSTAT_CACHE_REPL, "Slave_IO_Running")},
- replSlaveSQLRunning =>
- q{mysqlstat_get(MYSQLSTAT_CACHE_REPL, "Slave_SQL_Running")},
- replLastSQLErrno =>
- q{mysqlstat_get(MYSQLSTAT_CACHE_REPL, "Last_SQL_Errno")},
- replLastSQLError =>
- q{mysqlstat_get(MYSQLSTAT_CACHE_REPL, "Last_SQL_Error")},
- replLastIOErrno =>
- q{mysqlstat_get(MYSQLSTAT_CACHE_REPL, "Last_IO_Errno")},
- replLastIOError =>
- q{mysqlstat_get(MYSQLSTAT_CACHE_REPL, "Last_IO_Error")},
- replExecMasterLogPos =>
- q{mysqlstat_get(MYSQLSTAT_CACHE_REPL, "Exec_Master_Log_Pos")},
- replRelayLogSpace =>
- q{mysqlstat_get(MYSQLSTAT_CACHE_REPL, "Relay_Log_Space")},
- replSecondsBehindMaster =>
- q{mysqlstat_get(MYSQLSTAT_CACHE_REPL, "Seconds_Behind_Master")},
-
- replMasterHost =>
- q{mysqlstat_get(MYSQLSTAT_CACHE_REPL, "Master_Host")},
- replMasterUser =>
- q{mysqlstat_get(MYSQLSTAT_CACHE_REPL, "Master_User")},
- replMasterPort =>
- q{mysqlstat_get(MYSQLSTAT_CACHE_REPL, "Master_Port")},
- replConnectRetry =>
- q{mysqlstat_get(MYSQLSTAT_CACHE_REPL, "Connect_Retry")},
- replReplicateDoDB =>
- q{mysqlstat_get(MYSQLSTAT_CACHE_REPL, "Replicate_Do_DB")},
- replReplicateIgnoreDB =>
- q{mysqlstat_get(MYSQLSTAT_CACHE_REPL, "Replicate_Ignore_DB")},
- replReplicateDoTable =>
- q{mysqlstat_get(MYSQLSTAT_CACHE_REPL, "Replicate_Do_Table")},
- replReplicateIgnoreTable =>
- q{mysqlstat_get(MYSQLSTAT_CACHE_REPL, "Replicate_Ignore_Table")},
- replReplicateWildDoTable =>
- q{mysqlstat_get(MYSQLSTAT_CACHE_REPL, "Replicate_Wild_Do_Table")},
- replReplicateWildIgnoreTable =>
- q{mysqlstat_get(MYSQLSTAT_CACHE_REPL, "Replicate_Wild_Ignore_Table")},
- replSkipCounter =>
- q{mysqlstat_get(MYSQLSTAT_CACHE_REPL, "Skip_Counter")},
- replUntilCondition =>
- q{mysqlstat_get(MYSQLSTAT_CACHE_REPL, "Until_Condition")},
- replUntilLogFile =>
- q{mysqlstat_get(MYSQLSTAT_CACHE_REPL, "Until_Log_File")},
- replUntilLogPos =>
- q{mysqlstat_get(MYSQLSTAT_CACHE_REPL, "Until_Log_Pos")},
- replMasterServerId =>
- q{mysqlstat_get(MYSQLSTAT_CACHE_REPL, "Master_Server_Id")},
- replMasterSSLAllowed =>
- q{mysqlstat_get(MYSQLSTAT_CACHE_REPL, "Master_SSL_Allowed")},
- replMasterSSLCAFile =>
- q{mysqlstat_get(MYSQLSTAT_CACHE_REPL, "Master_SSL_CA_File")},
- replMasterSSLCAPath =>
- q{mysqlstat_get(MYSQLSTAT_CACHE_REPL, "Master_SSL_CA_Path")},
- replMasterSSLCert =>
- q{mysqlstat_get(MYSQLSTAT_CACHE_REPL, "Master_SSL_Cert")},
- replMasterSSLCipher =>
- q{mysqlstat_get(MYSQLSTAT_CACHE_REPL, "Master_SSL_Cipher")},
- replMasterSSLKey =>
- q{mysqlstat_get(MYSQLSTAT_CACHE_REPL, "Master_SSL_Key")},
- replMasterSSLVerifyServerCert =>
- q{mysqlstat_get(MYSQLSTAT_CACHE_REPL, "Master_SSL_Verify_Server_Cert")}
+ processTotalCount => q{process_total_count()},
+ processActiveCount => q{process_active_count()},
+ processSlaveCount => q{process_slave_count()}
};
$vars{'mysqlstat_translate'} = sub {
@@ -148,19 +76,26 @@ handle_$i(netsnmp_mib_handler *handler,
@if $i.settable@
int ret;
@end@
- char const *val = $mysqlstat_get;
+ @if $i.type eq 'ASN_OCTET_STR'@
+ @eval $mysqlstat_type = q{char const *};@
+ @elsif $i.type eq 'ASN_COUNTER64'@
+ @eval $mysqlstat_type = q{uint64_t};@
+ @elsif $i.type eq 'ASN_COUNTER'@
+ @eval $mysqlstat_type = q{uint32_t};@
+ @elsif $i.type eq 'ASN_INTEGER'@
+ @eval $mysqlstat_type = q{uint32_t};@
+ @elsif $i.type eq 'ASN_TIMETICKS'@
+ @eval $mysqlstat_type = q{uint32_t};@
+ @end@
+ $mysqlstat_type val = $mysqlstat_get;
- if (!val)
- return SNMP_ERR_NOSUCHNAME;
-
switch(reqinfo->mode) {
case MODE_GET:
@if $i.type eq 'ASN_COUNTER64'@
{
struct counter64 ctr;
- uint64_t n = strtoull(val, NULL, 10);
- ctr.high = n >> 32;
- ctr.low = n & 0xffffffff;
+ ctr.high = val >> 32;
+ ctr.low = val & 0xffffffff;
snmp_set_var_typed_value(requests->requestvb, $i.type,
&ctr,
sizeof(ctr));
@@ -172,24 +107,21 @@ handle_$i(netsnmp_mib_handler *handler,
}
@elsif $i.type eq 'ASN_COUNTER'@
{
- uint32_t n = strtoul(val, NULL, 10);
snmp_set_var_typed_value(requests->requestvb, $i.type,
- &n,
- sizeof(n));
+ &val,
+ sizeof(val));
}
@elsif $i.type eq 'ASN_INTEGER'@
{
- uint32_t n = strtoul(val, NULL, 10);
snmp_set_var_typed_value(requests->requestvb, $i.type,
- &n,
- sizeof(n));
+ &val,
+ sizeof(val));
}
@elsif $i.type eq 'ASN_TIMETICKS'@
{
- uint32_t n = strtoul(val, NULL, 10);
snmp_set_var_typed_value(requests->requestvb, $i.type,
- &n,
- sizeof(n));
+ &val,
+ sizeof(val));
}
@else@
@printf "unrecognized type %s for %s" $i.type $i@

Return to:

Send suggestions and report system problems to the System administrator.