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

New command: lnms report:devices #15539

Merged
merged 8 commits into from Nov 1, 2023
Merged

Conversation

murrant
Copy link
Member

@murrant murrant commented Nov 1, 2023

Print out a list of devices with user specified fields in one of three formats table, csv, and none (tab separated suitable for shell scripting)

$ lnms report:devices --help
Description:
  Print out data from devices

Usage:
  report:devices [options] [--] [<device spec>]

Arguments:
  device spec           Device spec to poll: device_id, hostname, wildcard (*), odd, even, all

Options:
  -f, --fields=FIELDS   A comma seperated list of fields to display. Valid options: device column names from the database, relationship counts (ports_count), and/or displayName [default: "hostname,ip"]
  -o, --output=OUTPUT   Output format to display the data [table, csv, none] [default: "table"]
      --list-fields     Print out a list of valid fields

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.

@murrant murrant added the Feature label Nov 1, 2023
@dagbdagb
Copy link
Contributor

dagbdagb commented Nov 1, 2023

I like this

@murrant murrant merged commit 183f955 into librenms:master Nov 1, 2023
8 checks passed
@murrant murrant deleted the report_devices branch November 1, 2023 18:52
@librenms-bot
Copy link

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

https://community.librenms.org/t/23-11-0-changelog/22833/1

gdepeyrot pushed a commit to gdepeyrot/librenms that referenced this pull request Nov 29, 2023
* New report:devices command
Print out a list of devices with user specified fields, optionally in csv format

* Polish

* Apply fixes from StyleCI

* Use spaces instead of tab for none type

* Fix method call

* other commands use whereDeviceSpec

* Apply fixes from StyleCI

* update command help and back to tab for separator

---------

Co-authored-by: StyleCI Bot <bot@styleci.io>
gdepeyrot pushed a commit to gdepeyrot/librenms that referenced this pull request Nov 29, 2023
* New report:devices command
Print out a list of devices with user specified fields, optionally in csv format

* Polish

* Apply fixes from StyleCI

* Use spaces instead of tab for none type

* Fix method call

* other commands use whereDeviceSpec

* Apply fixes from StyleCI

* update command help and back to tab for separator

---------

Co-authored-by: StyleCI Bot <bot@styleci.io>
gunkaaa pushed a commit to gunkaaa/librenms that referenced this pull request Jan 8, 2024
* New report:devices command
Print out a list of devices with user specified fields, optionally in csv format

* Polish

* Apply fixes from StyleCI

* Use spaces instead of tab for none type

* Fix method call

* other commands use whereDeviceSpec

* Apply fixes from StyleCI

* update command help and back to tab for separator

---------

Co-authored-by: StyleCI Bot <bot@styleci.io>
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

4 participants