Get SNMP Data Input works, perl script/command doesn't?

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

Moderators: Developers, Moderators

Post Reply
hackerkatt
Posts: 24
Joined: Tue Sep 30, 2008 10:23 pm

Get SNMP Data Input works, perl script/command doesn't?

Post by hackerkatt »

Hi all,

I've discovered Cacti and I am going "what else can I think to graph" crazy. I am confused as to why one method of Data Input works while another doesn't. Perhaps someone can enlighten me. Keep in mind that there may be a much better way to do this, i.e. SNMP Indexed queries, etc. I don't understand the use and building of the XML files yet, so I'm starting out with the basics. But I believe that they can be a powerful and flexible method to use. Anyway, my problem:

Preliminary:

OS: FreeBSD 7
Apache 2.2.9
Cacti 8.6.? Not sure how to locate
Spine: Y cactid
MySQL: 4.1.22
PHP: 5.2.1 Zend Eng. 2.2.0
RRDTool 1.2
Net-SNMP: 5.4.1.2
Plugin Architecture: None

I have a perl script that returns a set of data. Below: (Run as cacti)

Code: Select all

$ /usr/local/bin/perl /usr/local/share/cacti/scripts/apc_ups_status.pl --community-- --host-- 
status:2 cap:100 temp:26 volt:121 freq:60 load:50 in_line_volt:121 in_min_volt:118 in_max_volt:123 batvolt:27
Cacti Log

Code: Select all

10/05/2008 10:40:09 PM - CACTID: Poller[0] Host[201] DS[2060] SCRIPT: /usr/local/bin/perl /usr/local/share/cacti/scripts/apc_ups_status.pl, output: U
I've run DEBUG mode and no additional information was produced. I ran across a post that suggested that there was a problem with not fully pathing a command "inside" the script. I can't see how Cacti cares unless it's reading the script and running the contents on it's own rather than looking for a result. In any case I fully pathed the snmpget command. No luck. I tried a \n at the end of the output string, no luck there either.

As you can see I get the information I want when run from the command line. I tried this script method with another graph project and ended up creating two separate Get SNMP Data input methods. This graph has a number of data inputs and I don't know of another way other than a separate Get SNMP Data for each data input. My attempt before to have multiple "tabs" data inputs I found that I could not have different OID's. Each time I changed the OID on one tab/data input, it changed it for all the tabs. No doubt I'm missing both knowledge and experience with Cacti. Can you nice folks steer me in the right direction?

I have put together a set of graphs for our MailFoundy Spam Appliance which I used a simple LWP method. And I've put together some weather graphs. I want to post them on this forum but thought I would get a bit more proficient and perhaps find that I need to clean them up before posting. Anyway, any help you can direct this way would be greatly appreciated. Thanks all.

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

Post by TheWitness »

Your perl script must return the data all at once. The following is NOT allowed:

print("ValA:$VarA");
print(" ValB:$VarB");
...

It must be rather:

print("ValA:$VarA ValB:$VarB");

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?
hackerkatt
Posts: 24
Joined: Tue Sep 30, 2008 10:23 pm

Post by hackerkatt »

Thanks for your reply. :D In response, I am. No new lines or separate print statements:

Code: Select all

$output = "status:$status cap:$cap temp:$temp volt:$volt freq:$freq load:$load in_line_volt:$in_line_volt in_min_volt:$in_min_volt in_max_volt:$in_max_volt batvolt:$batvolt";
$output =~ s/\n//g;

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

Post by TheWitness »

What version of Cactid? What version of Cacti?

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?
hackerkatt
Posts: 24
Joined: Tue Sep 30, 2008 10:23 pm

Post by hackerkatt »

I am at:

Code: Select all

Cacti: cacti-0.8.6h_41
Cactid: 0.8.6f
HK
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

You may want to look at a more recent Cactid.

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?
hackerkatt
Posts: 24
Joined: Tue Sep 30, 2008 10:23 pm

Post by hackerkatt »

Thanks for following up on this. We are an ISP. Don't really want risk breaking things as we heavily relay on monitoring to manage our network. I'm working on building a new Nagios/Cacti server. In the meantime, I will just set up Get SNMP Data for each oid I need. And extend SNMP where I needed when I would ordinarily get data via a script; in such cases where a script is failing. Thanks again.

HK
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest