Custom data input value automatically inserted
Moderators: Developers, Moderators
Custom data input value automatically inserted
Hello,
I'm having a SNMP query retrieving several information:
Network Id CPA Linecard Name
1 4 Test Rx 4 Lk
1 82 Test Rx 5 Lk
1 83 Test Rx 6 Lk
Then i configured a data input method based on a php script using arguments (host ip address and CPA number). In my data template i can tell cacti to use the host ip address automatically but i have to enter the CPA number for each graph. Is there a way to automatically retrieve my CPA number out of that table?
Thanking you
Morya
I'm having a SNMP query retrieving several information:
Network Id CPA Linecard Name
1 4 Test Rx 4 Lk
1 82 Test Rx 5 Lk
1 83 Test Rx 6 Lk
Then i configured a data input method based on a php script using arguments (host ip address and CPA number). In my data template i can tell cacti to use the host ip address automatically but i have to enter the CPA number for each graph. Is there a way to automatically retrieve my CPA number out of that table?
Thanking you
Morya
Re: Custom data input value automatically inserted
Is the following topic similar to yours?
- http://forums.cacti.net/viewtopic.php?f=21&t=44887
- http://forums.cacti.net/viewtopic.php?f=21&t=44887
Re: Custom data input value automatically inserted
Hi noname,
It is not for the graph title. I use 2 arguments with my PHP script. The hostname and the so called "CPA" number (retrieve by a SNMP query). For the hostname (IP address) it is not a problem as it is build in cacti. For the CPA number i have to enter it manually each time i create a graph. I'm just wondering if this could be automated by somehow retrieving the CPA number out of my SNMP query (input direction).
Hope it is clear engough.
Thanking you
It is not for the graph title. I use 2 arguments with my PHP script. The hostname and the so called "CPA" number (retrieve by a SNMP query). For the hostname (IP address) it is not a problem as it is build in cacti. For the CPA number i have to enter it manually each time i create a graph. I'm just wondering if this could be automated by somehow retrieving the CPA number out of my SNMP query (input direction).
Hope it is clear engough.
Thanking you
Re: Custom data input value automatically inserted
Ah, (maybe) I see.
You're using "Data Input Method" and execute your script like this...
...but you will have to specify <cpa_number> as "Custom Data" for each datasources when creating graphs. (correct?)
Hmm,
if one parameter is known, then the other parameter can be known?
In other words -- are you able to retrieve a CPA number from IP address of the host?
If so, I guess you can specify <host> only for the script on Cacti by retrieving CPA number within the script.
You're using "Data Input Method" and execute your script like this...
Code: Select all
php <path_cacti>/scripts/your_script.php <host> <cpa_number>
Hmm,
if one parameter is known, then the other parameter can be known?
In other words -- are you able to retrieve a CPA number from IP address of the host?
If so, I guess you can specify <host> only for the script on Cacti by retrieving CPA number within the script.
Re: Custom data input value automatically inserted
You're right i'm running a script like this...
mysript.php <host> <cpa_number>
And yes the cpa number is handled as "Custom Data". Per a single host i can have up to 400 or 500 different "CPAs". But yes i'm able to retrieve all CPA from the host with a SNMP query.
mysript.php <host> <cpa_number>
And yes the cpa number is handled as "Custom Data". Per a single host i can have up to 400 or 500 different "CPAs". But yes i'm able to retrieve all CPA from the host with a SNMP query.
Re: Custom data input value automatically inserted
Hmm.. What about using "Data Queries" instead of "Data Input Method"?morya wrote:Per a single host i can have up to 400 or 500 different "CPAs". But yes i'm able to retrieve all CPA from the host with a SNMP query.
I think it might be able to retrieve data by "Get SNMP Data (Indexed)" or "Get Script Data (Indexed)".
For example -- when you perform snmpwalk to the device,
if its output is like this
% snmpwalk -v1 -c xxxx host .1.3.6.1.4.1.a.b.c
.1.3.6.1.4.1.a.b.c.1 = <CPA1>
.1.3.6.1.4.1.a.b.c.2 = <CPA2>
.1.3.6.1.4.1.a.b.c.3 = <CPA3>
.1.3.6.1.4.1.a.b.c.4 = <CPA4>
.1.3.6.1.4.1.a.b.c.5 = <CPA5>
...
and other values are
% snmpwalk -v1 -c xxxx host .1.3.6.1.4.1.d.e.f
.1.3.6.1.4.1.d.e.f.<CPA1> = <ValueX_1>
.1.3.6.1.4.1.d.e.f.<CPA2> = <ValueX_2>
.1.3.6.1.4.1.d.e.f.<CPA3> = <ValueX_3>
.1.3.6.1.4.1.d.e.f.<CPA4> = <ValueX_4>
.1.3.6.1.4.1.d.e.f.<CPA5> = <ValueX_5>
...
then, probably SNMP data query might be like the following:
Code: Select all
<interface>
<name>Sample Query</name>
<description>Sample Query</description>
<oid_index>.1.3.6.1.4.1.a.b.c</oid_index>
<index_order>CPAnumber</index_order>
<index_order_type>numeric</index_order_type>
<fields>
<CPAnumber>
<name>CPA number</name>
<source>index</source>
<direction>input</direction>
</CPAnumber>
<ValueX>
<name>Value X</name>
<method>walk</method>
<source>value</source>
<direction>output</direction>
<oid>.1.3.6.1.4.1.d.e.f</oid>
</ValueX>
</fields>
</interface>
Re: Custom data input value automatically inserted
I'm already using "Get SNMP Data (Indexed)". I'm basically graphing throughput statistics for satellite modem. Unfortunately i do not have an OID for TX or RX like in Cisco but i have OID's for site name, remote ip address, CPA number and various other things. Therefor i'm using a php script querying the data (TX and RX traffic) from a MySQL database. Everything is gathered through the same host as it is my NMS.
To make things easier for endusers i'm using "Get SNMP Data (Indexed)" in order to populate the complete list of Satellite modem configured on my NMS with its IP, name and CPA number. I've attached graph templates to that data query based on my data input method using the php script.
So basically whenever we want to create new graph i can click on my corresponding Satellite Modem retrieved from the host with the data query and generate my graph. When i'm doing it i've got 2 custom data:
- Hostname (IP address of my host). It can be done automatically
- CPA number that i have to enter manually.
As i'm retrieving this CPA number through my data query is there any way to tell cacti that my "custom data" field for CPA number should use the one stored in that SNMP table? (CPA number is retrieved in input direction).
To make things easier for endusers i'm using "Get SNMP Data (Indexed)" in order to populate the complete list of Satellite modem configured on my NMS with its IP, name and CPA number. I've attached graph templates to that data query based on my data input method using the php script.
So basically whenever we want to create new graph i can click on my corresponding Satellite Modem retrieved from the host with the data query and generate my graph. When i'm doing it i've got 2 custom data:
- Hostname (IP address of my host). It can be done automatically
- CPA number that i have to enter manually.
As i'm retrieving this CPA number through my data query is there any way to tell cacti that my "custom data" field for CPA number should use the one stored in that SNMP table? (CPA number is retrieved in input direction).
Re: Custom data input value automatically inserted
Mmm... then, I think it's better to use "Script Data Query".
- Script Data Query Walkthrough - Cacti Docs
Please look into "Unix - Get Mounted Partitions" data query for example.
(See "resource/script_queries/unix_disk.xml" and "scripts/query_unix_partitions.pl")
It shows partitions as list, but we don't have to specify partition name when creating graph.
- Script Data Query Walkthrough - Cacti Docs
Please look into "Unix - Get Mounted Partitions" data query for example.
(See "resource/script_queries/unix_disk.xml" and "scripts/query_unix_partitions.pl")
It shows partitions as list, but we don't have to specify partition name when creating graph.
Re: Custom data input value automatically inserted
I will look into it.
Thanks
Thanks
Who is online
Users browsing this forum: No registered users and 3 guests