graphing string problem
Moderators: Developers, Moderators
graphing string problem
I need to parse a string value returned by an SNMP query to be graphed. The query/result is:
OID: 1.3.6.1.4.1.290.3.4.2.1.3.1.1.13 (only one index)
1: radioTemperature.1 (octet string) 50 C/122 F
***** SNMP PROMPT FOR OID-RESPONSE END *****
I need to parse the F value (122) and plot it. I have been doing some reading and it appears the only way to do this is via an external script. Is this correct?
Using 8.0.6e.
OID: 1.3.6.1.4.1.290.3.4.2.1.3.1.1.13 (only one index)
1: radioTemperature.1 (octet string) 50 C/122 F
***** SNMP PROMPT FOR OID-RESPONSE END *****
I need to parse the F value (122) and plot it. I have been doing some reading and it appears the only way to do this is via an external script. Is this correct?
Using 8.0.6e.
- TheWitness
- Developer
- Posts: 17007
- Joined: Tue May 14, 2002 5:08 pm
- Location: MI, USA
- Contact:
Are you going to be polling several of these devices?
TheWitness
TheWitness
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?
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?
Yes. I have written a perl script to query the device. Now I am having a problem with the value being returned. Firstly, I am not sure what the output of the script needs to be in order for cacti to process it. I have created the data input item as you can see, and I am passing the <hostname>. You can probably tell I am not much of a programmer I used the $ARGV[0] from other scripts I have seen on this board. Any help would is much appreciated.TheWitness wrote:Are you going to be polling several of these devices?
TheWitness
Output from log:
06/29/2005 09:55:55 PM - CMDPHP: Poller[0] Host[30] DS[193] CMD: /var/www/html/cacti/scripts/query_harris_temp.pl dls0301-rd3z2.fibertower.net, output: U
---------------------------------------------------------------------
Perl script:
#Perl Script - Query Harris Radio for Temp and parse output
#!/usr/bin/perl
$community = "public";
#$radio = $ARGV[0];
$radio = "10.20.23.2";
$mib = ".1.3.6.1.4.1.290.3.4.2.1.3.1.1.13";
$temp = `/usr/bin/snmpget -v 1 -c public $radio $mib`;
($temp2) = ($temp =~ m/"[0-9]+ C\/([0-9]+) F"/);
print $temp2 . "\n";
--------------------------------------------------
I also ommitted to include a sample output from the script. This script returns the SNMP value for the temperature of a microwave radio. As is, this script would return an integer (the result of the print statement) like "112". I have also tried returning a string like "Temp = 112", with the same result.
- TheWitness
- Developer
- Posts: 17007
- Joined: Tue May 14, 2002 5:08 pm
- Location: MI, USA
- Contact:
The return data is quite simple. It can either be a simple integer such as "20", or if you are creating an RRD file with multiple pieces of information, it takes the form:
Variable1:Value1 Variable2:Value2 ...
The output will be a group of Variable:Value pairs separated by a space. That method again allows for multiple values to be placed into a single RRD file.
TheWitness
Variable1:Value1 Variable2:Value2 ...
The output will be a group of Variable:Value pairs separated by a space. That method again allows for multiple values to be placed into a single RRD file.
TheWitness
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?
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?
I still can't get this figured out.
1. Is my use of ARGV[0] correct? This is the variable into which the <hostname> is read.
2. How is the output of the script passed back to Cacti? I have seen other people's scripts on this board, and they are using print functions to print values. Is this mere to for testing/debugging?
1. Is my use of ARGV[0] correct? This is the variable into which the <hostname> is read.
2. How is the output of the script passed back to Cacti? I have seen other people's scripts on this board, and they are using print functions to print values. Is this mere to for testing/debugging?
Hello?
Still getting the same error, and I have tried just about everything....
07/01/2005 11:25:35 AM - CMDPHP: Poller[0] Host[31] DS[201] CMD: /var/www/html/cacti/scripts/query_harris_temp.pl dls0309-rd3z1.fibertower.net, output: U
Sample script output (using above script):
harris_temp:89
Again...the hostname is input, and is defined as a Data Input in Cacti. harris_temp is defined as the Data Output in Cacti.
Can somebody give me a clue here?
Still getting the same error, and I have tried just about everything....
07/01/2005 11:25:35 AM - CMDPHP: Poller[0] Host[31] DS[201] CMD: /var/www/html/cacti/scripts/query_harris_temp.pl dls0309-rd3z1.fibertower.net, output: U
Sample script output (using above script):
harris_temp:89
Again...the hostname is input, and is defined as a Data Input in Cacti. harris_temp is defined as the Data Output in Cacti.
Can somebody give me a clue here?
bump.
I am tearing my hair out trying to figure this out.
Here is the log file extract:
07/05/2005 11:15:30 AM - CMDPHP: Poller[0] Host[31] DS[201] CMD: /var/www/html/cacti/scripts/query_harris_temp.pl dls0309-rd3z1.fibertower.net, output: U
07/05/2005 11:15:30 AM - CMDPHP: Poller[0] Host[31] DS[201] WARNING: Result from CMD not valid. Partial Result:
Here is the script:
#Perl Script - Query Harris Radio for Temp and parse output
#!/usr/bin/perl
$community = "public";
$mib = ".1.3.6.1.4.1.290.3.4.2.1.3.1.1.13";
$temp = `/usr/bin/snmpget -v 1 -c public $ARGV[0] $mib`;
($temp2) = ($temp =~ m/"[0-9]+ C\/([0-9]+) F"/);
print "harris_temp:" . $temp2 . "\n";
Here is sample output:
[jcotton@redhat scripts]$ perl query_harris_temp.pl dls0309-rd3z1.fibertower.net
harris_temp:86
Can anyone give me some help?
I am tearing my hair out trying to figure this out.
Here is the log file extract:
07/05/2005 11:15:30 AM - CMDPHP: Poller[0] Host[31] DS[201] CMD: /var/www/html/cacti/scripts/query_harris_temp.pl dls0309-rd3z1.fibertower.net, output: U
07/05/2005 11:15:30 AM - CMDPHP: Poller[0] Host[31] DS[201] WARNING: Result from CMD not valid. Partial Result:
Here is the script:
#Perl Script - Query Harris Radio for Temp and parse output
#!/usr/bin/perl
$community = "public";
$mib = ".1.3.6.1.4.1.290.3.4.2.1.3.1.1.13";
$temp = `/usr/bin/snmpget -v 1 -c public $ARGV[0] $mib`;
($temp2) = ($temp =~ m/"[0-9]+ C\/([0-9]+) F"/);
print "harris_temp:" . $temp2 . "\n";
Here is sample output:
[jcotton@redhat scripts]$ perl query_harris_temp.pl dls0309-rd3z1.fibertower.net
harris_temp:86
Can anyone give me some help?
- TheWitness
- Developer
- Posts: 17007
- Joined: Tue May 14, 2002 5:08 pm
- Location: MI, USA
- Contact:
post screen prints of your data input method and data template. Also, when you are only returning 1 value, you don't need the "Variable1" component.
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?
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?
I have corrected the script....sample output:TheWitness wrote:post screen prints of your data input method and data template. Also, when you are only returning 1 value, you don't need the "Variable1" component.
[jcotton@redhat scripts]$ perl query_harris_temp.pl dls0309-rd3z1.fibertower.net
99
Screen shots attached.
Thanks heaps.
Justin
[/img]
- Attachments
-
- Data Input Item
- cacti1.JPG (63.9 KiB) Viewed 4925 times
-
- Data Template
- cacti2.JPG (108.73 KiB) Viewed 4925 times
I am having a similar problem. I have a temperature sensor that was working (grpahing) before upgrade to 86f and now it doesn't. It just spits out one value like yours above so I removed the 'output field' value in the data input method for it as per what I think one of the responses above says, but it still doesn't graph. Works from the command line and that's about it.
- TheWitness
- Developer
- Posts: 17007
- Joined: Tue May 14, 2002 5:08 pm
- Location: MI, USA
- Contact:
There are some very important patches on the web site for 0.8.6f. Goto http://www.cacti.net/downloads/patches/ ... re-patched
TheWitness
TheWitness
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?
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?
Unfortunately, they don't do anything noticable to me. IE, I still have this problem.
I just found the problem. cactiuser couldn't find utils.pm. I placed it somewhere it could and now it works.
Hmm, well cactiuser is able to run the script and it gets output, however it still doesn't graph. Is it necessary to have an ouptput field defined in the data input if there is only one output? For example, only a single number to graph is output.
I just found the problem. cactiuser couldn't find utils.pm. I placed it somewhere it could and now it works.
Hmm, well cactiuser is able to run the script and it gets output, however it still doesn't graph. Is it necessary to have an ouptput field defined in the data input if there is only one output? For example, only a single number to graph is output.
Hello? Anyone have any idea about this?
This is the line in my debug log:
08/08/2005 02:10:29 PM - CMDPHP: Poller[0] Host[72] DS[1389] CMD: perl /var/www/html/cacti/scripts/check_temp.pl 10.13.210.210, output: 23.1
As you can see, a value is output however it is never graphed. I don't need to label the output right? Like "output: temp:23.1" and also in the data input method I do not have an output field defined. I'm pretty sure I've tried every combination of output field/no ouput field and label/no label.
This is the line in my debug log:
08/08/2005 02:10:29 PM - CMDPHP: Poller[0] Host[72] DS[1389] CMD: perl /var/www/html/cacti/scripts/check_temp.pl 10.13.210.210, output: 23.1
As you can see, a value is output however it is never graphed. I don't need to label the output right? Like "output: temp:23.1" and also in the data input method I do not have an output field defined. I'm pretty sure I've tried every combination of output field/no ouput field and label/no label.
Who is online
Users browsing this forum: No registered users and 0 guests