MySQL Host Template -- Updated on 2006-08-10
Moderators: Developers, Moderators
-
- Posts: 17
- Joined: Wed Jul 12, 2006 11:25 pm
-
- Posts: 17
- Joined: Wed Jul 12, 2006 11:25 pm
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:
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.
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
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.
Re: Username/Password Woes
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:
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.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";
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?
-
- Posts: 11
- Joined: Thu Jul 05, 2007 8:14 pm
Everything works except graphs show no data
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
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
Re: Everything works except graphs show no data
Same problem here. Everything looking good at logs and i can get data manually by running mysql_stats.php.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
Some version info below.
Cacti: 0.8.6j
PHP: 5.2.3-1+b1 + eAccelerator
MySQL: 5.0.45-Debian_1
Re: Username/Password Woes
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?
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.png (31.58 KiB) Viewed 12628 times
-
- Used swap
- swapused.png (24.47 KiB) Viewed 12628 times
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?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
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
- gandalf
- Developer
- Posts: 22383
- Joined: Thu Dec 02, 2004 2:46 am
- Location: Muenster, Germany
- Contact:
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
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
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.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.
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
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!
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!
Not very familiar with MySQL. I probably know just enough to get dangerous. I think I just missed something obvious. Can someone help?philovivero wrote: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?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 ?
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?
Who is online
Users browsing this forum: No registered users and 0 guests