Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Wed Jun 19, 2019 1:53 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Graphs from script in cacti 1.x
PostPosted: Thu May 30, 2019 10:01 am 
Offline

Joined: Thu May 30, 2019 9:53 am
Posts: 2
Hello guys,

I'm using this shell script to graph traffic from a specific PPPoE session over a cisco router:
Code:
#!/bin/sh
#
# Find a user's in/out traffic by username.
# Syntax:
# pppoetraffic.sh <router ip> <snmp community> <snmp version> <username>

ROUTER=$1
ROCOMMUNITY=$2
SNMPVERSION=$3c
USERNAME=$4

SNMPWALK="/usr/bin/snmpwalk"
SNMPGET="/usr/bin/snmpget"

USERID=`$SNMPWALK -On -v $SNMPVERSION -c $ROCOMMUNITY $ROUTER 1.3.6.1.4.1.9.9.150.1.1.3.1.2 | grep "\"$USERNAME\"" | cut -f1 -d'=' | sed 's/.1.3.6.1.4.1.9.9.150.1.1.3.1.2.//'`

if [ "$USERID" != "" ]
then
  IFNUM=`$SNMPGET -Oqv -v $SNMPVERSION -c $ROCOMMUNITY $ROUTER 1.3.6.1.4.1.9.9.150.1.1.3.1.8.$USERID`
else
  IFNUM=0
fi

if [ "$IFNUM" = "0" ]
then
  INOCTETS=0
  OUTOCTETS=0
else
  INOCTETS=`$SNMPGET -Oqv -v $SNMPVERSION -c $ROCOMMUNITY $ROUTER IF-MIB::ifInOctets.$IFNUM`
  OUTOCTETS=`$SNMPGET -Oqv -v $SNMPVERSION -c $ROCOMMUNITY $ROUTER IF-MIB::ifOutOctets.$IFNUM`
fi

echo "in_traffic:$INOCTETS out_traffic:$OUTOCTETS"


I have a Data Input Methods template which read values from script and then i have a data source template which use the data input method to store data in rrd, also i have a graph template to show graphs.

Il older version ( I was using 0.8.8h) i was able to create a new data source and and then create the graph from the graph management page and selecting the data source.
In the new version (Im on 1.2.3) i still can create the data source manually, but i cant create the graph cause i dont see my graph template.

How can i graph these data source now?

Thanks for the help


Top
 Profile  
 
 Post subject: Re: Graphs from script in cacti 1.x
PostPosted: Thu May 30, 2019 11:12 am 
Offline

Joined: Thu May 30, 2019 9:53 am
Posts: 2
I got it working redoing all from scratch. Now it works, i can create the data source manually, then while creating the graph i just need to change the data source


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

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 9 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