memcached Host Template and Graphs (ver 1.0)

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

anson
Posts: 2
Joined: Mon Feb 12, 2007 7:44 pm

Post by anson »

TECK wrote:nohau, this is very easy.
Simply create a new python_11212.py file and edit there the lines:

Code: Select all

parser.set_defaults(port = "11211")
parser.add_option("-p", "--port", dest="port", metavar="PORT",
                  help="default memcached port [default: 11211]")
Replace the port with your specific value.
Then, point your cacti template path to the new file you just created. Simple, eh? :)
so if i have a host that is running 3 instances (11211,11212,11213) and if i created 2 more xxx.py files and edited the port, how does this solve the graphing? as the graph template looks at the data template and its looking at a ceretain data input method, wouldnt the be global if i pointed the data template to a new data input? i edited the template with a line telling me which port, but each time i import, the templates get over written. is there way for the template not to get over written each time i try to upload a modified memcache template?
gustavosoares
Posts: 5
Joined: Wed Sep 12, 2007 4:34 pm

Post by gustavosoares »

any solution for this problem???

Cherrs,
Gus
beemoo
Posts: 4
Joined: Thu Nov 01, 2007 2:05 pm

Client API won't install

Post by beemoo »

Followed the instructions for installing the client API and I get:

Traceback (most recent call last):
File "setup.py", line 3, in ?
from setuptools import setup
ImportError: No module named setuptools

What am I missing? Trying to install on Centos 4.5 with python 2.3.4.
beemoo
Posts: 4
Joined: Thu Nov 01, 2007 2:05 pm

Post by beemoo »

Nevermind. Found a copy of the setuptool and installed. Installation of the client API works now.
simishag
Posts: 4
Joined: Sat Dec 17, 2005 9:14 pm

xml import screws with RRA settings

Post by simishag »

I love the script and the graphs, but I'd like to point out a major annoyance with the setup procedure. This is perhaps a Cacti problem rather than a problem with this script but I thought I'd point it out anyway.

The XML import file (cacti_memcached_host_template.xml) includes RRA settings which Cacti blithely imports. These are GLOBAL settings and a single data query should not be messing around with them. I had to go back and fix this after the import.
johnnysoj
Posts: 3
Joined: Tue Feb 07, 2006 1:58 pm

usage on multiple ports

Post by johnnysoj »

I was wondering if anyone can assist with this.
I'm going to ask a question that appeared to be answered above, but the above answer doesn't quite work:

I have multiple memcache instances running on different ports, and I would like to monitor these different ports.

The problem is that I can't add modify the xml templates to include these different ports.
I tried modifiying the cacti template, changing all of the name and title fields to include the port number (so they would be unique)

but when I import the individual xml files, they overwrite each other, and I'm only left with one single data template (usually the last one i import)

So, I thought that if I modified the hash_ xml fields, replacing hash_ with hash_port again, to make them unique across all the xml templates that it would fix it. No such luck, in fact it won't even load the xml.

so, how can I fix this? Ideally I would love to be able to add the memcache data element multiple times to my custom device template, and pass a port value to them, but I'm willing to do whatever is neccesary to get this to work.

thanks in advance!
miltonsp
Posts: 1
Joined: Thu Apr 03, 2008 1:56 pm

usage on multiple ports

Post by miltonsp »

When displaying memcache graphs for multiple ports and multiple servers, did you also try adding the multiple Graph Templates ( each for a different port) in the Host Template. Do this in the 'console' tab and under 'Associated Graph Templates' ...
islandsound
Posts: 5
Joined: Tue Apr 08, 2008 3:12 pm

Post by islandsound »

what you said makes no sense. i am trying to look for what you are talking about. did your suggestion work for you?
victormilk2002
Posts: 8
Joined: Sun Mar 16, 2008 9:20 pm

Abnormal memcached graph result

Post by victormilk2002 »

Hi all,

I had imported the memcached template, everything seemed fine. All the graphs could show successfully.

However, I found an unexpected behaviour. Please refer to the attached photo.

My question is: if the memcahced get is larger than set, why memcached write is greater than read? the ratio is extremely abnormal> 16M : 800k, how come???

Can anyone help me explain this situation??? Thanks


Victor
Attachments
memcached
memcached
memcached.JPG (75.69 KiB) Viewed 11832 times
victormilk2002
Posts: 8
Joined: Sun Mar 16, 2008 9:20 pm

Memcached is correct

Post by victormilk2002 »

Hi all,


According to the defintion,

http://code.sixapart.com/svn/memcached/ ... otocol.txt


bytes_read > Total number of bytes read by this server from network

bytes_written > Total number of bytes sent by this server to network


If it is the case, we achieve our purpose. The memcached is correct, thanks.
redstar2k
Posts: 1
Joined: Mon May 19, 2008 6:18 am

Post by redstar2k »

I have some hosts running memcached on socket. Is there any way I can use this script trough snmp and get the data? I tryed to modify the script to connect over the socket but with no luck.
nightwisher
Posts: 12
Joined: Fri Sep 05, 2008 9:14 am
Location: Bosnia
Contact:

Post by nightwisher »

I also try and read this thread and i installed this script and all things done good but i see empty graphs and all are nan !
mrc5
Posts: 2
Joined: Tue Oct 21, 2008 7:09 am

Post by mrc5 »

anson wrote:
TECK wrote:nohau, this is very easy.
Simply create a new python_11212.py file and edit there the lines:

Code: Select all

parser.set_defaults(port = "11211")
parser.add_option("-p", "--port", dest="port", metavar="PORT",
                  help="default memcached port [default: 11211]")
Replace the port with your specific value.
Then, point your cacti template path to the new file you just created. Simple, eh? :)
so if i have a host that is running 3 instances (11211,11212,11213) and if i created 2 more xxx.py files and edited the port, how does this solve the graphing? as the graph template looks at the data template and its looking at a ceretain data input method, wouldnt the be global if i pointed the data template to a new data input? i edited the template with a line telling me which port, but each time i import, the templates get over written. is there way for the template not to get over written each time i try to upload a modified memcache template?
I have same problem. I need monitoring 3 instances. I create Data Input Methods, Data Templates and Graph Templates but not working.

Any ideia??

Thanks!!
User avatar
andqt
Posts: 15
Joined: Wed Aug 27, 2008 9:52 pm
Contact:

Post by andqt »

Does anyone have solution for graphing multiple instance of memcached daemons running on the same server with different ports? I need to monitor 5 instants of memcached daemon on one server.

With much appreciate,

--andqt--
portante
Posts: 3
Joined: Fri Jan 23, 2009 4:24 pm

Small modification memcached.py to work with fuelpump

Post by portante »

"total_items" is not in the response from fuelpump, this takes care of that by defaulting to values to zero.

Code: Select all

#!/usr/bin/python

import sys
import memcache
from optparse import OptionParser

stats = {'total_items': 0, 'bytes_written': 0, 'uptime': 0, 'bytes': 0, 
         'cmd_get': 0, 'curr_items': 0, 'curr_connections': 0, 'connection_structures': 0, 
         'limit_maxbytes': 0, 'rusage_user': 0.0, 'total_connections': 0, 'cmd_set': 0, 
         'time': 0, 'get_misses': 0, 'bytes_read': 0, 'rusage_system': 0.0, 'get_hits': 0}

parser = OptionParser(usage="usage: %prog [-h] [-p PORT] HOSTNAME1 HOSTNAME2 ...\nTotals will be returned for multiple HOSTNAME arguments.")
parser.set_defaults(port = "11211")
parser.add_option("-p", "--port", dest="port", metavar="PORT",
                  help="default memcached port [default: 11211]")
(options, args) = parser.parse_args()

hosts = []
if (args):
    for host in args:
        hosts.append("%s:%s" % (host, options.port));
else:
    parser.error("At least one HOSTNAME is required.")
    sys.exit(1)

mc = memcache.Client(hosts, debug=0)
mem_stats = mc.get_stats()

if (not mem_stats):
	sys.exit()

if (len(mem_stats) > 1):
    for mstat in mem_stats:
        for key, val in stats.iteritems():
            if (key == 'rusage_user' or key == 'rusage_system'):
                stats[key] += float(mstat[1][key])
            else:
                stats[key] += int(mstat[1].get(key,0))
                
else:
    mstat = mem_stats[0][1];
    for key, val in stats.iteritems():
        if (key == 'rusage_user' or key == 'rusage_system'):
            stats[key] = float(mstat[key])
        else:
            stats[key] = int(mstat.get(key,0))
            
for stat, count in stats.iteritems():
    print "%s:%s" % (stat, count),
[/code]
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests