The MySQL Graph Collection

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

Moderators: Developers, Moderators

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

Post by ottob »

Hi Sandello,

youre definitely right! - i put this scripts together using the "quick and dirty" method.

Maybe i will bring out a more compatible version of these scripts...

By the way: is there anybody out there who is using the scripts with cactid? Any response?

Bye,
Otto
jlynch

peaks

Post by jlynch »

I seem to get huge peaks when I restart mysql. Is this normal? Mind you I am trouble shooting mysql so these peaks may actualy be happening when mysql crashes and are the reason for me needing to reboot. But it is difficult to see where these peaks are comming from.

Justin
davidr

Post by davidr »

Hm, seems to be something fishy about these scripts.

11/23/2004 08:02:29 PM - CMDPHP: Poller[0] Host[20] WARNING: Result from CMD not valid. Partial Result:
11/23/2004 08:02:29 PM - CMDPHP: Poller[0] Host[20] CMD: php -q /home/www/cacti/scripts/mysql_com.php database cactiuser password, output: U

When running the same script from command line, it works perfectly.

# php -q /home/www/cacti/scripts/mysql_com.php database cactiuser password
change_db:577682 delete:74235 insert:1556194 select:13122337 update:6006244

Tried DEBUG:ing the log, but it doesn't give any more info an "Partial Result"...
ottob
Cacti User
Posts: 51
Joined: Tue Apr 27, 2004 11:43 am
Location: Duesseldorf, Germany
Contact:

Post by ottob »

Hi!

I got the same problem, but i dont have an idea how to fix it at the moment. :o
In the near future I will bring out a new version, wich will have some small improvements and fixes...

otto
vengent
Posts: 8
Joined: Fri Nov 19, 2004 3:12 pm

Post by vengent »

Are you running the command line as the same user as the poller runs?

That was a problem for me, and permissions helped to rectify.

Matt
davidr

Post by davidr »

Yes, as the same user, and the mysql-scripts is the only scripts that doesn't work, and give that strange error.

One other strange thing is that I got it working against one site (tested on two), but I didn't get it to work against the other site. Both worked nice from command line, and both sites have the same mysql data (master and slave).

I tried do clear the poller cache, and after that. None of them have ever worked again :)

Could this be a clue why the scripts are not working? I've tried do get them to not use the "-q" flag, but that doesn't help, still the same error.

Also tried do make the scripts executeable, and make the scripts run them self with #!/usr/bin/php, instead of php <path>/script. This doesn't help either, gives the same error.
vengent
Posts: 8
Joined: Fri Nov 19, 2004 3:12 pm

Post by vengent »

Hmm, one other thought that I think I saw in another thread.

Does the database user have a host restriction? Such that from the console it sees localhost, and from the site it thinkt its coming from a differnet site/IP address?


And a question for the creator.

On a few graphs (in your posted ones), it seems the max is not always the greatest value. And I'm not sure where the "m" value is coming from. They all seem to be using "Normal" numbers, and the values certainly don't get near 1 million. It seems to be almost random and the unit seems to be related to the max error.. From the graph perspective, I can't find anything wrong, havne't had a chance to dig through the data template portion yet.

Edit: - Decided to add a screen shot with what I mean highlighted.
Attachments
Example Screen Shot
Example Screen Shot
example.PNG (25.97 KiB) Viewed 6307 times
ottob
Cacti User
Posts: 51
Joined: Tue Apr 27, 2004 11:43 am
Location: Duesseldorf, Germany
Contact:

Post by ottob »

Hi!

The max-values are correct! The 'm' means "milli" (Divide it by 1000 to get the "real" numbers) - or did you mean something else?

Otto

ps. All values are showing the activity per second...
ottob
Cacti User
Posts: 51
Joined: Tue Apr 27, 2004 11:43 am
Location: Duesseldorf, Germany
Contact:

Post by ottob »

Hi,

i found out where the problems with the Command-Stats came from:

I think since 0.8.6 the process of parsing the script output is a little bit different --> I had a trailing space character in the output of the command-stats script. That seems to be the mistake...

I attached a "fixed" version if the mysql_com.php script...

Otto

ps. i know, the scripts need more 'polish' -> a new version will come out in the near future...
Attachments
mysql_com.php.txt
(743 Bytes) Downloaded 402 times
davidr

Post by davidr »

The "fixed" mysql_com.php didn't solve any of the problems, too bad.

11/25/2004 06:16:53 PM - CMDPHP: Poller[0] Host[13] CMD: php /home/www/cacti/scripts/mysql_com.php database cactiuser password, output: U

still the same strange output.
davidr

Post by davidr »

Ok, I did the last output. I deleted mysql-cacti-stuff, and re-installed every template, script and so on.

Well, now everything works? :-?

I don't use the "fix", but everything still works 100% ok! Why it didn't before, well, nobody knows :)
enigma
Posts: 12
Joined: Wed Nov 24, 2004 7:08 am
Location: UK
Contact:

php-win.exe

Post by enigma »

All,

I have found that when I ran the php scripts from the command line they returned the correct mysql values and all was okay. Now within Cacti I was getting the "Empty Result" error and so my graphs were not updating. I checked everything and all seemed okay. Now one day I just happend to try running the php script from the command line using the php-win.exe which is what I have set within the cacti GUI and hey presto it returned no data just a blank whereas php.exe works okay.

So possibly the problem lies with php-win.exe for me and maybee others ?. Anyone else notice this ?
User avatar
jshanley
Posts: 11
Joined: Fri Jul 30, 2004 7:39 pm

MySQL scripts & blank graphs

Post by jshanley »

I was getting "partial result" and "empty result in my Poller logs too:

Code: Select all

 11/30/2004 03:45:01 PM - CACTID: Poller[0] Host[1] WARNING: Result from SCRIPT not valid. Partial Result: U...
11/30/2004 03:45:01 PM - CACTID: Poller[0] Host[1] ERROR: Empty result [127.0.0.1]: 'php -q /usr/domains/shared/cacti/scripts/mysql_cache.php 127.0.0.1 cacti mypasswordhere'
- From the commandline, root ran the script just fine. This includes using "localhost" and "127.0.0.1"
- From the commandline, the "cacti" user did NOT run the script fine unless the destination was "localhost". Using "127.0.0.1" as the destination did not work (I really don't understand why).

Code: Select all

$ php -q /usr/domains/shared/cacti/scripts/mysql_stat.php 127.0.0.1 cacti mypasswordhere Com_select
PHP Warning:  mysql_connect(): Can't connect to MySQL server on '127.0.0.1' (61) in /usr/domains/shared/cacti/scripts/mysql_stat.php on line 10
But if I substitute "localhost" for the server to connect to, it works. Huh? hehee.

Code: Select all

$ php -q /usr/domains/shared/cacti/scripts/mysql_stat.php localhost cacti mypasswordhere Com_select
304102
Here's another interesting thing;

If I am logged in as "root", the query returns results even if I use "127.0.0.1" instead of "localhost". BUT, if I use "127.0.0.1", the result is wrong (it says 0 instead of 300,000 or so). See here the results if I'm logged in as root:

Code: Select all

www# whoami
root
www# php -q /usr/domains/shared/cacti/scripts/mysql_stat.php 127.0.0.1 cacti mypasswordhere Com_select
0

www# php -q /usr/domains/shared/cacti/scripts/mysql_stat.php localhost cacti mypasswordhere Com_select
304868
Why is this? I don't know... but it's probably the same issue that others are having. So, it doesn't really appear to be something with Cacti, but instead something weird with either MySQL or PHP or something.. I dont know.

I think the reason some people "think" it works fine using the cacti user from the commandline is because they are not su'ing to the cacti user with su - cacti instead of just "su cacti",

Anyway, I've just modified the data sources for now to use "localhost" instead of 127.0.0.1 until I can figure it out. Don't forget to clear your Poller Cache in Cacti if you end up doing something like this too, or it'll keep the old "127.0.0.1". I know it's not a "correct fix" but.. I dont know how to solve the root cause of the problem yet.
enigma
Posts: 12
Joined: Wed Nov 24, 2004 7:08 am
Location: UK
Contact:

Post by enigma »

Okay I still have not got to the bottom of this and it is now driving my crazy.

I am running Cacti 0.8.6b with cactid 0.8.6c on a Windows 2003 server. Everythign is working great I have had no problems at all until trying to get these MySQL scripts / templates working. I have copied the scripts into the scripts directory of cacti and imported the templates fine via the cacti gui. I can now setup the relevany MySQL buts to graph without a problem but the graph never updates with any values.

If i run the script from the windows command line as follows all is fine and values get returned.

php -q E:/wwwroot/cacti-0.8.6b/scripts/mysql_com.php 172.19.226.44 cactiuser cactiuser

output shown is along the lines off

change_db:9796 delete:0 insert:11503 select:36270 update:3719

Now if I switch on Debug mode within the gui the cacti log reports the following error when the above runs via cactid / poller

12/10/2004 02:06:03 PM - CACTID: Poller[0] Host[4] ERROR: Empty result [172.19.226.44]: 'php -q E:/wwwroot/cacti-0.8.6b/scripts/mysql_com.php 172.19.226.44 cactiuser cactiuser'
12/10/2004 02:06:03 PM - CACTID: Poller[0] Host[4] WARNING: Result from SCRIPT not valid. Partial Result: U...
12/10/2004 02:06:03 PM - CACTID: Poller[0] Host[4] SCRIPT: php -q E:/wwwroot/cacti-0.8.6b/scripts/mysql_com.php 172.19.226.44 cactiuser cactiuser, output: U
12/10/2004 02:06:03 PM - CACTID: Poller[0] DEBUG: SQLCMD: insert into poller_output (local_data_id,rrd_name,time,output) values (133,'','2004-12-10 14:06:00','U')


Has anyone had this and been able to fix the problem ?. The only thing I can see from above is that there is no rrd_name value actually inserted into the last line between the local_data_id of 133 and the time of 2004-12-10 14:06:00 plus the output value is U for some reason. The script works fine from the command line though which does lead me to think it is a cacti problem.

I would love to get this fixed asap but I am not sure where to start.
arjanv
Posts: 13
Joined: Thu Dec 09, 2004 1:48 pm

Post by arjanv »

Hello,

Great Work!!!

I have only the following faults :

12/13/2004 04:10:15 PM - CMDPHP: Poller[0] Host[1] WARNING: Result from CMD not valid. Partial Result:
12/13/2004 04:10:15 PM - CMDPHP: Poller[0] Host[1] CMD: php -q /home/httpd/vhosts/default/htdocs/cacti/scripts/mysql_stat.php 127.0.0.1 cactiuser@localhost ** Questions, output: U

12/13/2004 04:10:15 PM - CMDPHP: Poller[0] Host[1] WARNING: Result from CMD not valid. Partial Result:
12/13/2004 04:10:15 PM - CMDPHP: Poller[0] Host[1] CMD: php -q /home/httpd/vhosts/default/htdocs/cacti/scripts/mysql_stat.php 127.0.0.1 cactiuser@localhost ** Connections, output: U

Anyone a suggestion to fix the problems?

Grtz Arjan
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest