EDIT: Advanced Ping Template Version 1.3 for Cacti 0.8.6g

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

Moderators: Developers, Moderators

Post Reply
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

rayvd wrote:Had an interesting issue with this script...

I was getting 100% loss all the time, and investigated my logfile. The ss_fping script was getting called as such:

/var/www/html/noc/cacti/scripts/ss_fping.php ss_fping asterisk-master.domain.com 20 UDP 5060

So ss_fping was being used as the hostname in the ss_fping.php script.

To fix this behavior, I added an additional array_shift() call at the top of the ss_fping.php file. All is working now.
That should not be necessary. This behaviour occurs, if you're running the PHP Script Server script with php directly. Please check the Data Input Method and veriyf that Input Type will reflect Script - Script Server (PHP)
Reinhard
rayvd
Posts: 6
Joined: Mon Apr 18, 2005 6:22 pm
Location: Chico, CA

Post by rayvd »

lvm wrote: That should not be necessary. This behaviour occurs, if you're running the PHP Script Server script with php directly. Please check the Data Input Method and veriyf that Input Type will reflect Script - Script Server (PHP)
Reinhard
Correct, it is currently set to Script - Script Server (PHP)

But I notice that the Input String is set to: <path_cacti>/scripts/ss_fping.php ss_fping <hostname> <attempts> <protocol> <port>

Maybe I should remove the ss_fping?
User avatar
TheWitness
Developer
Posts: 17047
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Once you make said change, you need to clear your poller cache. When you change a data input method, changes to the cache do not happen until you clear the poller cache.

The way the script server works "path to file" "name of function" "parameters..."

Therefore, the "name of function" is not redundant. However, if it will also run as a Script "Non Script Server based" by simply running:

php "path ot file" "parameters"

I strongly recommend using the script server as it is much faster.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
rpingar
Cacti User
Posts: 86
Joined: Mon Jun 07, 2004 8:17 am

Post by rpingar »

I have a problem about thi sadvance ping:

1. linux rhat el4
2. php 4.3.9
3. cacti 0.8.6g - patched
4. the cronjob is executed as root
5. executing the poller from the command line everything is fine.


The problem is that after the second polling process after creating the datasource and the graph some hosts stop to graph, no error in the log file to debug, very starnge.
If I remove the datasource about advance ping everything come back to normal.

The ping.php is the script posted in the thread into the second page, overwriting the script from cacti 0.8.6g.


Any help?
thanks
User avatar
TheWitness
Developer
Posts: 17047
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

In unix, the poller needs to run as root.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
edmcguigan
Posts: 8
Joined: Thu Jan 23, 2003 12:18 pm

Advanced Ping v1.3 - Results for Certain Hosts Inaccurate

Post by edmcguigan »

KEY INFORMATION:

Watch out for setting your global ping timeout too low and getting silly results for high latency hosts.

In the future, an option to override global ping timeout on a per host basis would be very useful.

#------

I just got the Advanced Ping script basically working.
I am set up to run the poller as root ( on Linux ) so that I can do ICMP pings.
The one particular host I am trying to ping has both high latency and jitter. It is on the far end of an oversubscribed satellite link.

Another user reported a similar problem in post http://forums.cacti.net/viewtopic.php?p ... ght=#51310 back on December 15th.

From the script server command line I get a result:
/var/www/cacti/scripts/ss_fping.php ss_fping 66.178.17.166 20 ICMP
min:0.2900 avg:194.4835 max:370.4100 dev:134.6791 loss:15.0000
From the shell command line I get:
ping 66.178.17.166
PING 66.178.17.166 (66.178.17.166) 56(84) bytes of data.

--- 66.178.17.166 ping statistics ---
21 packets transmitted, 21 received, 0% packet loss, time 20014ms
rtt min/avg/max/mdev = 563.522/689.862/2127.833/352.732 ms, pipe 4
I found that the script was completely accurate for another host with a latency of around 60ms.

Rooting around in the ./lib/ping.php code ( for the Net Ping class - please note that I know perl not php ) I found references to a ping timeout value:

$ping_timeout = read_config_option("ping_timeout");

I then noticed under Settings->Poller in the web interface that the timeout could be adjusted ( I actually changed the ping type from UDP to ICMP and set the timeout to a rather high 2000 ( which I later dropped to 1000 - more than 1000 may as well be considered a dropped packet ).
SEE BELOW FOR SCREENSHOT OF LOCATION IN WEB INTERFACE.

Hope this helps someone.
Attachments
cacti_pingtimeout.JPG
cacti_pingtimeout.JPG (124.07 KiB) Viewed 11513 times
Ed McGuigan
User avatar
Levente
Posts: 5
Joined: Mon Jan 09, 2006 3:09 am
Location: Resita - ROMANIA
Contact:

Post by Levente »

Did i miss something ? where can i set the IP to ping ?
Everything else works...

Please help
Attachments
This is OK
This is OK
1.PNG (31.49 KiB) Viewed 11423 times
Where are the settings ? IP, times to ping, protocol...etc ?
Where are the settings ? IP, times to ping, protocol...etc ?
2.PNG (35.92 KiB) Viewed 11423 times
FreeBSD 6.2 | PHP 5.2.3 (cli) | MySQL 5.0.45 | Apache/2.2.4 | gcc 3.4.6 | RRDtool 1.2.23 | cacti-0.8.6i

[url=http://airguns.ro/]Air Guns - Air Rifles - Pellets - Optics - Accessories[/url]
[url=http://www.cartea-albastra.com/]Cartea Albastra - Cartea de Telefoane si Coduri Postale[/url]
User avatar
TheWitness
Developer
Posts: 17047
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Create a host in Cacti, then add this template and it's automatic.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
fozzy
Cacti User
Posts: 54
Joined: Mon Jan 09, 2006 11:33 am
Location: SE of LIML
Contact:

Post by fozzy »

does it work on 0.8.6h ? Or is a new relese in sight?

Thank you.
Luca
User avatar
Levente
Posts: 5
Joined: Mon Jan 09, 2006 3:09 am
Location: Resita - ROMANIA
Contact:

Post by Levente »

Tested it with 0.8.6h and it gives me 100% loss...at least the graph updates :)
I created a host for one of the hosts I wanted to ping and that's how I got 100% loss...
The thing I wanted to do is to ping a number of hosts from the server with cacti to some place...about 7-8 hops away... do I have to create a host for every IP that I want to ping ?

Thank you
FreeBSD 6.2 | PHP 5.2.3 (cli) | MySQL 5.0.45 | Apache/2.2.4 | gcc 3.4.6 | RRDtool 1.2.23 | cacti-0.8.6i

[url=http://airguns.ro/]Air Guns - Air Rifles - Pellets - Optics - Accessories[/url]
[url=http://www.cartea-albastra.com/]Cartea Albastra - Cartea de Telefoane si Coduri Postale[/url]
fozzy
Cacti User
Posts: 54
Joined: Mon Jan 09, 2006 11:33 am
Location: SE of LIML
Contact:

Post by fozzy »

i'm trying it but still no luck...
it pings, graphs are there but empty, results can be seen from command line but the poller has something to say about to few arguments.. :)

still trying :)

Luca
fozzy
Cacti User
Posts: 54
Joined: Mon Jan 09, 2006 11:33 am
Location: SE of LIML
Contact:

Post by fozzy »

this comes from the cacti.log in DEBUG mode.

Code: Select all

01/12/2006 06:15:05 PM - PHPSVR: Poller[0] DEBUG: INCLUDE: '/usr/local/cacti/scripts/ss_fping.php' SCRIPT: 'ss_fping' CMD: 'hostname 20 ICMP'
01/12/2006 06:15:05 PM - CMDPHP: Poller[0] Host[7] DS[47] WARNING: Result from SERVER not valid.  Partial Result: 
01/12/2006 06:15:05 PM - CMDPHP: Poller[0] Host[7] DS[47] SERVER: /usr/local/cacti/scripts/ss_fping.php ss_fping hostname 20 ICMP, output: U
01/12/2006 06:15:05 PM - CMDPHP: Poller[0] DEBUG: SQL Exec: "insert into poller_output (local_data_id,rrd_name,time,output) values (47,'','2006-01-12 18:15:01','U')"
I'm using sudo via the ping_exec file (explained in some thread, sorry don't remeber if it ws in this one) to use ICMP ping under unix.

Any ideas?

Thank you, Luca

PS: hostname has been inserted by me instead of the real hostname :) there's no problem there
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Hi Luca,
is there a problem with user permissions for ICMP requests? Please try "TCP 80" instead of "ICMP" assuming the target host will respond to TCP requests against port 80.
Reinhard
fozzy
Cacti User
Posts: 54
Joined: Mon Jan 09, 2006 11:33 am
Location: SE of LIML
Contact:

Post by fozzy »

all seems ok...

running as user cacti:

PHP Script Server has Started - Parent is cmd
/usr/local/cacti/scripts/ss_fping.php ss_fping hostname 20 ICMP


min:1.0700 avg:1.1205 max:1.6900 dev:0.1339 loss:0.0000
quit
PHP Script Server Shutdown request received, exiting


but the cacti log still reports:

01/13/2006 12:40:05 PM - CMDPHP: Poller[0] Host[7] DS[47] WARNING: Result from SERVER not valid. Partial Result:
01/13/2006 12:40:05 PM - CMDPHP: Poller[0] Host[7] DS[47] SERVER: /usr/local/cacti/scripts/ss_fping.php ss_fping hostname 20 ICMP, output: U


What else could i look for?

Thank you. Luca
datdat
Posts: 2
Joined: Mon Jan 16, 2006 12:34 am

ping result incorrect

Post by datdat »

I notice if i use a "Script server" and a normal "Script/command", the result is different

Code: Select all

01/15/2006 06:25:52 AM - CMDPHP: Poller[0] Host[29] DS[419] SERVER: /usr/share/cacti/site/scripts/ss_fping.php ss_fping somehost 20 ICMP, output: min:7.8400 avg:10.0000 max:11.8500 dev:0.6856 loss:0.0000


01/16/2006 04:30:15 PM - CMDPHP: Poller[0] Host[29] DS[419] CMD: php4 /usr/share/cacti/site/scripts/ss_fping.php somehost 20 ICMP, output: min:32.8100 avg:206.3716 max:398.8800 dev:181.5477 loss:5.0000
Edit: I'm using Version 0.8.6g on Linux (Debian)
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest