Graphs from script in cacti 1.x

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
miccia94
Posts: 2
Joined: Thu May 30, 2019 9:53 am

Graphs from script in cacti 1.x

Post by miccia94 »

Hello guys,

I'm using this shell script to graph traffic from a specific PPPoE session over a cisco router:

Code: Select all

#!/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
miccia94
Posts: 2
Joined: Thu May 30, 2019 9:53 am

Re: Graphs from script in cacti 1.x

Post by miccia94 »

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
tembarek
Posts: 1
Joined: Thu Nov 07, 2024 7:26 am

Re: Graphs from script in cacti 1.x

Post by tembarek »

Hello

can you share it please.
User avatar
macan
Cacti Guru User
Posts: 1106
Joined: Tue Mar 18, 2008 2:30 am
Location: Czech

Re: Graphs from script in cacti 1.x

Post by macan »

check HOW TOS on our documentation https://docs.cacti.net/
Let the Cacti grow!
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests