hmib error 1064

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

Post Reply
biffhero
Posts: 1
Joined: Mon Aug 10, 2015 1:08 am

hmib error 1064

Post by biffhero »

I am running cacti-0.8.8f, and the hmib plugin 1.4.

In the cacti.log file, I am getting the following error:

08/10/2015 01:20:02 AM - CMDPHP: Poller[0] ERROR: A DB Exec Failed!, Error:'1064', SQL:"UPDATE plugin_hmib_hrSystem SET uptime=''82494531'',date=''2015-8-10 1:20:2'',initLoadDevice=''393216'',initLoadParams=''ro root=/dev/mapper/mycorpvg-root rd_LVM_LV=mycorpvg/root rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD rd_LVM_LV=mycorpvg/swap SYSFONT=l'',users=''5'',processes=''219'',maxProcesses=''0'',sysDescr=''Linux myco-sky-mon1 2.6.32-504.30.3.el6.x86_64 #1 SMP Wed Jul 15 10:13:09 UTC 2015 x86_64'',sysObjectID=''.1.3.6.1.4.1.8072.3.2.10'',sysUptime=''4841815'',sysContact=''my-cloudops@mycorp.com'',sysName=''myco-sky-mon1'',sysLocation=''Location'' WHERE host_id=1'


Thanks,
Rob
User avatar
pizu
Posts: 42
Joined: Thu Nov 17, 2011 5:15 pm

Re: hmib error 1064

Post by pizu »

i have the same issue too :(
Regards,
Pizu
magteix
Posts: 2
Joined: Mon Sep 21, 2015 4:20 pm

Re: hmib error 1064

Post by magteix »

Same here! Can someone help?
shd
Cacti User
Posts: 96
Joined: Mon Apr 09, 2007 1:33 pm
Location: Nizhnevartovsk, Russia

Re: hmib error 1064

Post by shd »

This error appeared in newer Cacti versions because of double string sanitation.

Patch to fix that:

Code: Select all

--- poller_hmib.php.orig	2011-12-01 08:02:57.000000000 +0600
+++ poller_hmib.php	2015-10-29 09:22:19.000000000 +0500
@@ -570,7 +570,7 @@
 			}
 
 			if (!empty($key)) {
-				$set_string .= (strlen($set_string) ? ",":"") . $key . "='" . sql_sanitize(trim($mib["value"], ' "')) . "'";
+				$set_string .= (strlen($set_string) ? ",":"") . $key . "=" . sql_sanitize(trim($mib["value"], ' "')) . "";
 			}
 		}
 		}
CentOS 64-bit, 20Gb RAM, 8xCPU, some virtual datastore. 600+ hosts, 200k+ datasources, avg polltime 45 sec
magteix
Posts: 2
Joined: Mon Sep 21, 2015 4:20 pm

Re: hmib error 1064

Post by magteix »

shd wrote:This error appeared in newer Cacti versions because of double string sanitation.

Patch to fix that:

Code: Select all

--- poller_hmib.php.orig	2011-12-01 08:02:57.000000000 +0600
+++ poller_hmib.php	2015-10-29 09:22:19.000000000 +0500
@@ -570,7 +570,7 @@
 			}
 
 			if (!empty($key)) {
-				$set_string .= (strlen($set_string) ? ",":"") . $key . "='" . sql_sanitize(trim($mib["value"], ' "')) . "'";
+				$set_string .= (strlen($set_string) ? ",":"") . $key . "=" . sql_sanitize(trim($mib["value"], ' "')) . "";
 			}
 		}
 		}
Awesome! Thank you! :D
shd
Cacti User
Posts: 96
Joined: Mon Apr 09, 2007 1:33 pm
Location: Nizhnevartovsk, Russia

Re: hmib error 1064

Post by shd »

And while I'm at it: HMIB CPU polling always returns 0. Quick fix for that is to patch setup.php:

Code: Select all

--- setup.php.orig	2011-12-01 08:02:57.000000000 +0600
+++ setup.php	2015-10-30 11:13:24.000000000 +0500
@@ -723,13 +723,13 @@
 	if (!$called_by_script_server) {
 		return $host_index;
 	}else{
-		$value = db_fetch_cell("SELECT `load` FROM plugin_hmib_hrProcessor WHERE host_id=$host_id AND `index`=$index");
+		// weird indexes
+		$value = db_fetch_cell("SELECT `load` FROM plugin_hmib_hrProcessor WHERE host_id=$host_id AND (`index`=$index OR `index`=($index+768) OR `index`=($index+196608))");
 
 		if (empty($value)) {
-			return "0";
-		}else{
-			return $value;
+			$value = "0";
 		}
+		return $value;
 	}
 }
 
CentOS 64-bit, 20Gb RAM, 8xCPU, some virtual datastore. 600+ hosts, 200k+ datasources, avg polltime 45 sec
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest