google-code-export / mysql-cacti-templates

Automatically exported from code.google.com/p/mysql-cacti-templates
GNU General Public License v2.0
1 stars 0 forks source link

Undefined index error when running php script from the command line #4

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Import template
2. Create graphs
3. Run script

I see the following errors repeated over and over again:

Notice: Undefined index:  file_size in
/usr/local/apache2/htdocs/cacti/scripts/ss_get_mysql_stats.php on line 160

What version of the product are you using? On what operating system?
Using Fedora Core release 3
MySQL 4.1.10
Cacti 0.8.6j (fully patched)

Please provide any additional information below.

When I checkout line 160 of the php script code, I see the following routine:

   $result = run_query("SHOW MASTER LOGS", $conn);
   while ($row = @mysql_fetch_assoc($result)) {
      $row = array_change_key_case($row, CASE_LOWER);
      $binlogs[] = $row['file_size'];
   }

When I run "SHOW MASTER LOGS" on my MySQL server I do not get a display of
the 'file_size'.

ie:

mysql> SHOW MASTER LOGS;
+----------------------+
| Log_name             |
+----------------------+
| TO-MON-02-bin.000045 |
| TO-MON-02-bin.000046 |
| TO-MON-02-bin.000047 |
....etc

Any help would be appreciated.

Thanks!

Original issue reported on code.google.com by insult...@gmail.com on 6 May 2008 at 5:46

GoogleCodeExporter commented 9 years ago
I think I just answered my own question.

I just installed MySQL 5.0.51a and now get the following from "SHOW MASTER LOGS"

mysql> SHOW MASTER LOGS;
+------------------+-----------+
| Log_name         | File_size |
+------------------+-----------+
| mysql-bin.000001 |        98 | 
+------------------+-----------+
1 row in set (0.00 sec)

I guess I'm going to have to wait until our production environment is upgraded 
before
playing with this tool.

Original comment by insult...@gmail.com on 6 May 2008 at 6:20

GoogleCodeExporter commented 9 years ago
No, we should make the script detect the older server's output and just return 
0. 
Just because the information isn't available doesn't mean you can't monitor
everything else :-)

If you can patch your version and send a patch that would be great.  Inside the 
first
loop just check for whether the array index exists, and pop out of the loop if 
it
doesn't.

Original comment by baron.schwartz on 6 May 2008 at 6:36

GoogleCodeExporter commented 9 years ago
Here's my patch.  Seems to be working great now.

Thanks for this great template!  It's going to be very useful to us here.

Original comment by insult...@gmail.com on 6 May 2008 at 7:35

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for the patch.  A modified version of it is in revision 35.

Original comment by baron.schwartz on 7 May 2008 at 12:12