[![CI](https://github.com/infrasonar/toolkit/workflows/CI/badge.svg)](https://github.com/infrasonar/toolkit/actions)
[![Release Version](https://img.shields.io/github/release/infrasonar/toolkit)](https://github.com/infrasonar/toolkit/releases)
The InfraSonar tool can be used to manage assets for a container. The tool has two main features. One is to read all assets from a container to YAML output. If needed, all collector and label information can be included.
The other feature of this tool is to apply a YAML file to InfraSonar. These two features combined allow you to easily add new assets as well as managing existing assets for a container.
## Installation
Using pip:
```shell
pip install infrasonar
```
Or, clone this project and use the setup
```shell
python setup.py install
```
## Apply assets
Create a _yaml_ file, for example: `assets.yaml` _(you may also use [get-assets](#get-assets) to export the current assets and make modifications)_
```yaml
container: 12345
labels:
windows: 3257
configs:
tcp:
checkCertificatePorts: [443, 995, 993, 465, 3389, 989, 990, 636, 5986]
assets:
- name: foo.local
kind: Windows
labels: ["windows"]
collectors:
- key: lastseen
- key: ping
- key: tcp
config: tcp
- key: wmi
```
Next, use the following command to apply the assets: _(**-a** will **only add** labels and collectors, **-d** performs a **dry-run** without actually applying the changes)_
```bash
infrasonar apply-assets assets.yaml -a -d
```
The script will create a new asset if an asset with the given name cannot be found, otherwise it will apply the changes to the existing asset. Existing labels and/or collectors will _not_ be removed, but a _kind_ will be overwritten if one is given. The properties _kind_, _description_, _mode_, _labels_ and _collectors_ are all optional.
### Token
A token might be included in the yaml file:
```yaml
token: xxxxxx
```
Or, it will be asked in a prompt when starting the script.
> :point_right: Note that a **token** with **Agent** flags must be used for the _apply-assets_ action to work. A **container token** is required when no _container Id_ is given or when one or more assets without an _asset Id_ are used.
## Get asset
Get a single asset. _(in the example below, 123 is a asset Id)_
```bash
infrasonar get-asset 123 -o yaml
```
## Get assets
Get container assets. _(in the example below, 123 is a container Id)_
```bash
infrasonar get-assets 123 -o yaml
```
## VMware guests
Generate YAML (or JSON) with VMware Guests which are found on ESX or vCenter but wherefore no asset with the `vmwareguest` collector is found. This YAML can then be used to install the VMware Guest collector with a single command. The default is to use the VCenter. For ESX the `-c esx` argument.
Example: _(in the example below, 123 is a container Id)_
```bash
infrasonar vmware-guests 123 > missing.yaml
```
Review the missing.yaml file _(open in editor or apply a dry-run)_
```
infrasonar apply-assets missing.yaml -a -d
```
> :point_right: Do not forget to use **-a** to prevent removing other collectors and use **-d** to perform a dry-run for verifying the changes.
## Hyper-V guests
Generate YAML (or JSON) with Hyper-V Guests which are found on a Hyper-V asset(s) but wherefore no asset with the `hypervguest` collector is found. This YAML can then be used to install the Hyper-V Guest collector with a single command.
Example: _(in the example below, 123 is a container Id)_
```bash
infrasonar hyperv-guests 123 > missing.yaml
```
Review the missing.yaml file _(open in editor or apply a dry-run)_
```
infrasonar apply-assets missing.yaml -a -d
```
> :point_right: Do not forget to use **-a** to prevent removing other collectors and use **-d** to perform a dry-run for verifying the changes.
## UniFi devices
Generate YAML (or JSON) with UniFi devices which are found on a UniFi Controller asset(s) but wherefore no asset with the `unifidevice` or `unifidevicesvc` collector is found. This YAML can then be used to install the UniFi Device collector with a single command. The default is to use the `unificontroller`. For using the _service_ variant, use the `-c unificontrollersvc` argument.
Example: _(in the example below, 123 is a container Id)_
```bash
infrasonar unifi-devices 123 > missing.yaml
```
Review the missing.yaml file _(open in editor or apply a dry-run)_
```
infrasonar apply-assets missing.yaml -a -d
```
> :point_right: Do not forget to use **-a** to prevent removing other collectors and use **-d** to perform a dry-run for verifying the changes.
## Help
```
infrasonar -h
infrasonar get-asset -h
infrasonar get-assets -h
infrasonar apply-assets -h
infrasonar vmware-guests -h
```
Raw data
{
"_id": null,
"home_page": "https://github.com/infrasonar/toolkit",
"name": "infrasonar",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "infrasonar monitoring toolkit util",
"author": "Jeroen van der Heijden",
"author_email": "jeroen@cesbit.com",
"download_url": "https://files.pythonhosted.org/packages/46/05/68b0fe27ba8c67d6dd9f2e83ebd5b3675143263279da4989b267c20fd36e/infrasonar-0.1.18.tar.gz",
"platform": null,
"description": "[![CI](https://github.com/infrasonar/toolkit/workflows/CI/badge.svg)](https://github.com/infrasonar/toolkit/actions)\n[![Release Version](https://img.shields.io/github/release/infrasonar/toolkit)](https://github.com/infrasonar/toolkit/releases)\n\nThe InfraSonar tool can be used to manage assets for a container. The tool has two main features. One is to read all assets from a container to YAML output. If needed, all collector and label information can be included.\nThe other feature of this tool is to apply a YAML file to InfraSonar. These two features combined allow you to easily add new assets as well as managing existing assets for a container.\n\n## Installation\n\nUsing pip:\n\n```shell\npip install infrasonar\n```\n\nOr, clone this project and use the setup\n\n```shell\npython setup.py install\n```\n\n## Apply assets\n\nCreate a _yaml_ file, for example: `assets.yaml` _(you may also use [get-assets](#get-assets) to export the current assets and make modifications)_\n\n```yaml\ncontainer: 12345\n\nlabels:\n windows: 3257\n\nconfigs:\n tcp:\n checkCertificatePorts: [443, 995, 993, 465, 3389, 989, 990, 636, 5986]\n\nassets:\n- name: foo.local\n kind: Windows\n labels: [\"windows\"]\n collectors:\n - key: lastseen\n - key: ping\n - key: tcp\n config: tcp\n - key: wmi\n```\n\nNext, use the following command to apply the assets: _(**-a** will **only add** labels and collectors, **-d** performs a **dry-run** without actually applying the changes)_\n\n```bash\ninfrasonar apply-assets assets.yaml -a -d\n```\n\nThe script will create a new asset if an asset with the given name cannot be found, otherwise it will apply the changes to the existing asset. Existing labels and/or collectors will _not_ be removed, but a _kind_ will be overwritten if one is given. The properties _kind_, _description_, _mode_, _labels_ and _collectors_ are all optional.\n\n### Token\n\nA token might be included in the yaml file:\n```yaml\ntoken: xxxxxx\n```\n\nOr, it will be asked in a prompt when starting the script.\n\n> :point_right: Note that a **token** with **Agent** flags must be used for the _apply-assets_ action to work. A **container token** is required when no _container Id_ is given or when one or more assets without an _asset Id_ are used.\n\n\n## Get asset\n\nGet a single asset. _(in the example below, 123 is a asset Id)_\n\n```bash\ninfrasonar get-asset 123 -o yaml\n```\n\n## Get assets\n\nGet container assets. _(in the example below, 123 is a container Id)_\n\n```bash\ninfrasonar get-assets 123 -o yaml\n```\n\n\n## VMware guests\n\nGenerate YAML (or JSON) with VMware Guests which are found on ESX or vCenter but wherefore no asset with the `vmwareguest` collector is found. This YAML can then be used to install the VMware Guest collector with a single command. The default is to use the VCenter. For ESX the `-c esx` argument.\n\nExample: _(in the example below, 123 is a container Id)_\n\n```bash\ninfrasonar vmware-guests 123 > missing.yaml\n```\n\nReview the missing.yaml file _(open in editor or apply a dry-run)_\n\n```\ninfrasonar apply-assets missing.yaml -a -d\n```\n\n> :point_right: Do not forget to use **-a** to prevent removing other collectors and use **-d** to perform a dry-run for verifying the changes.\n\n## Hyper-V guests\n\nGenerate YAML (or JSON) with Hyper-V Guests which are found on a Hyper-V asset(s) but wherefore no asset with the `hypervguest` collector is found. This YAML can then be used to install the Hyper-V Guest collector with a single command.\n\nExample: _(in the example below, 123 is a container Id)_\n\n```bash\ninfrasonar hyperv-guests 123 > missing.yaml\n```\n\nReview the missing.yaml file _(open in editor or apply a dry-run)_\n\n```\ninfrasonar apply-assets missing.yaml -a -d\n```\n\n> :point_right: Do not forget to use **-a** to prevent removing other collectors and use **-d** to perform a dry-run for verifying the changes.\n\n## UniFi devices\n\nGenerate YAML (or JSON) with UniFi devices which are found on a UniFi Controller asset(s) but wherefore no asset with the `unifidevice` or `unifidevicesvc` collector is found. This YAML can then be used to install the UniFi Device collector with a single command. The default is to use the `unificontroller`. For using the _service_ variant, use the `-c unificontrollersvc` argument.\n\nExample: _(in the example below, 123 is a container Id)_\n\n```bash\ninfrasonar unifi-devices 123 > missing.yaml\n```\n\nReview the missing.yaml file _(open in editor or apply a dry-run)_\n\n```\ninfrasonar apply-assets missing.yaml -a -d\n```\n\n> :point_right: Do not forget to use **-a** to prevent removing other collectors and use **-d** to perform a dry-run for verifying the changes.\n\n## Help\n\n```\ninfrasonar -h\ninfrasonar get-asset -h\ninfrasonar get-assets -h\ninfrasonar apply-assets -h\ninfrasonar vmware-guests -h\n```\n",
"bugtrack_url": null,
"license": "GPLv3",
"summary": "InfraSonar Toolkit",
"version": "0.1.18",
"project_urls": {
"Homepage": "https://github.com/infrasonar/toolkit"
},
"split_keywords": [
"infrasonar",
"monitoring",
"toolkit",
"util"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "460568b0fe27ba8c67d6dd9f2e83ebd5b3675143263279da4989b267c20fd36e",
"md5": "106438a1563303c9355f0273c09067d0",
"sha256": "d1b496497e4fa4dbb6b483fa792d01f652ad47eab30327bf5b7aa86448d5723d"
},
"downloads": -1,
"filename": "infrasonar-0.1.18.tar.gz",
"has_sig": false,
"md5_digest": "106438a1563303c9355f0273c09067d0",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 28278,
"upload_time": "2024-03-26T11:37:51",
"upload_time_iso_8601": "2024-03-26T11:37:51.878390Z",
"url": "https://files.pythonhosted.org/packages/46/05/68b0fe27ba8c67d6dd9f2e83ebd5b3675143263279da4989b267c20fd36e/infrasonar-0.1.18.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-26 11:37:51",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "infrasonar",
"github_project": "toolkit",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "infrasonar"
}