The MySQL Graph Collection - Version 2.0!

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

Moderators: Moderators, Developers

Post Reply
Author
Message
Mr_Poche
Posts: 11
Joined: Wed Jan 19, 2005 10:15 am

#16 Post by Mr_Poche » Fri Jan 28, 2005 4:34 pm

This seems pretty nice, but i cannot get it to work.

Every privileges on my SQL Server is fine, i run the script manually and it works perfectly but the graph is always empty.

im trying to monitor my local MySQL Server.

Any idea?

drywalldude
Posts: 11
Joined: Fri Jan 28, 2005 9:41 pm
Location: USA
Contact:

Can't get this to work

#17 Post by drywalldude » Fri Jan 28, 2005 9:57 pm

I gotta figure this one out :

at the command line:

[[email protected] scripts]# php -q /opt/administration/cacti/scripts/mysql_stats.php handler localhost cactiuser "myhardpsswd" delete:4024 read_first:16901 read_key:197801 read_next:133943 read_prev:0 read_rnd:135120 read_rnd_next:824705 update:1238 write:127007

all permissions working fine this should work??????

Cacti log says :

01/28/2005 08:15:04 AM - SYSTEM STATS: Time: 3.2767 s, Method: cmd.php, Processes: 1, Threads: N/A, Hosts: 2, Hosts/Process: 2
01/28/2005 08:15:03 AM - CMDPHP: Poller[0] Host[1] WARNING: Result from CMD not valid. Partial Result: Error: MySQL connect
01/28/2005 08:15:03 AM - CMDPHP: Poller[0] Host[1] WARNING: Result from CMD not valid. Partial Result: Error: MySQL connect
01/28/2005 08:10:04 AM - SYSTEM STATS: Time: 3.2612 s, Method: cmd.php, Processes: 1, Threads: N/A, Hosts: 2, Hosts/Process: 2
01/28/2005 08:10:04 AM - CMDPHP: Poller[0] Host[1] WARNING: Result from CMD not valid. Partial Result: Error: MySQL connect
01/28/2005 08:10:03 AM - CMDPHP: Poller[0] Host[1] WARNING: Result from CMD not valid. Partial Result: Error: MySQL connect

needless to say graphs are empty :cry:

Graph import went well and I'm using "cactiuser" as apposed to [email protected], but tryed both ways.

tryed entering manualy into data template : php -q /opt/administration/cacti/scripts/mysql_stats.php command localhost cactiuser "myhardpswd"

This produced one 5 minute post on graph but then stopped

Don't know what to do next kind of a newb, help to get this work would be appreciated, Thanks
Attachments
mysql_prob.JPG
mysql_prob.JPG (166.15 KiB) Viewed 31650 times

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

#18 Post by ottob » Sat Jan 29, 2005 7:08 am

hi,

please try to run it from command-line as the webserver-user (not as root) and see what happen...

drywalldude
Posts: 11
Joined: Fri Jan 28, 2005 9:41 pm
Location: USA
Contact:

run as webuser

#19 Post by drywalldude » Sat Jan 29, 2005 7:46 am

sorry to ask this but what would the syntax be for this, the system will not let me logout and log back in at the command line as cactiuser????? :-?

drywalldude
Posts: 11
Joined: Fri Jan 28, 2005 9:41 pm
Location: USA
Contact:

Figured out the easy stuff

#20 Post by drywalldude » Sat Jan 29, 2005 8:23 am

Figured ou the shell access prob but I honestly did not expect this:

bash-2.05a$ php -q /opt/administration/cacti/scripts/mysql_stats.php handler localhost cactiuser "mypswd"
delete:7586 read_first:25962 read_key:332347 read_next:227497 read_prev:0 read_rnd:237011 read_rnd_next:1143641 update:1964 write:232608

It worked (by the way this is a freh install of 8.6c)

still cluless I''ve given "cactiuser all the privaleges on can give and flushed.

drywalldude
Posts: 11
Joined: Fri Jan 28, 2005 9:41 pm
Location: USA
Contact:

Still no luck

#21 Post by drywalldude » Sat Jan 29, 2005 9:13 am

Tryed making the additional user [email protected] but to no avail :cry:

01/28/2005 07:40:03 PM - SYSTEM STATS: Time: 3.1523 s, Method: cmd.php, Processes: 1, Threads: N/A, Hosts: 2, Hosts/Process: 2
01/28/2005 07:40:03 PM - CMDPHP: Poller[0] Host[1] WARNING: Result from CMD not valid. Partial Result: Error: MySQL connect

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

#22 Post by ottob » Sat Jan 29, 2005 9:49 am

maybe a stupid question: did you really filled in the right values for username and password inside cacti (at the data source)? note that the fields are sorted unnormal (first password, then username)...

sorry for that question :wink:

drywalldude
Posts: 11
Joined: Fri Jan 28, 2005 9:41 pm
Location: USA
Contact:

No problem

#23 Post by drywalldude » Sat Jan 29, 2005 10:19 am

I appreciate your help, yes I did this multiple times reinstalled/templates etc............... :o

drywalldude
Posts: 11
Joined: Fri Jan 28, 2005 9:41 pm
Location: USA
Contact:

Sorry for all the trouble..

#24 Post by drywalldude » Sun Jan 30, 2005 11:02 am

Figured it out I guess upgraded to MySQL 4.0.23 and things seem to be working good. Still have one problem with the querycache graph.
log file reads :
1/29/2005 09:30:05 PM - SYSTEM STATS: Time: 4.1625 s, Method: cmd.php, Processes: 1, Threads: N/A, Hosts: 2, Hosts/Process: 2
01/29/2005 09:25:04 PM - SYSTEM STATS: Time: 4.1703 s, Method: cmd.php, Processes: 1, Threads: N/A, Hosts: 2, Hosts/Process: 2
01/29/2005 09:20:04 PM - SYSTEM STATS: Time: 4.1569 s, Method: cmd.php, Processes: 1, Threads: N/A, Hosts: 2, Hosts/Process: 2
GOOD
Attachments
query_cache.JPG
query_cache.JPG (185.42 KiB) Viewed 31573 times

zyeclone
Posts: 5
Joined: Sun Jan 30, 2005 1:10 pm

#25 Post by zyeclone » Mon Jan 31, 2005 10:03 am

great script !!

thx for sharing
Attachments
graph.png
graph.png (8.26 KiB) Viewed 31547 times

Mr_Poche
Posts: 11
Joined: Wed Jan 19, 2005 10:15 am

#26 Post by Mr_Poche » Mon Jan 31, 2005 3:03 pm

Still trying to get this working, but i cant.

Here is the error of my poller :
01/31/2005 03:08:20 PM - CMDPHP: Poller[0] Host[2] WARNING: Result from CMD not valid. Partial Result:

When i run the script in console :
[email protected]:/usr/local/apache2/secacti/scripts# php mysql_stat.php command localhost USER PASS
change_db:220122 delete:4499500 insert:4577368 select:4040935 update:314024

As you can see, the script is working, but why in cacti it isnt? I tried with every damn user , even nobody and the script works every time.

Why then i'm getting empty graph?

byrons
Posts: 17
Joined: Thu Jan 27, 2005 6:30 am
Contact:

#27 Post by byrons » Tue Feb 01, 2005 11:53 am

Hope this helps someone.

I found, in the Data Input Methods of, for example, "MySQL - Thread statistics", by swopping the <username> and the <password> within the command string it all seems to work.

Example:
<path_php_binary> -q <path_cacti>/scripts/mysql_stats.php thread <hostname> <username> <password>
to
<path_php_binary> -q <path_cacti>/scripts/mysql_stats.php thread <hostname> <password> <username>
Looking at the mysql_stats.php, logically, my way shouldn't work, but it does.

Maybe some explanation from the experts?

Cheers
Byron

cyablo
Posts: 4
Joined: Tue Feb 01, 2005 4:33 pm

#28 Post by cyablo » Tue Feb 01, 2005 7:55 pm

Be Sure your hostname of your device is: localhost NOT 127.0.0.1!
For me it was the Problem!

greetz

cyablo

byrons
Posts: 17
Joined: Thu Jan 27, 2005 6:30 am
Contact:

#29 Post by byrons » Wed Feb 02, 2005 3:32 am

That's odd, mine is 127.0.0.1 and it's working ok.

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

#30 Post by ottob » Wed Feb 02, 2005 4:36 am

note that the fields are sorted unnormal (first password, then username)...

sorry for that question
maybe this is the problem? (sorry again) :wink:
Last edited by ottob on Wed Feb 02, 2005 5:16 am, edited 1 time in total.

Post Reply