Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/apocas/netboxvms
Export and sync VM metadata from multiple platforms to Netbox.
https://github.com/apocas/netboxvms
Last synced: about 2 months ago
JSON representation
Export and sync VM metadata from multiple platforms to Netbox.
- Host: GitHub
- URL: https://github.com/apocas/netboxvms
- Owner: apocas
- License: apache-2.0
- Created: 2023-02-26T21:58:42.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-02-27T18:40:37.000Z (over 1 year ago)
- Last Synced: 2024-04-14T09:52:26.614Z (5 months ago)
- Language: JavaScript
- Homepage:
- Size: 14.6 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# netboxvms
Export and sync VM metadata from multiple platforms to Netbox.
## Supported Platforms
* Onapp
* Proxmox
* VMmanager 6### Adding a new platform
1. Create a new file in the `netboxvms/exporters` directory
2. Create a new class that inherits from `Exporter`
3. Implement the `getVMs` method. This method must return a list of `VM` objects. (check example.js)
4. Netboxvms will automatically detect the new exporter and use it, no need to change anything else. It will automatically detect what needs to be added, updated or deleted.### Example
```js
var Exporter = require('./exporter');class Example extends Exporter {
constructor(cluster) {
super(cluster);
this.name = 'Example';this.tag = process.env.EXAMPLE_TAG || 'example-'
//init...
}//return a list of VMs, example VM object
async getVMs() {
var output = [
{
name: 'xpto',
display_name: 'xpto.example.com',
virtual_machine_id: this.tag + '123456',
vcpus: 2,
memory: 2048,
disk: 10,
ip_addresses: ['127.0.0.1'],
status: 'online'
},
//...
];return output;
}
}module.exports = Example;
```## Usage
* npm install
* NETBOX_HOSTNAME=xxx NETBOX_TOKEN=xxx ONAPP_CLUSTER=1 ONAPP_TAG=onapp- ONAPP_HOSTNAME=xxx ONAPP_USERNAME=xxx ONAPP_PASSWORD=xxx node main.js onapp### Env vars
* `NETBOX_HOSTNAME` - Netbox URL
* `NETBOX_TOKEN` - Netbox API Token
* `[ONAPP,VMM6,PROXMOX,...]_CLUSTER` - Destination Netbox cluster ID
* `[ONAPP,VMM6,PROXMOX,...]_TAG` - Tag to be appended to VM name
* `[ONAPP,VMM6,PROXMOX,...]_HOSTNAME` - Platform hostname
* `[ONAPP,VMM6,PROXMOX,...]_USERNAME` - Platform username
* `[ONAPP,VMM6,PROXMOX,...]_PASSWORD` - Platform password/token/secret