Problem Instalasi Cacti Hari Ini: SQL dan Cmd.php

Menggunakan PC dengan spesifikasi aplikasi berikut: Apache 2.2.4, PHP 5.2.2, MySQL 5.0.41, 0.8.6j. Net- 5.4.0.1, RRDTool 1.2.15. Semuanya update terbaru. Serta mesin AcerPower FH, Dual core Pentium D 820 (2,80 GHz), RAM 1 GB. Sebuah PC biasa yang aku pakai sehari-hari. Ternyata prosesnya nggak semulus yang sudah-sudah. Banyak rintangannya 🙁 Tapi walau gimanapun juga semua pasti ada jalan keluarnya 🙂

Problem pertama:

BLOB/TEXT column ‘oid’ can’t have a default value (1101) – —
— Table structure for table `host_snmp_cache`

CREATE TABLE host_snmp_cache (
host_id mediumint(8) unsigned NOT NULL default ‘0’,
snmp_query_id mediumint(8) unsigned NOT NULL default ‘0’,
field_name varchar(50) NOT NULL default ”,
field_value varchar(255) default NULL,
snmp_index varchar(255) NOT NULL default ”,
oid TEXT NOT NULL default ”,
PRIMARY KEY (host_id,snmp_query_id,field_name,snmp_index),
KEY host_id (host_id,field_name),
KEY snmp_index (snmp_index)
) TYPE=MyISAM;

Error message di atas muncul saat import cacti.sql kedalam database. setelah tanya sama si Google malah dilempar ke forum. Untung dikasih jawaban seperti ini:

1) dump the cacti database and delete the stuff related to it in your \mysql\data\cacti\ folder.
2) Disable sql-strict mode in MySQL’s my.ini file. Then re-attempt the mysql steps. That should hopefully fix your problem.

Ok, langsung aku edit baris berikut di my.ini :

sql-mode=”STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,
NO_ENGINE_SUBSTITUTION”

Proses import cacti.sql pun lancar. Tuh kan, berkat si Google orang awam seperti aku ini juga bisa!

Problem kedua:

CMDPHP: Poller[0] ERROR: The PHP Script: CMD.PHP Must be started using the full path to the file and in lower case. This is a PHP Bug!!!

Error message yang ini muncul di Log file Cacti (pada System Utilities) setiap kali aku run poller cacti cmd.php dari command prompt. Hingga dalam sebuah thread di forum menjawab demikian:

Hello….
Here is my little contribution….I found the following in cmd.php file…
/* PHP Bug. Not yet submitted */
if ($config[“cacti_server_os”] == “win32”) {
$guess = substr(__FILE__,0,2);
if ($guess == strtoupper($guess)) {
$response = “ERROR: The PHP Script: CMD.PHP Must be started using the full path to the file and in lower case. This is a PHP Bug!!!”;
print “\n”;
cacti_log($response,true);
exit(-1);
}
}

for some reason, the variable $guess was having the value “C:” in upper case.
so I added the following:
$guess = strtolower($guess);
After that, when I run: php.exe c:\apache\htdocs\cacti\poller.php
I get the following (which looks ok)
OK u:0.01 s:0.01 r:2.88
10/23/2006 07:46:28 PM – SYSTEM STATS: Time:5.2522 Method:cmd.php Processes:2 Th
reads:N/A Hosts:2 HostsPerProcess:1 DataSources:1 RRDsProcessed:1

Please let me know if this fix is fine or will have more problems….
Thanks.

(Tuh! langsung aku kutip semua :p)

Langsung deh update file cmd.php, ganti baris ($guess == strtoupper($guess) dengan $guess = strtolower($guess). Tes di command prompt php.exe c:\apache2.2\htdocs\cacti\poller.php hasilnya bisa dilihat di log file cacti:

SYSTEM STATS: Time:2.3282 Method:cmd.php Processes:1 Threads:N/A Hosts:3 HostsPerProcess:3 DataSources:31 RRDsProcessed:18

and… It works! (mirip pesan yang muncul saat Apache udah sukses terinstal pada http://localhost) 

Tags: ,

2 thoughts on “Problem Instalasi Cacti Hari Ini: SQL dan Cmd.php”

Leave a Reply

Your email address will not be published. Required fields are marked *