ss_get_by_ssh.php MongoDB mongodb_parse() bug

Bug #1087073 reported by Nicolas Salvo
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona Monitoring Plugins
Fix Released
Medium
Unassigned

Bug Description

Hi, there's a bug in the mongodb_parse() function when parsing the output of serverStatus for operation counters on secondary members of replicaset.

The function is doing a regexp for lines that have insert, query, etc

   preg_match('/"insert" : ([0-9]+)/', $output, $matches);
   $result["MONGODB_op_inserts"] = $matches[1];
   preg_match('/"query" : ([0-9]+)/', $output, $matches);
   $result["MONGODB_op_queries"] = $matches[1];
   preg_match('/"update" : ([0-9]+)/', $output, $matches);
   $result["MONGODB_op_updates"] = $matches[1];
   preg_match('/"delete" : ([0-9]+)/', $output, $matches);
   $result["MONGODB_op_deletes"] = $matches[1];
   preg_match('/"getmore" : ([0-9]+)/', $output, $matches);
   $result["MONGODB_op_getmores"] = $matches[1];
   preg_match('/"command" : ([0-9]+)/', $output, $matches);
   $result["MONGODB_op_commands"] = $matches[1];

but, when serverStatus is run on secondaries, the server return counters for local operations and replicated operations, like:

        "opcountersRepl" : {
                "insert" : 22090596,
                "query" : 0,
                "update" : 10367,
                "delete" : 16203779,
                "getmore" : 0,
                "command" : 0
        },
        "opcounters" : {
                "insert" : 235953,
                "query" : 2550653,
                "update" : 149610,
                "delete" : 315,
                "getmore" : 827697,
                "command" : 53630196
        },

and only the replicated operations are beign parsed because they are the first match.

In our case, this is not what we want, because we have the replicaset configured to read from secondaries and write to primary, and we can't see queries (reads) on the secondary because how the parser is implemented.

One solution could be another graph for replicated operations.

Sorry for my english :), thanks!

Tags: cacti mongodb
tags: added: mongodb
tags: added: cacti
Changed in percona-monitoring-plugins:
status: New → In Progress
importance: Undecided → Medium
milestone: none → 1.0.4
Changed in percona-monitoring-plugins:
status: In Progress → Fix Committed
Changed in percona-monitoring-plugins:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.