The MySQL Graph Collection - Version 2.0!

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

Moderators: Moderators, Developers

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

The MySQL Graph Collection - Version 2.0!

#1 Post by ottob » Tue Jan 18, 2005 8:55 am

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
mysql_stats.gif
screenshots
mysql_stats.gif (71.22 KiB) Viewed 139724 times
mysql_stats.zip
contains all files needed
(24.72 KiB) Downloaded 20904 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: 2326
Joined: Fri Sep 19, 2003 8:36 am
Location: Sophia-Antipolis, France
Contact:

#2 Post by fmangeant » Tue Jan 18, 2005 11:37 am

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: 12160
Joined: Sat May 08, 2004 12:44 pm
Location: USA

#3 Post by BSOD2600 » Tue Jan 18, 2005 6:45 pm

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

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

I've tried several combos of the [email protected], 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:

#4 Post by ottob » Wed Jan 19, 2005 2:18 am

Hi,

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

otto

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

#5 Post by fmangeant » Wed Jan 19, 2005 3:11 am

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: 12160
Joined: Sat May 08, 2004 12:44 pm
Location: USA

#6 Post by BSOD2600 » Wed Jan 19, 2005 12:03 pm

ottob wrote:try to use only "cactiuser" (not "[email protected]") 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:

#7 Post by ottob » Wed Jan 19, 2005 12:26 pm

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:

#8 Post by pbulteel » Wed Jan 19, 2005 12:44 pm

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 [email protected]'localhost' and another one with [email protected]'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: 12160
Joined: Sat May 08, 2004 12:44 pm
Location: USA

#9 Post by BSOD2600 » Wed Jan 19, 2005 5:16 pm

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 [email protected]'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: 2326
Joined: Fri Sep 19, 2003 8:36 am
Location: Sophia-Antipolis, France
Contact:

#10 Post by fmangeant » Thu Jan 20, 2005 2:33 am

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 [email protected] 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:

#11 Post by pbulteel » Thu Jan 20, 2005 7:13 am

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 [email protected]'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: 12160
Joined: Sat May 08, 2004 12:44 pm
Location: USA

#12 Post by BSOD2600 » Thu Jan 20, 2005 10:39 am

Code: Select all

mysql> GRANT ALL ON cacti.* TO '[email protected]' 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 '[email protected]' 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:

#13 Post by ottob » Thu Jan 20, 2005 11:01 am

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:

#14 Post by pbulteel » Thu Jan 20, 2005 11:31 am

BSOD2600 wrote:

Code: Select all

mysql> GRANT ALL ON cacti.* TO '[email protected]' 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 '[email protected]' 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: 12160
Joined: Sat May 08, 2004 12:44 pm
Location: USA

#15 Post by BSOD2600 » Thu Jan 20, 2005 2:46 pm

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 '[email protected]' IDENTIFIED by 'cactipw';
ERROR 1145: The host or user argument to GRANT is too long
mysql> GRANT PROCESS ON * TO '[email protected]' 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