SOLVED: Help with Script Data Queries

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

Moderators: Developers, Moderators

User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

You may even want to delete those very table entries to perform a clean restart
Reinhard
shull
Cacti User
Posts: 54
Joined: Thu Aug 24, 2006 1:20 am
Location: South Texas
Contact:

Post by shull »

Man,

I really appreciate you taking the time for this!

Here are the query results you asked for. I ran it through phpMyAdmin.

Code: Select all

 
3	11	ifDescr			10:FastEthernet0/10	
3	11	ifDescr			11:FastEthernet0/11	
3	11	ifDescr			12:FastEthernet0/12	
3	11	ifDescr			13:Null0	
3	11	ifDescr			14:Vlan1	
3	11	ifDescr			1:FastEthernet0/1	
3	11	ifDescr			2:FastEthernet0/2	
3	11	ifDescr			3:FastEthernet0/3	
3	11	ifDescr			4:FastEthernet0/4	
3	11	ifDescr			5:FastEthernet0/5	
3	11	ifDescr			6:FastEthernet0/6	
3	11	ifDescr			7:FastEthernet0/7	
3	11	ifDescr			8:FastEthernet0/8	
3	11	ifDescr			9:FastEthernet0/9	
3	11	ifIndex			10:10	
3	11	ifIndex			11:11
3	11	ifIndex			12:12
3	11	ifIndex			13:13
3	11	ifIndex			14:14
3	11	ifIndex			1:01
3	11	ifIndex			2:02
3	11	ifIndex			3:03
3	11	ifIndex			4:04
3	11	ifIndex			5:05
3	11	ifIndex			6:06
3	11	ifIndex			7:07
3	11	ifIndex			8:08
3	11	ifIndex			9:09
3	11	ifPhysAddress		10:0x000c852890ca
3	11	ifPhysAddress		11:0x000c852890cb
3	11	ifPhysAddress		12:0x000c852890cc
3	11	ifPhysAddress		13:00
3	11	ifPhysAddress		14:0x000c852890c0
3	11	ifPhysAddress		1:0x000c852890c1
3	11	ifPhysAddress		2:0x000c852890c2
3	11	ifPhysAddress		3:0x000c852890c3
3	11	ifPhysAddress		4:0x000c852890c4
3	11	ifPhysAddress		5:0x000c852890c5
3	11	ifPhysAddress		6:0x000c852890c6
3	11	ifPhysAddress		7:0x000c852890c7
3	11	ifPhysAddress		8:0x000c852890c8
3	11	ifPhysAddress		9:0x000c852890c9
3	11	ifSpeed			10:100000000
3	11	ifSpeed			11:10000000
3	11	ifSpeed			12:100000000
3	11	ifSpeed			13:4294967295
3	11	ifSpeed			14:1000000000
3	11	ifSpeed			1:100000000
3	11	ifSpeed			2:100000000
3	11	ifSpeed			3:10000000
3	11	ifSpeed			4:10000000
3	11	ifSpeed			5:10000000
3	11	ifSpeed			6:10000000
3	11	ifSpeed			7:100000000
3	11	ifSpeed			8:10000000
3	11	ifSpeed			9:10000000
3	11	ifStatus		10:01
3	11	ifStatus		11:02
3	11	ifStatus		12:01
3	11	ifStatus		13:01
3	11	ifStatus		14:01
3	11	ifStatus		1:02
3	11	ifStatus		2:01
3	11	ifStatus		3:02
3	11	ifStatus		4:02
3	11	ifStatus		5:02
3	11	ifStatus		6:02
3	11	ifStatus		7:01
3	11	ifStatus		8:02
3	11	ifStatus		9:02
3	11	ifType			10:06
3	11	ifType			11:06
3	11	ifType			12:06
3	11	ifType			13:01
3	11	ifType			14:53
3	11	ifType			1:06
3	11	ifType			2:06
3	11	ifType			3:06
3	11	ifType			4:06
3	11	ifType			5:06
3	11	ifType			6:06
3	11	ifType			7:06
3	11	ifType			8:06
3	11	ifType			9:06

Also, If I need to be lookign for something, please let me know. I am more than happy to do any dirty work on this issue to find out why it isn't working.

Thanks again!


-Stephen
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

And here's what it should look like

Code: Select all

host_id 	snmp_query_id 	field_name 	field_value 	snmp_index 	oid
2 	10 	ifDescr 	lo 	1 	 
2 	10 	ifDescr 	irda0 	2 	 
2 	10 	ifDescr 	eth0 	3 	 
2 	10 	ifIndex 	1 	1 	 
2 	10 	ifIndex 	2 	2 	 
2 	10 	ifIndex 	3 	3 	 
2 	10 	ifPhysAddress 	  	1 	 
2 	10 	ifPhysAddress 	  	2 	 
2 	10 	ifPhysAddress 	0x00096b86fe89 	3 	 
2 	10 	ifSpeed 	10000000 	1 	 
2 	10 	ifSpeed 	0 	2 	 
2 	10 	ifSpeed 	100000000 	3 	 
2 	10 	ifStatus 	1 	1 	 
2 	10 	ifStatus 	2 	2 	 
2 	10 	ifStatus 	1 	3 	 
2 	10 	ifType 	24 	1 	 
2 	10 	ifType 	1 	2 	 
2 	10 	ifType 	6 	3 	 
See the difference? The parsing obviously went wrong. Please delete those lines from that very table. Then press the green circle as mentioned above and re-run your query (numbers may have changed)
Reinhard
shull
Cacti User
Posts: 54
Joined: Thu Aug 24, 2006 1:20 am
Location: South Texas
Contact:

Post by shull »

I cleared the table and still the same issue.

So the values need to NOT have the colon ( : ) in the results? Does that mean the output needs to look like:


45
67
56
45
46546


instead of my output:

1:45
2:67
3:56
4:45
5:46546


I thought that according to the docs, the output needed to be in the format like my output, with a delimeter defined in the XML file?


If I run my script, say with these parameters, which my script supports, what should my output be?

Currently, if I run:

./script1.pl 192.168.1.250 public query ifSpeed

I get the following output on the command line:


1:1000000
2:1000000
3:1000000
4:1000000
5:1000000
6:1000000


Is this wrong? I went by the docs and the example.

Please give me direction. If I understood what Cacti was looking for in each instance, I could probably fix this, and I would even write a detailed description of how Script Data Queries operate.


Thanks,


Stephen
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

I feared this would be happening.
IMHO, your script is quite correct. The first issue is to perform the script call with parameter "index". It should report a list of simple integers, then. And your script does exactly this.
I did some code debugging within cacti; changed the delimiter from ":" to "!" and back. And woooops, suddently everything went fine.
Then I changed back everything, and still it was fine.
That led me to my assumption above. But, you know, things will NEVER turn out to be that easy. So I will have to debug it again. This time, I will spend more time on each step.
To be honest, I changed some lines of your XML in the meantime. Will have to verify, if this cured it ...
Reinhard
shull
Cacti User
Posts: 54
Joined: Thu Aug 24, 2006 1:20 am
Location: South Texas
Contact:

Post by shull »

Thanks for this!

I really hate sitting on the sidelines and letting everyone else do the work. Is there anything that I can do to help debug this? Can I put together some samples to help test out what is going on?

Thanks again for the help. I will keep trying on my side to pick through this. Please let me know what I can do to help.

-Stephen
shull
Cacti User
Posts: 54
Joined: Thu Aug 24, 2006 1:20 am
Location: South Texas
Contact:

Post by shull »

I Got It!!!!!


OK, Here is the deal.

This is what was breaking the whole entire script query.

It was an error in the XML file. I used the spelling of:

delimiter



The correct word is:

delimeter (Notice the "e" in meter instead of the "i")




I can't believe something like that broke the whole script query. I ran into this problem when putting together the XML file where Cacti requires the word and the case to be exact. I would have thought some debugging in logs would have revealed this. Apparently not.

Anyway, I now am starting to see results.


Reinhard, Thanks for all of your help! I will be sure to try and return the favor in the future.

-Stephen
User avatar
TheWitness
Developer
Posts: 16997
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Yea, I noted this as well a few years ago. It's one of those bugs that you just "Hate" to fix and before my time, or maybe not. Too long ago...

Gandolf, the way it looks, I will be driving from the Netherworld into the southlands sometime on the evening of Friday, October 5th for 1.5 days of who knows what, before having to again drive to the land that includes that big tower thing.

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?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest