summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org.ua>2016-06-07 06:43:01 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2016-06-07 06:43:01 (GMT)
commit82806504dc293c854f05104827c571e267d40089 (patch) (side-by-side diff)
tree190adbb66400cee6f1a5ebc4cb57dd718aa3beb5
parent757b835af8984c1fa796aec1789b484bd307bb8a (diff)
downloadmysqlstat-82806504dc293c854f05104827c571e267d40089.tar.gz
mysqlstat-82806504dc293c854f05104827c571e267d40089.tar.bz2
Fix integer types.
Use Gauge32 for integer values that may increase and decrease.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--src/MYSQL-STAT-MIB.txt16
-rw-r--r--src/mysqlstat.c4
-rw-r--r--src/mysqlstat_mib.mib2c10
3 files changed, 18 insertions, 12 deletions
diff --git a/src/MYSQL-STAT-MIB.txt b/src/MYSQL-STAT-MIB.txt
index 3c05db2..cd2aa29 100644
--- a/src/MYSQL-STAT-MIB.txt
+++ b/src/MYSQL-STAT-MIB.txt
@@ -5,28 +5,28 @@ MYSQL-STAT-MIB DEFINITIONS ::= BEGIN
-- MySQL statistics MIB
--
-- *************************************************************
IMPORTS
MODULE-IDENTITY, OBJECT-TYPE, enterprises, Counter64,
- Counter32, Integer32
+ Counter32, Integer32, Gauge32
FROM SNMPv2-SMI
TEXTUAL-CONVENTION, DisplayString, TruthValue, TimeStamp
FROM SNMPv2-TC
OBJECT-GROUP, MODULE-COMPLIANCE
FROM SNMPv2-CONF
InetAddress, InetAddressType, InetPortNumber
FROM INET-ADDRESS-MIB;
mysql MODULE-IDENTITY
- LAST-UPDATED "201606070800Z"
+ LAST-UPDATED "201606070918Z"
ORGANIZATION "Gray Software"
CONTACT-INFO "Sergey Poznyakoff <gray@gnu.org>"
DESCRIPTION
"This MIB module defines objects for MySQL statistics."
- REVISION "201606070800Z"
+ REVISION "201606070918Z"
DESCRIPTION
"First revision."
::= { enterprises 9163 101 }
replication OBJECT IDENTIFIER ::= { mysql 1 }
processList OBJECT IDENTIFIER ::= { mysql 2 }
@@ -239,13 +239,13 @@ replExecMasterLogPos OBJECT-TYPE
which the SQL thread has read and executed, marking
the start of the next transaction or event to be
processed."
::= { replSlaveStatusEntry 14 }
replRelayLogSpace OBJECT-TYPE
- SYNTAX Counter64
+ SYNTAX Gauge32
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"The total combined size of all existing relay log
files."
::= { replSlaveStatusEntry 15 }
@@ -340,13 +340,13 @@ replReplicateWildIgnoreTable OBJECT-TYPE
STATUS current
DESCRIPTION
"The lists of table name patterns to exclude from replication."
::= { replSlaveStatusEntry 26 }
replSkipCounter OBJECT-TYPE
- SYNTAX Counter32
+ SYNTAX Gauge32
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"The current value of the `sql_slave_skip_counter'
system variable."
::= { replSlaveStatusEntry 27 }
@@ -563,29 +563,29 @@ processInfo OBJECT-TYPE
STATUS current
DESCRIPTION
"Information about the process."
::= { processListEntry 9 }
processTotalCount OBJECT-TYPE
- SYNTAX Counter32
+ SYNTAX Gauge32
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Total number of processes (threads)."
::= { processList 2 }
processActiveCount OBJECT-TYPE
- SYNTAX Counter32
+ SYNTAX Gauge32
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Number of active processes (threads)."
::= { processList 3 }
processSlaveCount OBJECT-TYPE
- SYNTAX Counter32
+ SYNTAX Gauge32
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Number of replication slaves"
::= { processList 4 }
diff --git a/src/mysqlstat.c b/src/mysqlstat.c
index 2ffd0dd..2d32137 100644
--- a/src/mysqlstat.c
+++ b/src/mysqlstat.c
@@ -259,15 +259,13 @@ store_slave_status_row(struct replSlaveStatusTable_entry *ent,
ASSIGN_STRING(ent, replLastSQLError, value);
} else if (STREQ(Skip_Counter, name)) {
ent->replSkipCounter = strtoul(value, NULL, 10);
} else if (STREQ(Exec_Master_Log_Pos, name)) {
ent->replExecMasterLogPos = strtoul(value, NULL, 10);
} else if (STREQ(Relay_Log_Space, name)) {
- uint64_t n = strtoull(value, NULL, 10);
- ent->replRelayLogSpace.high = n >> 32;
- ent->replRelayLogSpace.low = n & 0xffffffff;
+ ent->replRelayLogSpace = strtoul(value, NULL, 10);
} else if (STREQ(Until_Condition, name)) {
ASSIGN_STRING(ent, replUntilCondition, value);
} else if (STREQ(Until_Log_File, name)) {
ASSIGN_STRING(ent, replUntilLogFile, value);
} else if (STREQ(Until_Log_Pos, name)) {
ASSIGN_STRING(ent, replUntilLogPos, value);
diff --git a/src/mysqlstat_mib.mib2c b/src/mysqlstat_mib.mib2c
index 733f977..510d9bf 100644
--- a/src/mysqlstat_mib.mib2c
+++ b/src/mysqlstat_mib.mib2c
@@ -81,12 +81,14 @@ handle_$i(netsnmp_mib_handler *handler,
@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_GAUGE'@
+ @eval $mysqlstat_type = q{uint32_t};@
@elsif $i.type eq 'ASN_TIMETICKS'@
@eval $mysqlstat_type = q{uint32_t};@
@end@
$mysqlstat_type val = $mysqlstat_get;
switch(reqinfo->mode) {
@@ -114,20 +116,26 @@ handle_$i(netsnmp_mib_handler *handler,
@elsif $i.type eq 'ASN_INTEGER'@
{
snmp_set_var_typed_value(requests->requestvb, $i.type,
&val,
sizeof(val));
}
+ @elsif $i.type eq 'ASN_GAUGE'@
+ {
+ snmp_set_var_typed_value(requests->requestvb, $i.type,
+ &val,
+ sizeof(val));
+ }
@elsif $i.type eq 'ASN_TIMETICKS'@
{
snmp_set_var_typed_value(requests->requestvb, $i.type,
&val,
sizeof(val));
}
@else@
- @printf "unrecognized type %s for %s" $i.type $i@
+ @printf "#error \"unrecognized type %s for %s\"" $i.type $i@
@end@
break;
@if $i.settable@
/*
* SET REQUEST

Return to:

Send suggestions and report system problems to the System administrator.