New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: Added support for sensors to be discovered from yaml #6859
Conversation
Auto-Deploy finished, Test PR at http://6859.ci.librenms.org or https://6859.ci.librenms.org |
Auto-Deploy finished, Test PR at http://6859.ci.librenms.org or https://6859.ci.librenms.org |
Auto-Deploy finished, Test PR at http://6859.ci.librenms.org or https://6859.ci.librenms.org |
Ok this is open for feedback now. @murrant I've removed the oid_name section in the last commit that you don't like :P |
Auto-Deploy finished, Test PR at http://6859.ci.librenms.org or https://6859.ci.librenms.org |
Looks amazing laf :) |
YAML type is working only for OIDs in table or can be used for all kinds? |
How do you mean @FTBZ? |
Do you mean can it be used for OIDs that aren't in a table? No not at the moment. If you have an example device that this doesn't work on then I can look at seeing what we can do. |
Exactly, I have already had cases where the OIDs of sensors are not in tables but I do not remember which. Good to know for further integration. |
Auto-Deploy finished, Test PR at http://6859.ci.librenms.org or https://6859.ci.librenms.org |
If you snmpwalk a single item, doesn't basically return a single getnext? |
includes/discovery/sensors.inc.php
Outdated
foreach ($data_array as $data) { | ||
foreach ((array)$data['oid'] as $oid) { | ||
$tmp_name = $data['oid']; | ||
$pre_cache[$tmp_name] = snmpwalk_cache_oid($device, $oid, $pre_cache[$tmp_name], $device['dynamic_discovery']['mib'], null, '-OeQUs'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should check if the oid has already been fetched here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And send an empty array to the walk function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Walking a single entry is ok but I'm not sure how well the code will work against that yet. I've added support for passing a description as a string as well as saying which key in the array contains the description so it's possibly ok with single OIDs.
Auto-Deploy finished, Test PR at http://6859.ci.librenms.org or https://6859.ci.librenms.org |
Rebased. Should pass travis now. |
Auto-Deploy finished, Test PR at http://6859.ci.librenms.org or https://6859.ci.librenms.org |
Tuner Input Level 1 = -68
|
I've added support for using index in descr. Can you give me an example on what you'd want to skip? |
Auto-Deploy finished, Test PR at http://6859.ci.librenms.org or https://6859.ci.librenms.org |
Thank you. |
@maciejkaczkowski I've added that support: skip_values: |
This should be good for a merge now imho. |
Looks good to me laf, I plan to try to convert one of the devices I have, but we don't have to wait on me to merge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a tiny comment, then I think we're good to go!
- { descr: motionDetected, graph: 0, value: 1, generic: 2 } | ||
- | ||
oid: otherStateSensorTable | ||
value: otherStateSensorValue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the correct name is:
otherStateSensorErrorStatus
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated, don't think it matters though.
num_oid: .1.3.6.1.4.1.5528.100.4.2.10.1.3. | ||
descr: otherStateSensorLabel | ||
index: '{{ $index }}' | ||
state_name: otherStateSensorErrorStatus |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about otherStateSensor?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's how it is in the old code so replicating that.
- { descr: motionDetected, graph: 0, value: 1, generic: 2 } | ||
- | ||
oid: otherStateSensorTable | ||
value: otherStateSensorValue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the correct name is:
otherStateSensorErrorStatus
num_oid: .1.3.6.1.4.1.5528.100.4.2.10.1.3. | ||
descr: otherStateSensorLabel | ||
index: '{{ $index }}' | ||
state_name: otherStateSensorErrorStatus |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about otherStateSensor?
The inspection completed: No new issues |
This thread has been automatically locked since there has not been any recent activity after it was closed. |
DO NOT DELETE THIS TEXT
Please note
Testers
If you would like to test this pull request then please run:
./scripts/github-apply <pr_id>
, i.e./scripts/github-apply 5926
Just pushing, nothing more right now.