Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Sun Apr 21, 2019 3:36 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Display ping status on weathermap
PostPosted: Tue Jul 24, 2018 3:59 pm 
Offline

Joined: Mon Oct 27, 2014 4:04 pm
Posts: 9
Hello,

Could someone help me with a simple code to display the ping status (not latency) of an IP address ?

I would like to know if my servers, routers, NAS, etc are pinging or timing out. I'm going to use a scale with 2 icons, 1 red and 1 green.

can I query from the weathermap script directly or do I have to setup every units in cacti first?

Ideally if I could query from an external web server where my cacti setup is installed and ping to TCP/UDP through a forward in the router of the remote location.

Thanks,


Top
 Profile  
 
 Post subject: Re: Display ping status on weathermap
PostPosted: Tue Jul 24, 2018 4:51 pm 
Offline
Cacti Guru User
User avatar

Joined: Thu Sep 16, 2004 5:53 am
Posts: 5300
Location: United Kingdom
Do you mean ping (ICMP) or do you want TCP/UDP?

For actual ping, you can use the fping datasource built in to Weathermap (see the Targets page in the manual). You'll need to install fping.

If the devices are in Cacti, you can use Cacti's status too, using the cactihost: datasource (same page in the manual).

If you want to actually bounce packets off of TCP or UDP ports, you'd need something else. I think smokeping might do this for you, but that's quite a bit to get going.

_________________
Weathermap 0.98 is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)


Top
 Profile  
 
 Post subject: Re: Display ping status on weathermap
PostPosted: Wed Jul 25, 2018 9:55 am 
Offline

Joined: Mon Oct 27, 2014 4:04 pm
Posts: 9
Hello Howie,

Thanks for the quick answer. I finally got Advanced Ping to work and it really looks like smokeping. Now I have my data in cacti, but I'm not sure how to paste the good info in the weathermap.

How should I use "TARGET" so that I have the most accurate average of the last minute ping result ?.. I'm not getting the proper output.. I tried: :loss:- and :-:loss

here's working TCP Ping:

Image

Here's timing out TCP Ping:

Image

My code

Code:
SET nowarn_clipping 1
SET snmp_abort_count 4
HTMLSTYLE overlib
TITLE Ping Status

# The SNMP community
SET community cacti

#
# Scale that maps the SNMP state numbers to colours
#

FONTDEFINE 66 /usr/share/cacti/site/plugins/weathermap/VeraSe.ttf 8

SCALE PING 0 95 255 255 255 images/green.png
SCALE PING 96 100 255 255 255 images/red.png

NODE DC
        USESCALE PING absolute
   POSITION 164 361
   TARGET gauge:/var/lib/cacti/rra/dion_-_dc_loss_733.rrd:loss:-
   ICON {node:this:inscaletag}

NODE ESXI
        USESCALE PING absolute
   POSITION 358 361
   TARGET gauge:/var/lib/cacti/rra/dion_-_esxi_host_-_ping_loss_736.rrd:loss:-
   ICON {node:this:inscaletag}
 


Top
 Profile  
 
 Post subject: Re: Display ping status on weathermap
PostPosted: Wed Jul 25, 2018 1:03 pm 
Offline
Cacti Guru User
User avatar

Joined: Thu Sep 16, 2004 5:53 am
Posts: 5300
Location: United Kingdom
Rule 0: What do the logs say?

In this case, if the DS name is wrong, the rrdtool datasource will tell you, and also tell you what the valid choices are.

_________________
Weathermap 0.98 is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)


Top
 Profile  
 
 Post subject: Re: Display ping status on weathermap
PostPosted: Wed Jul 25, 2018 3:51 pm 
Offline

Joined: Mon Oct 27, 2014 4:04 pm
Posts: 9
Thanks for your patience Howie, I'm not a very good programmer and my linux skills are very low.

the Data Source says: (I use the DS:loss)

Code:
Data Source Debug
/usr/bin/rrdtool create \
/var/lib/cacti/rra/dion_-_dc_loss_733.rrd \
--step 60  \
DS:loss:GAUGE:120:0:100 \
DS:avg:GAUGE:120:0:500 \
DS:max:GAUGE:120:0:500 \
DS:dev:GAUGE:120:0:500 \
DS:min:GAUGE:120:0:500 \
RRA:AVERAGE:0.5:1:600 \
RRA:AVERAGE:0.5:6:700 \
RRA:AVERAGE:0.5:24:775 \
RRA:AVERAGE:0.5:288:797 \
RRA:MAX:0.5:1:600 \
RRA:MAX:0.5:6:700 \
RRA:MAX:0.5:24:775 \
RRA:MAX:0.5:288:797 \


There's no error on the weathermap poller, on cacti's side I have:

Code:
07/25/2018 05:14:10 PM - CMDPHP: Poller[0] Host[54] DS[736] SERVER: /usr/share/cacti/site/scripts/ss_fping.php ss_fping xx.xx.xx.xx 20 TCP 10080, output: min:9.3400 avg:9.6855 max:9.8700 dev:0.1345 loss:0.0000


is there a way to paste in weathermap the value of what is in the RRD?.. which info weathermap is reading?

I'd like to be able to get the average of the last minute in %.. so if in the last minute it's 100% loss, it shows red icon.png and under 95% green.png


Top
 Profile  
 
 Post subject: Re: Display ping status on weathermap
PostPosted: Wed Jul 25, 2018 4:37 pm 
Offline
Cacti Guru User
User avatar

Joined: Thu Sep 16, 2004 5:53 am
Posts: 5300
Location: United Kingdom
If weathermap is running the map, and there is a problem reading data, it'll log a warning in the cacti.log

To see more information, you can enable DEBUG logging in Cacti (don't leave it on - it generates a lot of data), then wait for one poll (usually 5 minutes) and look at cacti.log

You should see lines starting with ReadDataFromRRD that will tell you what is being read, and what numbers are being used.

But your TARGET should look something like:

Code:
# a scale for loss - 0=green, <30% yellow, >=30% red
SCALE updown 0 0  0 255 0
SCALE updown 0 30 255 255 0
SCALE updown 30 100 255 0 0

NODE xxx
   TARGET /var/lib/cacti/rra/dion_-_dc_loss_733.rrd:loss:-
   MAXVALUE 100
   USESCALE updown in
   # POSITION etc..

_________________
Weathermap 0.98 is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)


Top
 Profile  
 
 Post subject: Re: Display ping status on weathermap
PostPosted: Wed Jul 25, 2018 4:45 pm 
Offline

Joined: Mon Oct 27, 2014 4:04 pm
Posts: 9
Oh.. I think I got it !

let me run more tests .. but I should be fine.

I think that my issue was from the Down device detection in DEVICES.. I was setting it up with ping as well.. but when cacti can't reach the unit, it won't log the data in the RRD..

I set it to NONE, and the data source collection runs everytime.

thanks again.


Top
 Profile  
 
 Post subject: Re: Display ping status on weathermap
PostPosted: Wed Jul 25, 2018 5:10 pm 
Offline
Cacti Guru User
User avatar

Joined: Thu Sep 16, 2004 5:53 am
Posts: 5300
Location: United Kingdom
Yeah, that is the benefit of using the weathermap fping datasource. But if you also want graphs, Cacti is the way to go.

_________________
Weathermap 0.98 is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group