I think I'm missing a step creating the graph from a script

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

Moderators: Developers, Moderators

Post Reply
allxrt
Posts: 10
Joined: Mon Oct 03, 2022 4:00 am
Location: UK

I think I'm missing a step creating the graph from a script

Post by allxrt »

I think I'm nearly there, I have a cronjob that every 5 mins feeds in some stats from a raspberry pi in to to a file, I have set up a short bash script that basically reads the last line of the file. The script takes an argument in this case it is the MAC address of the raspberry pi so reads the correct log file.

I think I have created most of the steps I need but can't see how to create the graph itself as there isn't a host as such any help appreciated.

File:extract_probe_stats.sh $1 is the filename (mac address) that I would like to pass in the <rpi_mac> field on the data input which I beleive I declare in the Templates > Data Source > Data Template > Custom Data Field

#!/bin/bash
tail -1 ~/pythonScripts/rpimanager/cactiDs/ds/$1.ds

This will return the following data I will use for the data input:

freq:2.437 sig:79 uploadSen:2.04 uploadRec:1.65 dnloadSen:2.04 dnloadRec:1.65

I have created my Data Input method where it calls the shell script with my argument as <rpi_mac>:
Image


My input field looks like this:
Image

This is my data source template which I have created for each of the Mac addresses used for the custom data:
Image

Here are the data templates:
Image

And finally the graph template I have created, I will need to create one of these for each of the Raspberry Pis I am collecting stats on:
Image
allxrt
Posts: 10
Joined: Mon Oct 03, 2022 4:00 am
Location: UK

Re: I think I'm missing a step creating the graph from a script

Post by allxrt »

I will definitely create a howto guide, if someone can help me through this last step.

Please let me know if I need to explain my question better, I appreciate this might be a bit time consuming to read :)
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: I think I'm missing a step creating the graph from a script

Post by TheWitness »

Check your poller item table for entries, if using spine, run it like this as the apache account. It could be permissions, or you may have spine compiled to not source the environment, in which case, you need to use the full command, for example /bin/tail.

Code: Select all

./spine -R -V 3 -S -f device_id -l device_id
Replace device_id with the id of the device in question.
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
allxrt
Posts: 10
Joined: Mon Oct 03, 2022 4:00 am
Location: UK

Re: I think I'm missing a step creating the graph from a script

Post by allxrt »

Thanks for your reply, I've checked permissions and I'm not currently using spine, but I think what is different to my old deployment is that there doesn't appear to be an 'Add Data Source' under the management section, is this hidden or moved somewhere else? I think the issue is that I'm not sure how to use the created template on the new version.

This is my older exisiting version with the add button

Image

This then takes me to this screen where I can specify the datasource template to use if it's not attached to a device

Image

This is my latest deployment using a later version where I'm unable to find the add button(I'm guessing there is a new way to create a data source?)

Image
allxrt
Posts: 10
Joined: Mon Oct 03, 2022 4:00 am
Location: UK

Re: I think I'm missing a step creating the graph from a script

Post by allxrt »

Actually I think I have found it this is where the new data source is created.

Although this doesn't show in my data sources list Management > Data Source?

I will re-check permissions, assuming once a data source is created as below it should active the script somewhere - I will try to active debug to see if it gives any messages


Image
allxrt
Posts: 10
Joined: Mon Oct 03, 2022 4:00 am
Location: UK

Re: I think I'm missing a step creating the graph from a script

Post by allxrt »

Sorry for the constant barrage of messages.. shouldn't the data source I created show in the Troubleshooting > Data Sources section?
allxrt
Posts: 10
Joined: Mon Oct 03, 2022 4:00 am
Location: UK

Re: I think I'm missing a step creating the graph from a script

Post by allxrt »

After having another look the old data template did have a data source within it shown below, so that brings me back to whether I'm missing an add button under the managment > data sources section ?

Image
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: I think I'm missing a step creating the graph from a script

Post by TheWitness »

The way I do it is create a Template and then instantiate it at the Device level. Much easier than hand tooling a Graph and Data Source. Scales better too...
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest