Comments (3)
here is detail for the configurations:
cat redis-gmond-6379.pyconf
modules {
module {
name = "redis-gmond-6379"
language = "python"
param host { value = "127.0.0.1" }
param port { value = 6379 }
}
}
collection_group {
collect_every = 10
time_threshold = 60
metric { name = "connected_clients" }
metric { name = "connected_slaves" }
metric { name = "blocked_clients" }
metric { name = "used_memory" }
metric { name = "rdb_changes_since_last_save" }
metric { name = "rdb_bgsave_in_progress" }
metric { name = "master_sync_in_progress" }
metric { name = "master_link_status" }
metric { name = "total_connections_received" }
metric { name = "instantaneous_ops_per_sec" }
metric { name = "total_commands_processed" }
metric { name = "expired_keys" }
metric { name = "pubsub_channels" }
metric { name = "pubsub_patterns" }
metric { name = "master_last_io_seconds_ago" }
metric { name = "db0" }
}
cat redis-gmond-6380.pyconf
modules {
module {
name = "redis-gmond-6380"
language = "python"
param host { value = "127.0.0.1" }
param port { value = 6380 }
}
}
collection_group {
collect_every = 10
time_threshold = 60
metric { name = "connected_clients" }
metric { name = "connected_slaves" }
metric { name = "blocked_clients" }
metric { name = "used_memory" }
metric { name = "rdb_changes_since_last_save" }
metric { name = "rdb_bgsave_in_progress" }
metric { name = "master_sync_in_progress" }
metric { name = "master_link_status" }
metric { name = "total_connections_received" }
metric { name = "instantaneous_ops_per_sec" }
metric { name = "total_commands_processed" }
metric { name = "expired_keys" }
metric { name = "pubsub_channels" }
metric { name = "pubsub_patterns" }
metric { name = "master_last_io_seconds_ago" }
metric { name = "db0" }
}
and i copy redis-gmond.py as redis-gmond-6379.py and redis-gmond-6380.py, then i set different ports and differents group names to these py files, but dont work.
from gmond_python_modules.
Did you ever solve this?
from gmond_python_modules.
Create a soft link bewteen redis.py and redis7001.py (ln -s redis.py redis7001.py).
I change metric name,otherwise it will be overwritten.
result rrd file like this:
used_memory_7000.rrd , used_memory_7001.rrd
redis.pyconf
modules {
module {
name = "redis"
language = "python"
param host { value = "127.0.0.1" }
param port { value = 7000}
}
module {
name = "redis7001"
language = "python"
param host { value = "127.0.0.1" }
param port { value = 7001}
}
}
collection_group {
collect_every = 10
time_threshold = 60
metric {
name = "connected_clients"
}
metric {
name = "connected_slaves"
}
metric {
name = "blocked_clients"
}
metric {
name = "used_memory"
}
metric {
name = "rdb_changes_since_last_save"
}
metric {
name = "rdb_bgsave_in_progress"
}
# metric {
# name = "bgrewriteaof_in_progress"
# }
metric {
name = "total_connections_received"
}
metric {
name = "total_commands_processed"
}
metric {
name = "expired_keys"
}
metric {
name = "pubsub_channels"
}
metric {
name = "pubsub_patterns"
}
# metric {
# name = "vm_enabled"
# }
metric {
name = "master_last_io_seconds_ago"
}
}
redis.py
# ## DESCRIPTION
# Redis plugin for Ganglia that exposes most of the counters in the
# Redis `INFO` command to Ganglia for all your graphing needs. The
# metrics it comes with are pretty rudimentary but they get the job
# done.
#
# ## FILES
# ## THEME SONG
#
# The Arcade Fire - "Wake Up"
#
# ## SEE ALSO
# The Redis `INFO` command is described at <http://code.google.com/p/redis/wiki/InfoCommand>.
#
# The original blog post on this plugin is at
# <http://rcrowley.org/2010/06/24/redis-in-ganglia.html>. Gil
# Raphaelli's MySQL plugin, on which this one is based can be found at
# <http://g.raphaelli.com/2009/1/5/ganglia-mysql-metrics>.
import socket
import time
#import logging
#logging.basicConfig(level=logging.DEBUG, format="%(asctime)s - %(name)s - %(levelname)s\t Thread-%(thread)d - %(message)s", filename='/tmp/gmond.log', filemode='w')
#logging.debug('starting up')
def metric_handler(name):
# Update from Redis. Don't thrash.
if 15 < time.time() - metric_handler.timestamp:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((metric_handler.host, metric_handler.port))
if metric_handler.auth is not None:
s.send("*2\r\n$4\r\nAUTH\r\n$%d\r\n%s\r\n" % (len(metric_handler.auth), metric_handler.auth))
result = s.recv(100)
if not 'OK' in result:
return 0
s.send("*1\r\n$4\r\nINFO\r\n")
#logging.debug("sent INFO")
info = s.recv(4096)
#logging.debug("rcvd INFO")
if "$" != info[0]:
return 0
msglen = int(info[1:info.find("\n")])
if 4096 < msglen:
info += s.recv(msglen - 4096)
metric_handler.info = {}
try:
for line in info.splitlines()[1:]:
#logging.debug("line is %s done" % line)
if "" == line:
continue
if "#" == line[0]:
continue
n, v = line.split(":")
#add this line
n = n + "_" + str(metric_handler.port)
if n in metric_handler.descriptors:
if n == "master_sync_status":
v = 1 if v == 'up' else 0
if n == "db0":
v = v.split('=')[1].split(',')[0]
if n == "used_memory":
v = int(int(v) / 1000)
if n == "total_connections_received":
# first run, zero out and record total connections
if metric_handler.prev_total_connections == 0:
metric_handler.prev_total_connections = int(v)
v = 0
else:
# calculate connections per second
cps = (int(v) - metric_handler.prev_total_connections) / (time.time() - metric_handler.timestamp)
metric_handler.prev_total_connections = int(v)
v = cps
if n == "total_commands_processed":
# first run, zero out and record total commands
if metric_handler.prev_total_commands == 0:
metric_handler.prev_total_commands = int(v)
v = 0
else:
# calculate commands per second
cps = (int(v) - metric_handler.prev_total_commands) / (time.time() - metric_handler.timestamp)
metric_handler.prev_total_commands = int(v)
v = cps
#logging.debug("submittincg metric %s is %s" % (n, int(v)))
metric_handler.info[n] = int(v) # TODO Use value_type.
except Exception, e:
#logging.debug("caught exception %s" % e)
pass
s.close()
metric_handler.timestamp = time.time()
#logging.debug("returning metric_handl: %s %s %s" % (metric_handler.info.get(name, 0), metric_handler.info, metric_handler))
return metric_handler.info.get(name, 0)
def metric_init(params={}):
metric_handler.host = params.get("host", "127.0.0.1")
metric_handler.port = int(params.get("port", 6379))
metric_handler.auth = params.get("auth", None)
metric_handler.timestamp = 0
metric_handler.prev_total_commands = 0
metric_handler.prev_total_connections = 0
metrics = {
"connected_clients": {"units": "clients"},
"connected_slaves": {"units": "slaves"},
"blocked_clients": {"units": "clients"},
"used_memory": {"units": "KB"},
"rdb_changes_since_last_save": {"units": "changes"},
"rdb_bgsave_in_progress": {"units": "yes/no"},
"master_sync_in_progress": {"units": "yes/no"},
"master_link_status": {"units": "yes/no"},
#"aof_bgrewriteaof_in_progress": {"units": "yes/no"},
"total_connections_received": {"units": "connections/sec"},
"instantaneous_ops_per_sec": {"units": "ops"},
"total_commands_processed": {"units": "commands/sec"},
"expired_keys": {"units": "keys"},
"pubsub_channels": {"units": "channels"},
"pubsub_patterns": {"units": "patterns"},
#"vm_enabled": {"units": "yes/no"},
"master_last_io_seconds_ago": {"units": "seconds ago"},
"db0": {"units": "keys"},
}
metric_handler.descriptors = {}
for name, updates in metrics.iteritems():
#add this line
name = name + "_" + str(metric_handler.port)
descriptor = {
"name": name,
"call_back": metric_handler,
"time_max": 90,
"value_type": "int",
"units": "",
"slope": "both",
"format": "%d",
"description": "http://code.google.com/p/redis/wiki/InfoCommand",
#modify this line
"groups": "redis_" + str(metric_handler.port),
}
descriptor.update(updates)
metric_handler.descriptors[name] = descriptor
return metric_handler.descriptors.values()
def metric_cleanup():
pass
from gmond_python_modules.
Related Issues (20)
- [PYTHON] Can't find the metric_init function in the python module [varnish].
- The GPU Nvidia module's documentation should make clear what do with the patch file HOT 3
- Outstanding ipmi pull requests
- mysqld python module have error "Can't call the metric_init function in the python module"
- GPU custom graphs dont work with default installation in CentOS 6 HOT 2
- How to add metrics to Ganglia
- i can't monitor my infiniband network HOT 2
- User of sudo within python plugins in Ganglia
- Unsupported NVML Commands
- cpu_temp: wrong directory
- Can't call the metric handler function for... HOT 6
- [Ganglia restart extended metrics data lost]
- ipmi.py sends ipmi metrics with forward-slash in their names HOT 1
- Support for aggregate GPU usage statistics
- How to monitor AMD GPUs ?
- No support for 64bit counters? HOT 2
- Migrate LGTM.com installation from OAuth to GitHub App
- json button return numbers not json data format for the graph
- Proposing a PR to fix a few small typos
- inconsistence between nvidia.py and nvidia-ml-py-3.295.00 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gmond_python_modules.