Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
resmon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mirrors
resmon
Commits
4c4d8089
Commit
4c4d8089
authored
12 years ago
by
Mark Harrison
Browse files
Options
Downloads
Plain Diff
Merge pull request #22 from dafyddcrosby/add_membase_module
Module for Membase
parents
f5eecec5
41f5c9d6
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/Core/Membase.pm
+101
-0
101 additions, 0 deletions
lib/Core/Membase.pm
with
101 additions
and
0 deletions
lib/Core/Membase.pm
0 → 100644
+
101
−
0
View file @
4c4d8089
package
Core::
Membase
;
use
strict
;
use
warnings
;
use
base
'
Resmon::Module
';
use
Resmon::
ExtComm
qw(run_command)
;
=pod
=head1 NAME
Core::Membase - A resmon module for gathering Membase statistics
=head1 SYNOPSIS
Core::Membase {
127.0.0.1: user => foo, pass => bar
}
=head1 DESCRIPTION
This module gathers Membase statistics
=head1 CONFIGURATION
=over
=item check_name
The IP or FQDN of the Membase server.
=item mbstats
The location of the mbstats command. Defaults to /opt/membase/bin/mbstats.
=item port
The port that the target service listens on. This defaults to 11210.
=item user
The username to connect with.
=item pass
The password to connect with.
=back
=head1 METRICS
This check returns a significant number of metrics. See the following for
explanations:
https://github.com/membase/ep-engine/blob/master/docs/stats.org
=cut
sub
handler
{
my
$self
=
shift
;
my
$config
=
$self
->
{'
config
'};
my
$host
=
$self
->
{'
check_name
'};
my
$port
=
$config
->
{'
port
'}
||
"
11210
";
my
$user
=
$config
->
{'
user
'}
||
"";
my
$pass
=
$config
->
{'
pass
'}
||
"";
my
$mbstats
=
$config
->
{'
mbstats
'}
||
"
/opt/membase/bin/mbstats
";
my
$mbstats_path
=
"
$mbstats
-a
$host
:
$port
all
$user
$pass
";
my
$output
=
run_command
(
$mbstats_path
);
chomp
$output
;
my
@arr
=
split
("
\n
",
$output
);
my
$line
;
my
$bucket
=
"";
my
$get_name
=
0
;
my
%metrics
;
foreach
$line
(
@arr
)
{
if
(
$line
=~
/\*/
)
{
$get_name
=
1
;
next
;
}
if
(
$get_name
==
1
)
{
$line
=~
s/\s+//
;
$bucket
=
$line
;
$get_name
=
0
;
next
;
}
if
(
$line
ne
"")
{
$line
=~
s/\s+//g
;
my
(
$key
,
$val
)
=
split
("
:
",
$line
);
$metrics
{"
$bucket
|
$key
"}
=
$val
;
}
}
return
\
%metrics
};
1
;
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment