KSriHarsha591 / mysql-cacti-templates

Automatically exported from code.google.com/p/mysql-cacti-templates
GNU General Public License v2.0
0 stars 0 forks source link

cmd.php hex result and using snmp_community makes life easier #204

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hello,

1. I also ran into the problem using poller.php.  lib/poller.php, function 
process_poller_output() - is_hexadecimal($value)... matches several output 
items from the cacti templates.  The means output in the form "aa:00 ff:99" 
gets turned into a single number and the rrd files aren't updated and you get 
several "ERROR: Not enough arguments" in your log files.  I fixed by modifying 
lib/poller.php by adding a check for ':', which isn't ideal but it works now.
"}elseif (is_hexadecimal($value) && strpos($value, ':') === false) {"

Please change the reference letters to fix this so hex isn't triggered.

2. Made it easier to add multiple databases if the database is setup as a whole 
device in cacti.
Modified ss_get_mysql_stats.php so that it accepted an option of "--supp 
<snmp_community>", the script has:

if (isset($result['supp']))
{
  list($result['user'], $result['pass'], $result['port']) = explode(':', $result['supp'], 3);
}

I can then simply put <username>:<password>:<port> in the snmp community string 
to pass this information in, which is much easier than the other methods 
available. (make sure your string is still snmp compatible or cacti won't pass 
it through [no special chars])

Hope this helps someone else.

Original issue reported on code.google.com by gra...@graemessb.com on 6 Dec 2011 at 12:31

GoogleCodeExporter commented 8 years ago
that point #2 is great!

Original comment by bobbypow...@gmail.com on 14 Feb 2012 at 7:44

GoogleCodeExporter commented 8 years ago

If you want more detail on what else I needed to do to make #2 work, let me 
know.

Original comment by gra...@graemessb.com on 15 Feb 2012 at 12:03

GoogleCodeExporter commented 8 years ago
Yep, #1 is a bug in Poller.php which I've just spent a day tracking down too.

Original comment by da...@edmonston.co.uk on 17 Feb 2012 at 11:09

GoogleCodeExporter commented 8 years ago
The bug isn't in poller.php, the bug is that the mysql-cacti-templates use 
<hex>:<num>, where they should shift all the reference letters to above letter 
f so that it doesn't trigger hex.

So changing "aa:13 ff:98" to "gh:13 uy:98" (or something like that) and the hex 
functions won't be triggered. All the other plugins I have work perfectly for 
cacti's poller.php.  Only this mysql plugin doesn't play nicely.  Other plugins 
need poller.php to pickup on hex numbers fed back and convert them into nice 
numbers for the rrd files.

Original comment by gra...@graemessb.com on 18 Feb 2012 at 3:46

GoogleCodeExporter commented 8 years ago
This discussion really ought to go onto the mailing list.

Original comment by baron.schwartz on 18 Feb 2012 at 3:52

GoogleCodeExporter commented 8 years ago
The output should be parsed properly to take account of the label and the 
value. Guessing the format including the label is daft.   It's poor form to 
make the input parameters able to break the processing without any exceptions. 

Original comment by da...@edmonston.co.uk on 18 Feb 2012 at 3:59

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
The output it parsed properly, cacti makes the rules for how poller.php should 
behave towards hex numbers.  Plugins should comply with how cacti wants to 
interpret things.

Cacti wants to interpret values like "aa:12" as a valid hex number, which is 
valid if you only have one value coming back.  So that's what it is doing.  The 
problem is that the mysql templates don't take this into account and produce 
hex output, which poller doesn't expect.

We fix it by modifying poller just because it's easier than modifying the 100's 
of mysql var:value pairs.  It would be nice if that was changed officially in 
the templates for the next time I need to update cacti and for the next person 
who has trouble once they add this template.

Original comment by gra...@graemessb.com on 18 Feb 2012 at 4:10

GoogleCodeExporter commented 8 years ago
This is a Cacti bug, not a bug in the templates. End of story. See 
http://bugs.cacti.net/view.php?id=2063

And from the changelog: "bug#0002063: Multiple value poller output incorrectly 
interpreted as hexadecimal value"

Please consider this discussion closed.

Original comment by baron.schwartz on 18 Feb 2012 at 5:05

GoogleCodeExporter commented 8 years ago
Okay,

Let me know what you think of idea 2 using the snmp string for 
username:password:port.

Original comment by gra...@graemessb.com on 18 Feb 2012 at 8:23

GoogleCodeExporter commented 8 years ago
I've actually done a similar thing, but used "hostname" (cacti device) to 
sanitize the mysql_connect string... Why would you use snmp string to do this ? 
 Because you don't use snmp polls probably ?

I'm also in the process of changing spine poller to extract "host" from device 
names like 'user@host:port", that way avoiding the need for multiple cacti 
devices to monitor one physical host's services... 

grtz,
gert

Original comment by gert.van...@gmail.com on 22 Feb 2012 at 8:13

GoogleCodeExporter commented 8 years ago
Hi Gert,

From what I recall (when setting it up a while ago), can't find the 
documentation now.  There are a few methods for setting up a username and 
password, most are by modifying files, or duplicating files and setting up new 
collection methods.  The easiest way for my setup that I could find to pass 
through different usernames and passwords for different mysql instances was to 
use the snmp string (which is one of the only strings you can specify).  I can 
now setup 50 different mysql "devices"/instances to be monitored in seconds, 
without resorting to customizing/duplicating anything on the command line.

Graeme

Original comment by gra...@graemessb.com on 22 Feb 2012 at 10:58