Synology Avanced ping template -> ss_fping.php fail

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

Moderators: Moderators, Developers

Post Reply
Author
Message
wopper
Posts: 2
Joined: Sun Dec 18, 2011 10:52 am

Synology Avanced ping template -> ss_fping.php fail

#1 Post by wopper » Sun Dec 18, 2011 1:36 pm

Hi

First of all i'm not blessed with programming skills :( I have a Synology NAS and its working like a charm, installed Cacti on it to ping my provider websites availability, but then the hard part started. A lot of people does have a Synology NAS at home, in Holland its one of the most sold vendors, so i love to get this working for me and other users.

I have downloaded about all the ping.php and ss_fping.php files from this forum and now i have a working combination see the files attached. These files give ping output after a lot of hours trying out.

ping_working2.php gives this output:

DiskStation> /usr/bin/php ss_fping.php www.ziggo.nl 20 ICMP
PHP Deprecated: Comments starting with '#' are deprecated in /usr/syno/etc/php/user-setting.ini on line 1 in Unknown on line 0
PHP Notice: Undefined variable: config in /volume1/web/cacti/lib/ping.php on line 221

Notice: Undefined variable: config in /volume1/web/cacti/lib/ping.php on line 221
PHP Notice: Undefined variable: config in /volume1/web/cacti/lib/ping.php on line 232
<output ommitted 20 times>
min:14.1300 avg:16.2645 max:18.2100 dev:1.7041 loss:0.0000DiskStation>


ping_working1.php gives this output:
DiskStation> /usr/bin/php ss_fping.php www.ziggo.nl 20 ICMP
PHP Deprecated: Comments starting with '#' are deprecated in /usr/syno/etc/php/user-setting.ini on line 1 in Unknown on line 0
min:14.0800 avg:15.5327 max:18.0100 dev:1.4028 loss:25.0000DiskStation>

but they all reporting losses, but there are no losses? If i run the cycle once with " 1 ICMP" it reports:

min:14.8900 avg:14.8900 max:14.8900 dev:0.0000 loss:0.0000DiskStation>

Love to invest this with some experts?
Attachments
ss_fping_complete.zip
(8.88 KiB) Downloaded 210 times

raiten
Posts: 43
Joined: Fri May 12, 2006 12:17 pm

Re: Synology Avanced ping template -> ss_fping.php fail

#2 Post by raiten » Sun Jan 27, 2013 11:45 am

Just for archive, if someone has similar problem

I have a DSM4.1 with php 5.3.15
I installed cacti following:
http://forum.synology.com/enu/viewtopic.php?f=7&t=56507
http://casper.rabas.net/wordpress/?p=326 +temperature

but default busybox cacti haven't got ping options asked by cacti. solved with hping from ipkg and this patch

[code]
--- /volume1/web/cacti/lib/ping.php.orig
+++ /volume1/web/cacti/lib/ping.php
@@ -162,7 +162,8 @@
}else if (substr_count(strtolower(PHP_OS), "winnt")) {
$result = shell_exec("ping -w " . $this->timeout . " -n " . $this->retries . " " . $this->host["hostname"]);
}else{
- $result = shell_exec("ping -W " . ceil($this->timeout/1000) . " -c " . $this->retries . " -p " . $pattern . " " . $this->host["hostname"]);
+ $cmd = ("/opt/sbin/hping3 -1 -q -c " . $this->retries . " " . $this->host["hostname"]." 2>&1");
+ $result = shell_exec($cmd);
}

if (strtolower(PHP_OS) != "winnt") {
@@ -172,7 +173,7 @@
$output = trim(str_replace(" ms", "", substr($result, $position)));
$pieces = explode("=", $output);
$results = explode("/", $pieces[1]);
-
+
$this->ping_status = $results[1];
$this->ping_response = "ICMP Ping Success (" . $results[1] . " ms)";
[/code]

Post Reply