Custom parameters to a script server query
Moderators: Developers, Moderators
Custom parameters to a script server query
Hi,
Any of you knows a way to give custom parameters to a query script, executed through the PHP script server, from a DataTemplate or DataQuery ?
What I mean is, I created a new data input method with some custom input fields, those fields gets created for each datasources and I wish I could get them from my script.
I tried with the xml tag <arg_prepend> inside my XML dataquery definition but it did not work. It seems I can only fetch variables from the host.
Regards,
Jon.
Any of you knows a way to give custom parameters to a query script, executed through the PHP script server, from a DataTemplate or DataQuery ?
What I mean is, I created a new data input method with some custom input fields, those fields gets created for each datasources and I wish I could get them from my script.
I tried with the xml tag <arg_prepend> inside my XML dataquery definition but it did not work. It seems I can only fetch variables from the host.
Regards,
Jon.
- TheWitness
- Developer
- Posts: 17007
- Joined: Tue May 14, 2002 5:08 pm
- Location: MI, USA
- Contact:
Yes, for a regular script you can provide additional input variables, but for a Data Query you currently can not. I've needed this a few times myself and sadly don't have time at the moment to fix it.
However, there is hope. Please goto http://bugs.cacti.net and request that a feature be added to allow additional input parameters to a Data Query. No promises, but we will have the request.
TheWitness
However, there is hope. Please goto http://bugs.cacti.net and request that a feature be added to allow additional input parameters to a Data Query. No promises, but we will have the request.
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?
- gandalf
- Developer
- Posts: 22383
- Joined: Thu Dec 02, 2004 2:46 am
- Location: Muenster, Germany
- Contact:
So this is a Script Server Data Query? At least, all |host_*| parameters should be resolved as they are static with regard to running a script.artagel wrote:Hi,
I'm actually trying to pass some args from my a query I have to a get call. I can't seem to do it using arg_prepend.
I want to have the arg_prepend pass |query_ifindex| |query_ifvpi| |query_ifvci|
Anyway to pass non-host args yet? The most recent post I can find on this is this one from 2002.
ifIndex should be passed by the get request, then. But if you have "multiple indexes" like "index, vpi, vci", things get worse.
We do support "multiple indexes" with SNMP Data Queries as long as they can be handles as a "single string", e.g. "OID1.OID2.OID3". In this case, we use the whole string as the index.
This may be extended to Script (Server) Data Queries. but in this case again we would not use arg_prepend in the suggested way.
R.
Yes, It's a script server data query.
The problem is that my devices only have a high level PVC traffic mib that tells me in/out bytes, etc, but doesn't tell give me an index of ifindex/vpi/vci I need to properly call it in snmp.
the oid is like this: oid.ifindex.vpi.vci
The ifindex vpi and vci change every query.
All of the |host* queries work, but I was hoping to append the get with the ifindex.vpi.vci so the script server can append that to the oid when doing the cacti_snmp_get.
My solution with pulling the data from the sql server is currently working, but if my snmp_query_index changes I'd have to update that in the script.
-Dan
The problem is that my devices only have a high level PVC traffic mib that tells me in/out bytes, etc, but doesn't tell give me an index of ifindex/vpi/vci I need to properly call it in snmp.
the oid is like this: oid.ifindex.vpi.vci
The ifindex vpi and vci change every query.
All of the |host* queries work, but I was hoping to append the get with the ifindex.vpi.vci so the script server can append that to the oid when doing the cacti_snmp_get.
My solution with pulling the data from the sql server is currently working, but if my snmp_query_index changes I'd have to update that in the script.
-Dan
- gandalf
- Developer
- Posts: 22383
- Joined: Thu Dec 02, 2004 2:46 am
- Location: Muenster, Germany
- Contact:
How do you detemine the current "ifIndex.vpi.vci", then?artagel wrote:Yes, It's a script server data query.
The problem is that my devices only have a high level PVC traffic mib that tells me in/out bytes, etc, but doesn't tell give me an index of ifindex/vpi/vci I need to properly call it in snmp.
the oid is like this: oid.ifindex.vpi.vci
The ifindex vpi and vci change every query.
Is it ok to post the script to understand better?
R.
Here is the script and script server xml.
-Dan
-Dan
- Attachments
-
- ss_pvcpol.php.txt
- (9.78 KiB) Downloaded 97 times
-
- pvc.xml
- (1.75 KiB) Downloaded 165 times
- gandalf
- Developer
- Posts: 22383
- Joined: Thu Dec 02, 2004 2:46 am
- Location: Muenster, Germany
- Contact:
Re: Custom parameters to a script server query
There are some new upcoming features; find them here: http://docs.cacti.net/manual:088:3a_adv ... xml_syntax
Does this help?
R.
Does this help?
R.
Re: Custom parameters to a script server query
I found this trick, which doesn't require modifying any cacti code and is a simple solution http://forums.cacti.net/viewtopic.php?f=6&t=55704
Technical Support
General Information
Date Wed, 02 Mar 2016 13:35:32 -0500
Cacti Version 0.8.8f
Cacti OS win32
SNMP Version NET-SNMP version: 5.5
RRDTool Version RRDTool 1.4.x
Hosts 4
Graphs 34
Data Sources Script - Script Server (PHP): 16
Script Query - Script Server: 18
Total: 34
Poller Information
Interval 60
Type cmd.php
Items Action[2]: 72
Total: 72
Concurrent Processes 8
Max Threads 4
PHP Servers 4
Script Timeout 25
Max OID 10
Last Run Statistics Time:12.0814 Method:cmd.php Processes:8 Threads:N/A Hosts:5 HostsPerProcess:1 DataSources:72 RRDsProcessed:30
PHP Information
PHP Version 5.5.20
PHP OS WINNT
PHP uname Windows NT MIHQDBMONITOR01 6.3 build 9200 (Windows Server 2012 R2 Standard Edition) AMD64
PHP SNMP Installed
max_execution_time 60
memory_limit 512M
General Information
Date Wed, 02 Mar 2016 13:35:32 -0500
Cacti Version 0.8.8f
Cacti OS win32
SNMP Version NET-SNMP version: 5.5
RRDTool Version RRDTool 1.4.x
Hosts 4
Graphs 34
Data Sources Script - Script Server (PHP): 16
Script Query - Script Server: 18
Total: 34
Poller Information
Interval 60
Type cmd.php
Items Action[2]: 72
Total: 72
Concurrent Processes 8
Max Threads 4
PHP Servers 4
Script Timeout 25
Max OID 10
Last Run Statistics Time:12.0814 Method:cmd.php Processes:8 Threads:N/A Hosts:5 HostsPerProcess:1 DataSources:72 RRDsProcessed:30
PHP Information
PHP Version 5.5.20
PHP OS WINNT
PHP uname Windows NT MIHQDBMONITOR01 6.3 build 9200 (Windows Server 2012 R2 Standard Edition) AMD64
PHP SNMP Installed
max_execution_time 60
memory_limit 512M
Who is online
Users browsing this forum: anwaraahmad1 and 0 guests