aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2016-06-07 09:43:01 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2016-06-07 09:43:01 +0300
commit82806504dc293c854f05104827c571e267d40089 (patch)
tree190adbb66400cee6f1a5ebc4cb57dd718aa3beb5
parent757b835af8984c1fa796aec1789b484bd307bb8a (diff)
downloadmysqlstat-82806504dc293c854f05104827c571e267d40089.tar.gz
mysqlstat-82806504dc293c854f05104827c571e267d40089.tar.bz2
Fix integer types.
Use Gauge32 for integer values that may increase and decrease.
-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
8 8
9IMPORTS 9IMPORTS
10 MODULE-IDENTITY, OBJECT-TYPE, enterprises, Counter64, 10 MODULE-IDENTITY, OBJECT-TYPE, enterprises, Counter64,
11 Counter32, Integer32 11 Counter32, Integer32, Gauge32
12 FROM SNMPv2-SMI 12 FROM SNMPv2-SMI
13 TEXTUAL-CONVENTION, DisplayString, TruthValue, TimeStamp 13 TEXTUAL-CONVENTION, DisplayString, TruthValue, TimeStamp
14 FROM SNMPv2-TC 14 FROM SNMPv2-TC
@@ -18,12 +18,12 @@ IMPORTS
18 FROM INET-ADDRESS-MIB; 18 FROM INET-ADDRESS-MIB;
19 19
20mysql MODULE-IDENTITY 20mysql MODULE-IDENTITY
21 LAST-UPDATED "201606070800Z" 21 LAST-UPDATED "201606070918Z"
22 ORGANIZATION "Gray Software" 22 ORGANIZATION "Gray Software"
23 CONTACT-INFO "Sergey Poznyakoff <gray@gnu.org>" 23 CONTACT-INFO "Sergey Poznyakoff <gray@gnu.org>"
24 DESCRIPTION 24 DESCRIPTION
25 "This MIB module defines objects for MySQL statistics." 25 "This MIB module defines objects for MySQL statistics."
26 REVISION "201606070800Z" 26 REVISION "201606070918Z"
27 DESCRIPTION 27 DESCRIPTION
28 "First revision." 28 "First revision."
29 ::= { enterprises 9163 101 } 29 ::= { enterprises 9163 101 }
@@ -242,7 +242,7 @@ replExecMasterLogPos OBJECT-TYPE
242 ::= { replSlaveStatusEntry 14 } 242 ::= { replSlaveStatusEntry 14 }
243 243
244replRelayLogSpace OBJECT-TYPE 244replRelayLogSpace OBJECT-TYPE
245 SYNTAX Counter64 245 SYNTAX Gauge32
246 MAX-ACCESS read-only 246 MAX-ACCESS read-only
247 STATUS current 247 STATUS current
248 DESCRIPTION 248 DESCRIPTION
@@ -343,7 +343,7 @@ replReplicateWildIgnoreTable OBJECT-TYPE
343 ::= { replSlaveStatusEntry 26 } 343 ::= { replSlaveStatusEntry 26 }
344 344
345replSkipCounter OBJECT-TYPE 345replSkipCounter OBJECT-TYPE
346 SYNTAX Counter32 346 SYNTAX Gauge32
347 MAX-ACCESS read-only 347 MAX-ACCESS read-only
348 STATUS current 348 STATUS current
349 DESCRIPTION 349 DESCRIPTION
@@ -566,7 +566,7 @@ processInfo OBJECT-TYPE
566 ::= { processListEntry 9 } 566 ::= { processListEntry 9 }
567 567
568processTotalCount OBJECT-TYPE 568processTotalCount OBJECT-TYPE
569 SYNTAX Counter32 569 SYNTAX Gauge32
570 MAX-ACCESS read-only 570 MAX-ACCESS read-only
571 STATUS current 571 STATUS current
572 DESCRIPTION 572 DESCRIPTION
@@ -574,7 +574,7 @@ processTotalCount OBJECT-TYPE
574 ::= { processList 2 } 574 ::= { processList 2 }
575 575
576processActiveCount OBJECT-TYPE 576processActiveCount OBJECT-TYPE
577 SYNTAX Counter32 577 SYNTAX Gauge32
578 MAX-ACCESS read-only 578 MAX-ACCESS read-only
579 STATUS current 579 STATUS current
580 DESCRIPTION 580 DESCRIPTION
@@ -582,7 +582,7 @@ processActiveCount OBJECT-TYPE
582 ::= { processList 3 } 582 ::= { processList 3 }
583 583
584processSlaveCount OBJECT-TYPE 584processSlaveCount OBJECT-TYPE
585 SYNTAX Counter32 585 SYNTAX Gauge32
586 MAX-ACCESS read-only 586 MAX-ACCESS read-only
587 STATUS current 587 STATUS current
588 DESCRIPTION 588 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,
262 } else if (STREQ(Exec_Master_Log_Pos, name)) { 262 } else if (STREQ(Exec_Master_Log_Pos, name)) {
263 ent->replExecMasterLogPos = strtoul(value, NULL, 10); 263 ent->replExecMasterLogPos = strtoul(value, NULL, 10);
264 } else if (STREQ(Relay_Log_Space, name)) { 264 } else if (STREQ(Relay_Log_Space, name)) {
265 uint64_t n = strtoull(value, NULL, 10); 265 ent->replRelayLogSpace = strtoul(value, NULL, 10);
266 ent->replRelayLogSpace.high = n >> 32;
267 ent->replRelayLogSpace.low = n & 0xffffffff;
268 } else if (STREQ(Until_Condition, name)) { 266 } else if (STREQ(Until_Condition, name)) {
269 ASSIGN_STRING(ent, replUntilCondition, value); 267 ASSIGN_STRING(ent, replUntilCondition, value);
270 } else if (STREQ(Until_Log_File, name)) { 268 } 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,
84 @eval $mysqlstat_type = q{uint32_t};@ 84 @eval $mysqlstat_type = q{uint32_t};@
85 @elsif $i.type eq 'ASN_INTEGER'@ 85 @elsif $i.type eq 'ASN_INTEGER'@
86 @eval $mysqlstat_type = q{uint32_t};@ 86 @eval $mysqlstat_type = q{uint32_t};@
87 @elsif $i.type eq 'ASN_GAUGE'@
88 @eval $mysqlstat_type = q{uint32_t};@
87 @elsif $i.type eq 'ASN_TIMETICKS'@ 89 @elsif $i.type eq 'ASN_TIMETICKS'@
88 @eval $mysqlstat_type = q{uint32_t};@ 90 @eval $mysqlstat_type = q{uint32_t};@
89 @end@ 91 @end@
@@ -117,6 +119,12 @@ handle_$i(netsnmp_mib_handler *handler,
117 &val, 119 &val,
118 sizeof(val)); 120 sizeof(val));
119 } 121 }
122 @elsif $i.type eq 'ASN_GAUGE'@
123 {
124 snmp_set_var_typed_value(requests->requestvb, $i.type,
125 &val,
126 sizeof(val));
127 }
120 @elsif $i.type eq 'ASN_TIMETICKS'@ 128 @elsif $i.type eq 'ASN_TIMETICKS'@
121 { 129 {
122 snmp_set_var_typed_value(requests->requestvb, $i.type, 130 snmp_set_var_typed_value(requests->requestvb, $i.type,
@@ -124,7 +132,7 @@ handle_$i(netsnmp_mib_handler *handler,
124 sizeof(val)); 132 sizeof(val));
125 } 133 }
126 @else@ 134 @else@
127 @printf "unrecognized type %s for %s" $i.type $i@ 135 @printf "#error \"unrecognized type %s for %s\"" $i.type $i@
128 @end@ 136 @end@
129 break; 137 break;
130 138

Return to:

Send suggestions and report system problems to the System administrator.