EDIT: Advanced Ping Template Version 1.3 for Cacti 0.8.6g

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

Moderators: Moderators, Developers

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

#76 Post by gandalf » Tue Jan 03, 2006 12:03 pm

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

#77 Post by rayvd » Tue Jan 03, 2006 12:14 pm

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: 14804
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

#78 Post by TheWitness » Tue Jan 03, 2006 3:56 pm

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 MacTrack, Boost, CLog, SpikeKill, Platform RTM, DSStats, maintainer of Spine, lot's of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Central Plugin Repository
Central Templates Repository


I'm still out there people. Getting excited for Cacti 1.2. I think it will be a great release.

rpingar
Cacti User
Posts: 86
Joined: Mon Jun 07, 2004 8:17 am

#79 Post by rpingar » Tue Jan 03, 2006 4:20 pm

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: 14804
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

#80 Post by TheWitness » Tue Jan 03, 2006 6:07 pm

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 MacTrack, Boost, CLog, SpikeKill, Platform RTM, DSStats, maintainer of Spine, lot's of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Central Plugin Repository
Central Templates Repository


I'm still out there people. Getting excited for Cacti 1.2. I think it will be a great release.

edmcguigan
Posts: 8
Joined: Thu Jan 23, 2003 12:18 pm

Advanced Ping v1.3 - Results for Certain Hosts Inaccurate

#81 Post by edmcguigan » Wed Jan 04, 2006 11:14 am

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 10149 times
Ed McGuigan

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

#82 Post by Levente » Mon Jan 09, 2006 3:29 am

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

Please help
Attachments
1.PNG
This is OK
1.PNG (31.49 KiB) Viewed 10059 times
2.PNG
Where are the settings ? IP, times to ping, protocol...etc ?
2.PNG (35.92 KiB) Viewed 10059 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: 14804
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

#83 Post by TheWitness » Mon Jan 09, 2006 7:19 am

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 MacTrack, Boost, CLog, SpikeKill, Platform RTM, DSStats, maintainer of Spine, lot's of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Central Plugin Repository
Central Templates Repository


I'm still out there people. Getting excited for Cacti 1.2. I think it will be a great release.

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

#84 Post by fozzy » Wed Jan 11, 2006 3:36 am

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:

#85 Post by Levente » Thu Jan 12, 2006 11:37 am

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:

#86 Post by fozzy » Thu Jan 12, 2006 11:44 am

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:

#87 Post by fozzy » Thu Jan 12, 2006 12:22 pm

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: 22375
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

#88 Post by gandalf » Thu Jan 12, 2006 2:30 pm

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:

#89 Post by fozzy » Fri Jan 13, 2006 6:47 am

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

#90 Post by datdat » Mon Jan 16, 2006 12:41 am

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