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
@@ -8,7 +8,7 @@ MYSQL-STAT-MIB DEFINITIONS ::= BEGIN
IMPORTS
MODULE-IDENTITY, OBJECT-TYPE, enterprises, Counter64,
- Counter32, Integer32
+ Counter32, Integer32, Gauge32
FROM SNMPv2-SMI
TEXTUAL-CONVENTION, DisplayString, TruthValue, TimeStamp
FROM SNMPv2-TC
@@ -18,12 +18,12 @@ IMPORTS
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 }
@@ -242,7 +242,7 @@ replExecMasterLogPos OBJECT-TYPE
::= { replSlaveStatusEntry 14 }
replRelayLogSpace OBJECT-TYPE
- SYNTAX Counter64
+ SYNTAX Gauge32
MAX-ACCESS read-only
STATUS current
DESCRIPTION
@@ -343,7 +343,7 @@ replReplicateWildIgnoreTable OBJECT-TYPE
::= { replSlaveStatusEntry 26 }
replSkipCounter OBJECT-TYPE
- SYNTAX Counter32
+ SYNTAX Gauge32
MAX-ACCESS read-only
STATUS current
DESCRIPTION
@@ -566,7 +566,7 @@ processInfo OBJECT-TYPE
::= { processListEntry 9 }
processTotalCount OBJECT-TYPE
- SYNTAX Counter32
+ SYNTAX Gauge32
MAX-ACCESS read-only
STATUS current
DESCRIPTION
@@ -574,7 +574,7 @@ processTotalCount OBJECT-TYPE
::= { processList 2 }
processActiveCount OBJECT-TYPE
- SYNTAX Counter32
+ SYNTAX Gauge32
MAX-ACCESS read-only
STATUS current
DESCRIPTION
@@ -582,7 +582,7 @@ processActiveCount OBJECT-TYPE
::= { processList 3 }
processSlaveCount OBJECT-TYPE
- SYNTAX Counter32
+ SYNTAX Gauge32
MAX-ACCESS read-only
STATUS current
DESCRIPTION
diff --git a/src/mysqlstat.c b/src/mysqlstat.c
index 2ffd0dd..2d32137 100644
--- a/src/mysqlstat.c
+++ b/src/mysqlstat.c
@@ -262,9 +262,7 @@ store_slave_status_row(struct replSlaveStatusTable_entry *ent,
} 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)) {
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
@@ -84,6 +84,8 @@ handle_$i(netsnmp_mib_handler *handler,
@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@
@@ -117,6 +119,12 @@ handle_$i(netsnmp_mib_handler *handler,
&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,
@@ -124,7 +132,7 @@ handle_$i(netsnmp_mib_handler *handler,
sizeof(val));
}
@else@
- @printf "unrecognized type %s for %s" $i.type $i@
+ @printf "#error \"unrecognized type %s for %s\"" $i.type $i@
@end@
break;

Return to:

Send suggestions and report system problems to the System administrator.