Cacti pusing dengan ICMP ping

July 2nd, 2012 by Idris

Cacti di develop dengan menggunakan bahasa pemrograman PHP, dimana salah satunya menggunakan fungsi socket_create dan socket_connect, padahal di cacti sendiri ada option untuk bisa ping ke host dengan menggunakan protokol ICMP alias menggunakan syntax socket_create(AF_INET, SOCK_RAW,1) nah… ternyata syntax itu hanya bisa kalau dijalankan oleh root di linux, akhirnya setelah muter-muter nemulah patchnya di http://www.cacti.net/downloads/patches/0.8.7d/pre-patched/lib/ping.php

intinya sih:

if ($config[”cacti_server_os”] != “unix”) {

…….

……..

}else{
/* we have to use the real ping */
$patternĀ  = bin2hex(”cacti-monitoring-system”); // the actual test data

/* host timeout given in ms, recalculate to sec, but make it an integer */
if (substr_count(strtolower(PHP_OS), “sun”)) {
$result = shell_exec(”ping ” . $this->host[”hostname”]);

………

………

Leave a Reply