Comments (13)
With the above commit it's now possible to use named regex groups like this:
value_regex_transformation: "(?P<days>[0-9].*):(?P<hours>[[0-2][0-9]):(?P<minutes>[[0-6][0-9]):(?P<seconds>[[0-6][0-9])\\..*"
value_calculation: "days * 86400 + hours * 3600 + minutes * 60 + seconds"
from aci-exporter.
@JDA88 just so you know with latest commit on this branch golang is updated to 1.20
from aci-exporter.
Can you send me the complete configuration for the query including the config query type you are doing. The time format looks really strange 210:20:16:20.000
. What are the different values?
from aci-exporter.
Configuration look like this (ignore the wrong naming it was a dirty test):
queries:
- node_health:
class_name: topSystem
query_parameter: "?rsp-subtree-include=health"
metrics:
-
value_name: [email protected]
value_calculation: "value / 100"
labels:
- property_name: topSystem.attributes.dn
regex: "^topology/pod-(?P<podid>[1-9][0-9]*)/node-(?P<nodeid>[1-9][0-9]*)/sys"
- property_name: topSystem.attributes.state
regex: "^(?P<state>.*)"
- property_name: topSystem.attributes.oobMgmtAddr
regex: "^(?P<oobMgmtAddr>.*)"
- property_name: topSystem.attributes.name
regex: "^(?P<name>.*)"
- property_name: topSystem.attributes.role
regex: "^(?P<role>.*)"
- property_name: topSystem.attributes.systemUpTime
regex: "^(?P<uptime>.*)"
uptime goes to a label because the value is incompatible with a value.
The Cisco API documentation have example with this value: https://www.cisco.com/c/en/us/td/docs/switches/datacenter/aci/apic/sw/1-x/api/rest/b_APIC_RESTful_API_User_Guide/additional_examples.html
You also have a description in the Nexus documentation: https://pubhub.devnetcloud.com/media/dme-docs-9-3-5/docs/System/top:System/
systemUpTime | scalar:Time | The time (in seconds) since the system was booted. | TIME FORMAT: %H:%M:%S 54:05:07:26.000 |
---|
So the format is probably D:H:M:S
in ACI...
from aci-exporter.
@JDA88 thanks for the feedback. That was a horrible time format, why not just use seconds. Maybe a feature request to Cisco. Do you know if this time format is used only in this object or if its a common time "type" in ACI universe?
from aci-exporter.
I kind of agree with the format been horrible for an API. They should at least expose it in both formats.
The scalar:Time
is used by Cisco in different places (searching for it in google return some match like frequency for jobs etc.) but I have no idea if there is other useful scenario for the ACI exporter.
It's not that difficult to parse and convert to seconds, but I canβt do it at the prometheus level, it must be done at the exporter level.
You mention a feature request to Cisco? Do you have any idea of how to do this?
from aci-exporter.
@JDA88 I think its easier to fix it in the exporter than to ask for a change request from ACI. I also think this is functionality can be valuable for other use cases. I did not want to create some new specific transformation for this specific format, but instead build on the functionality that already exists related to value_regex_transformation
and value_calculation
. So instead of limit the functionality to a single value we can now have a configuration like this:
class_queries:
issue22:
class_name: topSystem
query_parameter: "?rsp-subtree-include=health"
metrics:
- name: uptime
#value_name: [email protected]
value_name: topSystem.attributes.systemUpTime
value_regex_transformation: "([0-9].*):([0-2][0-9]):([0-6][0-9]):([0-6][0-9])\\..*"
value_calculation: "value1 * 86400 + value2 * 3600 + value3 * 60 + value4"
labels:
- property_name: topSystem.attributes.dn
regex: "^topology/pod-(?P<podid>[1-9][0-9]*)/node-(?P<nodeid>[1-9][0-9]*)/sys"
- property_name: topSystem.attributes.state
regex: "^(?P<state>.*)"
- property_name: topSystem.attributes.oobMgmtAddr
regex: "^(?P<oobMgmtAddr>.*)"
- property_name: topSystem.attributes.name
regex: "^(?P<name>.*)"
- property_name: topSystem.attributes.role
regex: "^(?P<role>.*)"
- property_name: topSystem.attributes.systemUpTime
regex: "^(?P<uptime>.*)"
In the value_regex_transformation
we have a regex that extract 4 values and in the value_calculation
the values can be referenced as value1
to value4
. The index will be according to the order they are matched in the regex.
If we just have one value, the existing way of reference the value using just value
in the value_calculation
will still work.
If there are errors in the regex or in the value_calculation
, lets say try to reference value34
and it does not exist the aci-exporter will log that with information so its easy to find in the configuration file.
So with the above we now get the output:
curl -s 'http://localhost:9643/probe?target=cisco_sandbox&queries=issue22'
# HELP issue22
# TYPE issue22
aci_issue22{aci="ACI Fabric1",fabric="cisco_sandbox",name="leaf-1",nodeid="101",oobMgmtAddr="192.168.100.101",podid="1",role="leaf",state="in-service",uptime="07:19:59:33.000"} 676773
aci_issue22{aci="ACI Fabric1",fabric="cisco_sandbox",name="leaf-2",nodeid="102",oobMgmtAddr="192.168.100.102",podid="1",role="leaf",state="in-service",uptime="07:19:59:33.000"} 676773
aci_issue22{aci="ACI Fabric1",fabric="cisco_sandbox",name="spine-1",nodeid="201",oobMgmtAddr="192.0.2.5",podid="1",role="spine",state="in-service",uptime="07:19:59:33.000"} 676773
aci_issue22{aci="ACI Fabric1",fabric="cisco_sandbox",name="apic1",nodeid="1",oobMgmtAddr="192.168.100.10",podid="1",role="controller",state="in-service",uptime="07:19:59:35.000"} 676775
# HELP scrape_duration_seconds The duration, in seconds, of the last scrape of the fabric
# TYPE scrape_duration_seconds gauge
aci_scrape_duration_seconds{aci="ACI Fabric1",fabric="cisco_sandbox"} 3.109194926
from aci-exporter.
@JDA88 you can test the branch issue_22 to test the new feature. Please read the README.md and give feedback if anything is unclear.
from aci-exporter.
Thank you very much for this. I'll let you know when we get the opportunity to test this!
from aci-exporter.
@JDA88 would really like your feedback from your test on this before merging :)
from aci-exporter.
would really like your feedback from your test on this before merging :)
I'll do my best but our team are very busy this week and we won't probably be able to test before at the very least next week
from aci-exporter.
@JDA88 I understand. I think I merge with master and continue on the other issues you made. Can create a beta for testing instead.
from aci-exporter.
Merged in #27
from aci-exporter.
Related Issues (20)
- Scrape timestamp metrics as value HOT 7
- ACI 5.2: Update login/logout API endpoints HOT 2
- Regex in value_transform HOT 10
- The prefix is not reflected in the # HELP and # TYPE lines HOT 2
- Add a aci_up metric HOT 1
- It is possible to generate a metric file with empty # HELP and / or # TYPE lines HOT 2
- Labels should alway be lowercase HOT 5
- value transformation do not work HOT 3
- static_binding_info: value_regex_transformation not working HOT 3
- label regex not executed on child class HOT 4
- Convert string to float for operSpeed HOT 9
- Add static label in metrics HOT 6
- Implement Pagination Support HOT 31
- auth fails for some passwords containing special characters HOT 3
- reduce scrapping time HOT 8
- Reuse client login cookie data between api calls
- Support configuration directory
- Exclude/include queries by fabric configuration
- Issue with query including an array of children HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aci-exporter.