Templating possible?

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

Moderators: Developers, Moderators

ironmike
Posts: 23
Joined: Fri Apr 22, 2005 12:12 pm

Templating possible?

Post by ironmike »

I have a Citrix Netscaler 7000 box that I am trying to get SNMP data. There is a node called serviceTable. I was wondering if it is possible to get build a template to ease data retrieval from this unit.

I ran:

snmptable -c xxx -v2c x.x.x.x serviceTable

The results of this are attached (actually, I chopped off a few columns!!!) in the ns7000.txt file. Also attached (ns7000-oid-svcName.txt) is the OID to get the servicename of the entries in the "table".

Retrival of the values is not too difficult, with the last entries in the OID being a row that has .<#chars in servicename>.<numeric ASCII representation of servicename>.... for example
OID."web1" => <OID>.4.119.101.98.49
OID."web2" => <OID>.4.119.101.98.50, and so on....
I don't like the idea of "hard-coding" the service names; that's why I want to use a query to retrieve the service names and the entries that I care about.

Anyway, this table does not have any index (other than the unique servicenames). Is it possible to build a query index? Or do I have to build the host up one service at a time, by hand, specifying each OID for each service-servicecounter?


thanks for any information,
Mike
Attachments
ns7000.txt
(1.08 KiB) Downloaded 175 times
ns7000-oid-svcName.txt
(254 Bytes) Downloaded 165 times
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

Moving to the general forum.

Yea, I'm sure there must be a way... although I'm not exactly an expert like lvm is. A snmpwalk ot servicetable would be handy...
ironmike
Posts: 23
Joined: Fri Apr 22, 2005 12:12 pm

Post by ironmike »

Attached is the output of
snmpwalk -c xxx -Of -v 2c x.x.x.x serviceTable

for the web services.

Let me know if anything else would help.

thanks,
Mike
Attachments
ns7000-servicetable-snmpwalk.txt
(10.48 KiB) Downloaded 215 times
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

BSOD2600, thank you for that bunch of flowers :) :D :lol:
ironmike, please sse my walkthrough at the last link of my signature. Should fit to your needs.
Reinhard
ironmike
Posts: 23
Joined: Fri Apr 22, 2005 12:12 pm

Post by ironmike »

Well... It's spring....time for lots of flowers! :D

I have looked at your walkthrough but did not think it would work because I don't have a numeric index for the services that I want to monitor.

As per your suggestion, I went through with setting up the query in the XML file and was able to get it to see the service names. Right now though, I can't get past step 2.

I get all the columns when I choose to "Create Graphs", but the values are not lined up (in the same row). See the results below. Is this because of a non-numeric index or is it somethings else I'm (not?) doing...?

Also attached is my .xml file. I have played with some of the settings, but did not get any better results.

thanks for your time,
Mike
Attachments
NetscalerServiceTable-IndexProb.PNG
NetscalerServiceTable-IndexProb.PNG (4.21 KiB) Viewed 6712 times
ns-servicetable.xml
(972 Bytes) Downloaded 201 times
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Well, your case requires some advanced magic. See http://www.cacti.net/downloads/docs/htm ... y_xml.htmland search for oid_index_parse. A OID/REGEXP should do. To help with that, I need sth like your snmpwalk, but using the ASN.1 notation (the pure numerics, please). From this, a REGEXP should be build, that results in the "strings" being translated into some some.stuff.([0-9]*)$. The Parenthesis should include the "index". Check this using Verbose Query.
Reinhard
ironmike
Posts: 23
Joined: Fri Apr 22, 2005 12:12 pm

Post by ironmike »

Magic... hmm... maybe with some practice :-)

I tried to munge around with the RegEx and did not get good results. I just get a single entry listed (not all the web servers).

I also was looking at the Forum thread of "Cacti SNMP query script"... still did not help.... :-(

Attached is a snmpwalk. Let me know if it's the format that you need.

thanks,
Mike
Attachments
ns7000-servicetable-snmpwalk-numeric.txt
(4.87 KiB) Downloaded 177 times
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Fine, this helps. Essentials are

Code: Select all

svcServiceName
.1.3.6.1.4.1.5951.4.1.2.1.1.1.6.115.51.119.101.98.49 = STRING: "s3web1"
.1.3.6.1.4.1.5951.4.1.2.1.1.1.6.115.51.119.101.98.50 = STRING: "s3web2"
.1.3.6.1.4.1.5951.4.1.2.1.1.1.6.115.51.119.101.98.51 = STRING: "s3web3"
.1.3.6.1.4.1.5951.4.1.2.1.1.1.6.115.51.119.101.98.52 = STRING: "s3web4"

svcIPAddress
.1.3.6.1.4.1.5951.4.1.2.1.1.2.6.115.51.119.101.98.49 = IpAddress: 000.000.000.001
.1.3.6.1.4.1.5951.4.1.2.1.1.2.6.115.51.119.101.98.50 = IpAddress: 000.000.000.002
.1.3.6.1.4.1.5951.4.1.2.1.1.2.6.115.51.119.101.98.51 = IpAddress: 000.000.000.003
.1.3.6.1.4.1.5951.4.1.2.1.1.2.6.115.51.119.101.98.52 = IpAddress: 000.000.000.004
which leads us to the fact, that

Code: Select all

6.115.51.119.101.98.49
is the index. And

Code: Select all

.1.3.6.1.4.1.5951.4.1.2.1.1
is the "base". The XML fields are enumerated

Code: Select all

svcServiceName .1.3.6.1.4.1.5951.4.1.2.1.1.1
svcIPAddress .1.3.6.1.4.1.5951.4.1.2.1.1.2
svcServicePort .1.3.6.1.4.1.5951.4.1.2.1.1.3
svcServiceType .1.3.6.1.4.1.5951.4.1.2.1.1.4
svcServiceState .1.3.6.1.4.1.5951.4.1.2.1.1.5
svcAvgTransactionTime .1.3.6.1.4.1.5951.4.1.2.1.1.7
...
So let's develop the XML for that. As a starting point, please try

Code: Select all

<interface>
        <name>Something</name>
        <description>what you want</description>
        <index_order_type>numeric</index_order_type>
        <oid_index>.1.3.6.1.4.1.5951.4.1.2.1.1.1</oid_index>
        <oid_index_parse>OID/REGEXP:.*\.([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})$</oid_index_parse>

        <fields>
                <svcServiceName>
                        <name>svcServiceName</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>input</direction>
                        <oid>.1.3.6.1.4.1.5951.4.1.2.1.1.1</oid>
                </svcServiceName>
                <svcIPAddress>
                        <name>svcIPAddress</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>input</direction>
                        <oid>.1.3.6.1.4.1.5951.4.1.2.1.1.2</oid>
                </svcIPAddress>
                <svcEstablishedConn>
                        <name>svcEstablishedConn</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>output</direction>
                        <oid>.1.3.6.1.4.1.5951.4.1.2.1.1.8</oid>
                </svcEstablishedConn>
        </fields>
</interface>
Please try a Verbose Query against your target and post the outcome. This OID/REGEXP actually is hard-coded against your ServiceNames being 7 characters long. I'd like the

Code: Select all

<oid_index_parse>OID/REGEXP:.*\.([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})$</oid_index_parse>
should more look like

Code: Select all

<oid_index_parse>OID/REGEXP:\.1\.3\.6\.1\.4\.1\.5951\.4\.1\.2\.1\.1\.(.*)$</oid_index_parse>
giving us the index as everything, that follows .1.3.6.1.4.1.5951.4.1.2.1.1, but that was reported to fail in the past.
Reinhard
ironmike
Posts: 23
Joined: Fri Apr 22, 2005 12:12 pm

Post by ironmike »

Thanks, your XML file reflected what I tried to do in one of my test iterations. I went and tried the different variations you suggested.

It's still doing the same as mentioned before: the IP addresses are one set of rows and the service names are another set.

I bumped up the log level of Cacti to debug. It looks like cacti thinks there are multiple indices(for example: the svcServiceIPAddress and svcServiceName - see attached), though I am not an expert by any means in decrypting the log file :-) ...

Verbose query output is attached as well.

One final thing to note is that I do have a variable length index (service names range from 3-14 characters). I was focusing on the Web entries and planned on extending what I learned to the other services.

thanks,
Mike
Attachments
cacti-debuglog-snippet2006-04-19.txt
(15.55 KiB) Downloaded 186 times
cacti-verbosequery2006-04-19.txt
(6.57 KiB) Downloaded 155 times
ironmike
Posts: 23
Joined: Fri Apr 22, 2005 12:12 pm

Post by ironmike »

More fun stuff from playing around. I noticed that I was getting a "complete" OID as an index. I don't think I want that. I looked at the data_query.php and saw the ereg_replace() call. I looked it up (I am NOT a PHP expert by any means!) and noted that if it finds no match, the string is returned. I then replaced

Code: Select all

<oid_index_parse>OID/REGEXP:\.1\.3\.6\.1\.4\.1\.5951\.4\.1\.2\.1\.1\.(.*)$</oid_index_parse>
with

Code: Select all

<oid_index_parse>OID/REGEXP:enterprises\.netScaler\.nsProducts\.rs9000\.nsSvcGroup\.serviceTable\.serviceEntry\.svcServiceName\.(.*)$</oid_index_parse> 
in the xml file and got the following in the verbose query:
+ Running data query [10].
+ Found type = '3' [snmp query].
+ Found data query XML file at 'X:/util/cacti/resource/snmp_queries/ns-servicetable.xml'
+ XML file parsed ok.
+ Executing SNMP walk for list of indexes @ '.1.3.6.1.4.1.5951.4.1.2.1.1.1'
+ Located input field 'svcServiceName' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.4.1.5951.4.1.2.1.1.1'
...
+ Found item [svcServiceName='s3web1'] index: "s3web1" [from value]
+ Found item [svcServiceName='s3web2'] index: "s3web2" [from value]
+ Found item [svcServiceName='s3web3'] index: "s3web3" [from value]
+ Found item [svcServiceName='s3web4'] index: "s3web4" [from value]
... etc.

That looks better than before. Still, the remainder of the debug information reports:
+ Located input field 'svcIPAddress' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.4.1.5951.4.1.2.1.1.2'
...
+ Found item [svcIPAddress='192.168.100.128'] index: enterprises.netScaler.nsProducts.rs9000.nsSvcGroup.serviceTable.serviceEntry.svcIpAddress."s3web1" [from value]
+ Found item [svcIPAddress='192.168.100.129'] index: enterprises.netScaler.nsProducts.rs9000.nsSvcGroup.serviceTable.serviceEntry.svcIpAddress."s3web2" [from value]
+ Found item [svcIPAddress='192.168.100.131'] index: enterprises.netScaler.nsProducts.rs9000.nsSvcGroup.serviceTable.serviceEntry.svcIpAddress."s3web3" [from value]
+ Found item [svcIPAddress='192.168.100.132'] index: enterprises.netScaler.nsProducts.rs9000.nsSvcGroup.serviceTable.serviceEntry.svcIpAddress."s3web4" [from value]
...etc.

Note the index is different for the field (svcIPAddress). Is there something that I am missing/not doing? I have read and reread posts on the forum here and the documentation and not really made any headway as to what might be causing the problem.

thanks,
Mike
ironmike
Posts: 23
Joined: Fri Apr 22, 2005 12:12 pm

Post by ironmike »

Hmm... maybe I have a rabbit in my hat after all... :wink:

based on what I saw (my previous post) and a review of what the PHP was doing, I made the following modification:

changed:

Code: Select all

<oid_index_parse>OID/REGEXP:enterprises\.netScaler\.nsProducts\.rs9000\.nsSvcGroup\.serviceTable\.serviceEntry\.svcServiceName\.(.*)$</oid_index_parse> 
to

Code: Select all

<oid_index_parse>OID/REGEXP:enterprises\.netScaler\.nsProducts\.rs9000\.nsSvcGroup\.serviceTable\.serviceEntry\.[A-Za-z0-9]{1,15}\.(.*)$</oid_index_parse> 
and got the servicenames as indexes (s3web1, s3web2, etc):

+ Found item [svcServiceName='s3web1'] index: "s3web1" [from value]
+ Found item [svcServiceName='s3web2'] index: "s3web2" [from value]
+ Found item [svcServiceName='s3web3'] index: "s3web3" [from value]
+ Found item [svcServiceName='s3web4'] index: "s3web4" [from value]

...
+ Found item [svcIPAddress='x.x.x.x'] index: "s3web1" [from value]
+ Found item [svcIPAddress='x.x.x.x'] index: "s3web2" [from value]
+ Found item [svcIPAddress='x.x.x.x'] index: "s3web3" [from value]
+ Found item [svcIPAddress='x.x.x.x'] index: "s3web4" [from value]
...etc.

What's more, this regex works with the other servicenames (some are longer, some are shorter) as well! Don't have to worry about hard coding the indexes!

lvm, thanks for all your help in this. I will be posting a template for the Netscaler once I finish it.

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

Post by gandalf »

Wow, your results are VERY interesting for me. The OID/REGEXPes have always been very hard for me to understand. It would be very helpful, to post your actual XML file along with the actual Verbose Query Output. I'm quite sure, that this would help (at least my own) understanding the lot.
Reinhard
ironmike
Posts: 23
Joined: Fri Apr 22, 2005 12:12 pm

Post by ironmike »

Sorry for the delay... been fairly busy on non-Cacti things... The files are attached, the verbose query has been "sanitized" to protect the guilty.

Mike
Attachments
the result for the &amp;quot;Add graphs for this host&amp;quot;
the result for the &quot;Add graphs for this host&quot;
netscaler-graph host.PNG (44.9 KiB) Viewed 6530 times
verbose-query.txt
results of the query
(6.89 KiB) Downloaded 179 times
ns-servicetable.xml
the xml file...
(4.54 KiB) Downloaded 320 times
tekbot
Posts: 49
Joined: Tue Jun 07, 2005 7:42 pm
Location: Venice, CA

Post by tekbot »

Thanks to everyone who has contributed to this thread. Because of your input, I am now able to propelry index and query against my NetScaler 12000s.

*HOWEVER* - I am not getting any data on my graphs. :cry: I used the template uploaded by ironmike, and the OID regex posted by lvm. However, nowhere on this forum is there any information for what Data Templates I should be using to actually get the graphs that I need.

Any requested information will be posted, but I'm not sure what's useful and what's not.

Please help!

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

Post by gandalf »

Did you already read the last two links of my signature? Creation of Data Templates is handled there. Basically, you need a data source for each <direction<output</direction> field of the XML. Pay attention to provide the correc ttype, e.g. COUNTER or GAUGE
Reinhard
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest