MySQL Host Template -- Updated on 2006-08-10

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

Moderators: Developers, Moderators

Post Reply
MaffooClock
Posts: 17
Joined: Wed Jul 12, 2006 11:25 pm

Post by MaffooClock »

I hope I didn't miss a post on this same issue...

I've found that it takes well over 10 minutes to import the cacti_host_template_temysql_host-step300-heartbeat600.xml file (I had to temporarily increase the max_execution_time to more than 600 seconds). Is this normal?
MaffooClock
Posts: 17
Joined: Wed Jul 12, 2006 11:25 pm

Post by MaffooClock »

Just an observation:

I was having blank graphs, and I couldn't figure out why. I got sidetracked when I found other issues with Cacti (even found a bug!), and now I finally got back to this.

I was getting the following error:

Code: Select all

03/15/2007 08:41:33 AM - CMDPHP: Poller[0] Host[19] DS[367] WARNING: Result from CMD not valid. Partial Result: Error: MySQL connect
Long story short: the account that was configured for SUPER and PROCESS permissions had a password with special characters (I always use bad-ass passwords), and evedently the PHP process was mis-interpreting the double-dollar signs inside the password, causing the mysql_stats.php script to fail. When I changed the password of the account to one much simpler, the script works fine.

My point: complex passwords may cause the script to fail. You may be able to surround the <password> with single quotes in the Input String of the Input Method, but I did not try that.
sscott
Posts: 3
Joined: Tue Jul 03, 2007 11:43 am

Re: Username/Password Woes

Post by sscott »

The easiest way is only set the variable to the default if no argument was passed. That way you can have a global default but still be able to overide individual graphs if need be....

Code: Select all

if ($_SERVER["argc"] == 5 || ($_SERVER["argv"][1] == "status" && $_SERVER["argc"] == 6)) {

    $host     = isset($_SERVER["argv"][2])  ? $_SERVER["argv"][2]  : 'localhost';
    $username = isset($_SERVER["argv"][3])  ? $_SERVER["argv"][3]  : 'cactiuser';
    $password = isset($_SERVER["argv"][4])  ? $_SERVER["argv"][4]  : 'cactipassword';
philovivero wrote:It seems the username/password support in Cacti is causing others woes. Believe me, it caused me woes, too.

Another work-around is to not enter any username/password at all, make no changes to the XML files (as Gleam suggests), but instead to modify the PHP stats gathering script like this:

Code: Select all

if ($_SERVER["argc"] == 3 || $_SERVER["argc"] == 5 || ($_SERVER["argv"][1] == "status" && $_SERVER["argc"] == 6)) {

    $host     = $_SERVER["argv"][2];
    $username = $_SERVER["argv"][3];
    $password = $_SERVER["argv"][4];

    $username = "cacti";
    $password = "yourcactipassword";
What this'll do is let a 3-argument call succeed, then it'll just hardcode username/password to be cacti/yourcactipassword. This is actually what I'm doing at Digg now because I started using a browser !Firefox, and it wouldn't let me enter the username/password so easily anymore.

It'd be super-cool if some PHP guru could suggest how to elegently make the script take "--username=XXX --password=XXX --host=XXX" sort of calling convention. If I ever have to digg into this too much, I'll just rewrite it in Perl. :)

Hmm. The more I ponder this, the more I think I should just make this the default script behaviour. Anyone have opinions on this matter?
windowsrefund
Posts: 11
Joined: Thu Jul 05, 2007 8:14 pm

Everything works except graphs show no data

Post by windowsrefund »

Everything installed as per the docs. Database permissions are fine and I've verified using mysql_stats.php from a shell.

Everything is good with the exception of the graphs not showing any data. Any ideas? Perhaps I'm just not waiting long enough? It's been about 20 minutes already.

Thanks
lucky
Cacti User
Posts: 62
Joined: Mon Sep 30, 2002 3:23 am
Location: Germany

Post by lucky »

great work.
it works!

i would like to monitor the response time (for INSERT, SELECT, DELETE and UPDATE) of a database at my provider. i've there only one database and have no supersuser privileges on the database server.

is ist possible with some modification on this script?

THX
User avatar
sumsum
Cacti User
Posts: 68
Joined: Mon Apr 26, 2004 7:18 am
Location: Switzerland
Contact:

Post by sumsum »

the template is amazing. thank you. works fine here.
the only thing which is missing (maybe as a enhancement request)

- vertical legend of the units is missing sometimes
- general legend on the bottom of each graph would be helpfull.
http://www.lounge-radio.com/
khoch3
Posts: 10
Joined: Tue Aug 07, 2007 10:18 am

Post by khoch3 »

I am seeing the same problem, did you ever fix this? Thanks!
User avatar
FoggeR
Posts: 2
Joined: Sat Aug 11, 2007 1:06 pm
Location: Finland
Contact:

Re: Everything works except graphs show no data

Post by FoggeR »

windowsrefund wrote:Everything installed as per the docs. Database permissions are fine and I've verified using mysql_stats.php from a shell.

Everything is good with the exception of the graphs not showing any data. Any ideas? Perhaps I'm just not waiting long enough? It's been about 20 minutes already.

Thanks
Same problem here. Everything looking good at logs and i can get data manually by running mysql_stats.php.

Some version info below.
Cacti: 0.8.6j
PHP: 5.2.3-1+b1 + eAccelerator
MySQL: 5.0.45-Debian_1
User avatar
knebb
Cacti User
Posts: 138
Joined: Tue Sep 19, 2006 11:29 am

Re: Username/Password Woes

Post by knebb »

Yohoo!

On my site it's working really fine. Except one think I realized today:

Since I'm logging my MySQL database, my server is swapping a lot. Lets have a look at this graph. The first is the swap usage the second is the swap activity of this server. You can see a hughe raising between week 30 and 31. If you like I can post an image of the MySQL stuff as well, but you will see it starts at the same day when the swapping occurs.

The only think I can explain would be the fact that this is a lightly used server. So perhaps the MySQL has been in swap and never used. Now the only usage is from the script and this causes the MySQL part being swapped out and in....
Are theses statistic scripts are being suspect to this behavior? What else could it be?
Attachments
Swap activities
Swap activities
swap.png (31.58 KiB) Viewed 12590 times
Used swap
Used swap
swapused.png (24.47 KiB) Viewed 12590 times
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

I suppose that you memory settings for mysql are to huge for the physical memory ogf your server. You may have to tune them to avoid swapping
Reinhard
User avatar
knebb
Cacti User
Posts: 138
Joined: Tue Sep 19, 2006 11:29 am

Post by knebb »

gandalf wrote:I suppose that you memory settings for mysql are to huge for the physical memory ogf your server. You may have to tune them to avoid swapping
Obviously, you can be right. But this means that the cacti stuff itself causes a higher load on the MySQL server- I expected the scripts only collect some statistics, but not to do some deep digging into the databases itself. On this lightly used server it isn't really an issue. But what would happen to a MySQL server with a high load?

The other point of view about your posting could mean: There is enough memory available to this server (because it's not swapping at all before I implemented the scripts).

So how is this cacti stuff realized to cause such a change in behavior?

Greets from Canada
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Please clarify, what applications are running on that server. Is cacti itself running there? The MySQL stats use MySQL variables only. Fetching them should be very fast.
But if the memory settings for mysql exceed the physical size to the system, mysql will perhaps try to get that amount of memory even if it is not physicaly backed and thus creating swap activity.
You may want to use mysql-admin or phpmyadmin to find hints related to performnace
Reinhard
User avatar
knebb
Cacti User
Posts: 138
Joined: Tue Sep 19, 2006 11:29 am

Post by knebb »

gandalf wrote:Please clarify, what applications are running on that server. Is cacti itself running there? The MySQL stats use MySQL variables only. Fetching them should be very fast.
I expected this, too. But in this case it looks like the mysql daemon is normaly sleeping. So fetching the variables wakes him up and pushes him back to memory....I dunno.
There ist running a postfix (with approx 100 mails/ day), an apache2 (with approx 20 visitors/day) and the mysql itself. So really light use. 1.5GB memory should be enough. And has been all the time before.

As a workaround I set the vm.swappiness in /etc/sysctl to 30 instead of 60. This helped out. Now the system is back to usual business ;)
Primüs
Posts: 10
Joined: Wed Oct 10, 2007 8:05 pm

Post by Primüs »

HELP!

I have installed this script on one machine at home, using the poller.php interval every 5 minutes, ran the script used the .xml files with the changes in the filename, and thats graphing fine, but our production cacti here at work when i install it the exact same way, i get the graphs, devices list show it as up, i cant get any data INTO the graphs. This sounded like to me that im not using the special .xml templates for 5 min intervals but i definately am!

Any help appreciated!
khufure
Cacti User
Posts: 203
Joined: Wed Oct 24, 2007 5:47 pm
Location: San Francisco, CA
Contact:

Post by khufure »

philovivero wrote:
adrianmarsh wrote:Ok, so I've got these running, but a few no-shows: InnoDB BufPgMem, I/O, InsBuffer and "No data found" in Query Cache and Replication.

I guess that my main problem is that I'm a MySql novice, so I don't really know what the stats are showing me. Anyone have a cheat-sheet/guide ?
Did you do the GRANTs from the README? As for the no data found, are you using the Query Cache and is the machine you're pointing to a replication slave?
Not very familiar with MySQL. I probably know just enough to get dangerous. I think I just missed something obvious. Can someone help?

I am running into the same INNODB problem. Here is the grants I used:
GRANT PROCESS ON *.* TO cacti@'%' IDENTIFIED by 'cactipasswd';
GRANT SUPER ON *.* TO cacti@'%' IDENTIFIED BY 'cactipasswd';

I then did a flush privileges;

# mysql -h 10.200.0.5 -u cacti -pcactipasswd
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5908 to server version: 5.0.45-community-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| test |
+--------------------+
2 rows in set (0.00 sec)

It seems cacti doesn't have access to mysql database. Should it?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest