The MySQL Graph Collection - Version 2.0!

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

Moderators: Developers, Moderators

Post Reply
ottob
Cacti User
Posts: 51
Joined: Tue Apr 27, 2004 11:43 am
Location: Duesseldorf, Germany
Contact:

The MySQL Graph Collection - Version 2.0!

Post by ottob »

Hi,
Scott is maintaining these scripts now here: "The MySQL Graph Collection - Version 2.0.1!"
Please don't use this topic anymore. Many thanks! Otto



Hi all out there,

its time for an upgrade of the mysql-graph collection. Read the README file inside the zip-archive for more information.

changelog:
- added MySQL traffic graph
- only one php-script file for easier upgrades
- improved colors
- fixes some issues due php installation etc.

have fun!

otto
Attachments
screenshots
screenshots
mysql_stats.gif (71.22 KiB) Viewed 145677 times
mysql_stats.zip
contains all files needed
(24.72 KiB) Downloaded 22220 times
Last edited by ottob on Wed Apr 06, 2011 3:00 pm, edited 1 time in total.
User avatar
fmangeant
Cacti Guru User
Posts: 2345
Joined: Fri Sep 19, 2003 8:36 am
Location: Sophia-Antipolis, France
Contact:

Post by fmangeant »

Many many thanks :D

I've just modified the data templates to check "Use Per-Data Source Value" for "Database Host", allowing me to graph my local MySQL server on 127.0.0.1

Regards,

Frédéric
[size=84]
[color=green]HOWTOs[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15353]Install and configure the Net-SNMP agent for Unix[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=26151]Install and configure the Net-SNMP agent for Windows[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=28175]Graph multiple servers using an SNMP proxy[/url][/list]
[color=green]Templates[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15412]Multiple CPU usage for Linux[/url]
[*][url=http://forums.cacti.net/viewtopic.php?p=125152]Memory & swap usage for Unix[/url][/list][/size]
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

Looks like a great script, but I'm getting an error:

C:\>php -q c:\www\cacti\scripts\mysql_stats.php localhost cactiuser@localhost cactipw Connections
Error: MySQL connect failed. Check MySQL parameters (host/login/password)

I've tried several combos of the cactiuser@localhost, my computer name, IP addy, etc. all which don't work.

I've granted cactiuser PROCESS rights via phpmyadmin

What am I missing?
ottob
Cacti User
Posts: 51
Joined: Tue Apr 27, 2004 11:43 am
Location: Duesseldorf, Germany
Contact:

Post by ottob »

Hi,

try to use only "cactiuser" (not "cactiuser@localhost") as database user...
in any case there must be a problem with the mysql-rights.

otto
User avatar
fmangeant
Cacti Guru User
Posts: 2345
Joined: Fri Sep 19, 2003 8:36 am
Location: Sophia-Antipolis, France
Contact:

Post by fmangeant »

Hi

by default (at least on my Gentoo Linux installation) MySQL binds to localhost only ; I have this in /etc/mysql/my.cnf :

Code: Select all

# keep secure by default!
bind-address    = 127.0.0.1
Have you tried to query your loopback IP address ?
[size=84]
[color=green]HOWTOs[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15353]Install and configure the Net-SNMP agent for Unix[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=26151]Install and configure the Net-SNMP agent for Windows[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=28175]Graph multiple servers using an SNMP proxy[/url][/list]
[color=green]Templates[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15412]Multiple CPU usage for Linux[/url]
[*][url=http://forums.cacti.net/viewtopic.php?p=125152]Memory & swap usage for Unix[/url][/list][/size]
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

ottob wrote:try to use only "cactiuser" (not "cactiuser@localhost") as database user... in any case there must be a problem with the mysql-rights.
otto
I've tried that too with the same result.

How else can I check the rights? Wouldn't Phpmyadmin work?
ottob
Cacti User
Posts: 51
Joined: Tue Apr 27, 2004 11:43 am
Location: Duesseldorf, Germany
Contact:

Post by ottob »

hi,

phpmyadmin is no problem, but after setting the rights in the mysql tables you must use the mysql-command "flush privileges;" or restart the server to apply the right changes...

have you used the "grant" command as described in the readme, or the phpmyadmin built-in right functions?

please post the cactiuser entry in your mysql.user table...
pbulteel
Cacti User
Posts: 150
Joined: Fri Sep 05, 2003 9:20 am
Location: London
Contact:

Post by pbulteel »

I had the same problem... if I ran it with 127.0.0.1 it failed, but when I ran it with localhost it passed.

I think you need to set the permissions in mysql to be user@'localhost' and another one with user@'127.0.0.1' for it to work... since it probably depends on the Host name you are monitoring.

-P
uname -a
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

Image

That is what phpmyadmin shows. Is there something missing for cactiuser?

This is what I got when I tried the grant thing on my cacti/mysql machine:

Code: Select all

mysql> GRANT PROCESS ON * TO cactiuser@'localhost' IDENTIFIED by 'cactipw';
ERROR 1045: Access denied for user: '@localhost' (Using password: NO)
mysql> GRANT PROCESS ON * TO cactiuser' IDENTIFIED by 'cactipw';
    '>
    '>
    '> ?
    '> help
    '> exit
    '> Aborted
What the heck is with the '> prompt where I can't seemingly do anything?
User avatar
fmangeant
Cacti Guru User
Posts: 2345
Joined: Fri Sep 19, 2003 8:36 am
Location: Sophia-Antipolis, France
Contact:

Post by fmangeant »

Here are the installation instructions (http://www.cacti.net/downloads/docs/htm ... _unix.html) :

Code: Select all

shell> mysql --user=root mysql
mysql> GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'somepassword';
mysql> flush privileges;
Could you try to rerun these commands ?
[size=84]
[color=green]HOWTOs[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15353]Install and configure the Net-SNMP agent for Unix[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=26151]Install and configure the Net-SNMP agent for Windows[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=28175]Graph multiple servers using an SNMP proxy[/url][/list]
[color=green]Templates[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15412]Multiple CPU usage for Linux[/url]
[*][url=http://forums.cacti.net/viewtopic.php?p=125152]Memory & swap usage for Unix[/url][/list][/size]
pbulteel
Cacti User
Posts: 150
Joined: Fri Sep 05, 2003 9:20 am
Location: London
Contact:

Post by pbulteel »

BSOD2600 wrote:
This is what I got when I tried the grant thing on my cacti/mysql machine:

Code: Select all

mysql> GRANT PROCESS ON * TO cactiuser@'localhost' IDENTIFIED by 'cactipw';
ERROR 1045: Access denied for user: '@localhost' (Using password: NO)
mysql> GRANT PROCESS ON * TO cactiuser' IDENTIFIED by 'cactipw';
    '>
    '>
    '> ?
    '> help
    '> exit
    '> Aborted
What the heck is with the '> prompt where I can't seemingly do anything?
The problem was with yur sql. You have TO cactiuser' IDENTIFIED when you needed TO 'cactiuser' IDENTIFIED - i.e. missing a ' .

Try adding another user 'catiuser'@'127.0.0.1' with the same password as your otherone...

That worked for me.

-P
uname -a
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

Code: Select all

mysql> GRANT ALL ON cacti.* TO 'cactiuser@127.0.0.1' IDENTIFIED BY 'cactipw';
ERROR 1044: Access denied for user: '@localhost' to database 'cacti'
mysql> GRANT PROCESS ON * TO 'cactiuser' IDENTIFIED by 'cactipw';
ERROR 1045: Access denied for user: '@localhost' (Using password: NO)
mysql> GRANT PROCESS ON * TO 'cactiuser@127.0.0.1' IDENTIFIED by 'cactipw';
ERROR 1045: Access denied for user: '@localhost' (Using password: NO)
Would someone please show me what their Cacti user looks like with PHPmyadmin? Obviously, there is something not right.
ottob
Cacti User
Posts: 51
Joined: Tue Apr 27, 2004 11:43 am
Location: Duesseldorf, Germany
Contact:

Post by ottob »

looks like you dont have root access to mysql... is it your own machine?
pbulteel
Cacti User
Posts: 150
Joined: Fri Sep 05, 2003 9:20 am
Location: London
Contact:

Post by pbulteel »

BSOD2600 wrote:

Code: Select all

mysql> GRANT ALL ON cacti.* TO 'cactiuser@127.0.0.1' IDENTIFIED BY 'cactipw';
ERROR 1044: Access denied for user: '@localhost' to database 'cacti'
mysql> GRANT PROCESS ON * TO 'cactiuser' IDENTIFIED by 'cactipw';
ERROR 1045: Access denied for user: '@localhost' (Using password: NO)
mysql> GRANT PROCESS ON * TO 'cactiuser@127.0.0.1' IDENTIFIED by 'cactipw';
ERROR 1045: Access denied for user: '@localhost' (Using password: NO)
Would someone please show me what their Cacti user looks like with PHPmyadmin? Obviously, there is something not right.
How did you log into mysql?

You should have done it as root.

mysql -u root -p mysql
then get prompted for password....

This is the mysql root user password not the system root password... it should be the same as the user/password that you use in phpmyadmin to be able to add the user to the system in the first place. Now the thin is, in phpmyadmin - add a user cactiuser with the host of 127.0.0.1 ... grant process rights to that user and voila!

Maybe it's more complicated than that, but at least give it a try.

-P
uname -a
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

Yes, I own this mysql machine

Code: Select all

C:\mysql\bin>mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8837 to server version: 4.0.21-nt

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

mysql> GRANT PROCESS ON * TO 'cactiuser@127.0.0.1' IDENTIFIED by 'cactipw';
ERROR 1145: The host or user argument to GRANT is too long
mysql> GRANT PROCESS ON * TO 'cactiuser@localhost' IDENTIFIED by 'cactipw';
ERROR 1145: The host or user argument to GRANT is too long
mysql> GRANT PROCESS ON * TO 'cactiuser' IDENTIFIED by 'cactipw';
Query OK, 0 rows affected (0.01 sec)

mysql> exit


C:\mysql\bin>php -q c:\auntie\cacti\scripts\mysql_stats.php localhost cactiuser cactipw Connections
Error: MySQL connect failed. Check MySQL parameters (host/login/password)

C:\mysql\bin>php -q c:\auntie\cacti\scripts\mysql_stats.php command localhost cactiuser cactipw
change_db:5553 delete:54254 insert:55861 select:231182 update:11474
C:\mysql\bin>

Amazing, no one caught my mistakes this whole time with the wrong command to run the script...sheesh
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests