Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Thu Dec 14, 2017 11:57 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Graph creation from ping response (up / down)
PostPosted: Mon Sep 25, 2017 2:02 pm 
Offline

Joined: Wed Sep 20, 2017 2:59 pm
Posts: 8
Hi Cactians
Cacti v 1.0

Looking for help with creating a graph for device status. I know you can see the status in the device management page, looking to turn this into a graph format to use on a tree.

Any help would be greatly appreciated

Script created below, returns Up or Down as response. Used the ping ms script as a template

How would i go about getting this graphed?


#!/usr/bin/env perl

delete @ENV{qw(PATH)};
$ENV{PATH} = "/usr/bin:/bin:/sbin";
$path = $ENV{'PATH'};

# take care for tcp:hostname or TCP:[email protected]
$host = $ARGV[0];
$host =~ s/tcp:/$1/gis;

# leave IPv6 in tact
if (($host =~ tr/:://) == 0) {
$host =~ s/:[0-9]{1,5}/$1/gis;
}

# Addition2
($host) = $host =~ /^([\w.-]+)$/;

# always have the language in english
$ENV{LANG}='en_US.UTF-8';

# old linux version use 'icmp_seq'
# newer use 'icmp_req' instead
open(PROCESS, "ping -c 1 $host 2>&1 | grep -E '(icmp_[s|r]eq.*time|unknown host|Unknown host)' 2>/dev/null |");
$ping = <PROCESS>;
close(PROCESS);

if ($ping == 0) {
print "Up";
}else{
print "Down";
}


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

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