Skip to content
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

Add support for a maintenance boolean in API results. #15904

Merged
merged 6 commits into from Apr 20, 2024

Conversation

xorrkaz
Copy link
Contributor

@xorrkaz xorrkaz commented Mar 22, 2024

If a device is under maintenance, it would be nice to see that from the API. This can help drive other automation workflows where LibreNMS forms a cornerstone in the management source of truth.

Please give a short description what your pull request is for

DO NOT DELETE THE UNDERLYING TEXT

Please note

Please read this information carefully. You can run ./lnms dev:check to check your code before submitting.

  • Have you followed our code guidelines?
  • If my Pull Request does some changes/fixes/enhancements in the WebUI, I have inserted a screenshot of it.
  • If my Pull Request makes discovery/polling/yaml changes, I have added/updated test data.

Testers

If you would like to test this pull request then please run: ./scripts/github-apply <pr_id>, i.e ./scripts/github-apply 5926
After you are done testing, you can remove the changes with ./scripts/github-remove. If there are schema changes, you can ask on discord how to revert.

If a device is under maintenance, it would be nice to see that from the
API. This can help drive other automation workflows where LibreNMS forms
a cornerstone in the management source of truth.
PipoCanaja
PipoCanaja previously approved these changes Mar 23, 2024
Copy link
Contributor

@PipoCanaja PipoCanaja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@PipoCanaja PipoCanaja added the API label Mar 23, 2024
Copy link
Member

@murrant murrant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adds extra database calls when they are not needed.

You shouldn't add this to common code.

@xorrkaz
Copy link
Contributor Author

xorrkaz commented Apr 12, 2024

Thanks @murrant . I assume you're requesting an additional API endpoint such as, /api/v0/devices/{device}/maintenance?

@xorrkaz
Copy link
Contributor Author

xorrkaz commented Apr 16, 2024

@murrant , so I have built the endpoint. I could use some advice or a pointer with how to regen the bootstrap on a package-installed system so I can test this? Thanks.

This uses the same endpoint name as for setting a device to maintenance
but with a GET verb.
@xorrkaz
Copy link
Contributor Author

xorrkaz commented Apr 16, 2024

Nevermind. I deleted the cache and tested it. I hope this meets the requirement. It certainly meets my needs.

Copy link
Member

@murrant murrant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, it seems a little use case specific, but I think that is ok.

@murrant murrant merged commit 018597e into librenms:master Apr 20, 2024
9 checks passed
@librenms-bot
Copy link

This pull request has been mentioned on LibreNMS Community. There might be relevant details there:

https://community.librenms.org/t/24-4-0-changelog/24157/1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants