{"id":37744365,"url":"https://github.com/kkthxbye-code/netbox-script-manager","last_synced_at":"2026-01-16T14:13:54.735Z","repository":{"id":198192140,"uuid":"645040084","full_name":"kkthxbye-code/netbox-script-manager","owner":"kkthxbye-code","description":null,"archived":false,"fork":false,"pushed_at":"2025-03-28T08:59:07.000Z","size":200,"stargazers_count":12,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-28T09:37:35.695Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kkthxbye-code.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-24T19:41:29.000Z","updated_at":"2025-03-28T08:59:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"d58cbf87-d125-4f57-8192-7597d50f1c8d","html_url":"https://github.com/kkthxbye-code/netbox-script-manager","commit_stats":null,"previous_names":["kkthxbye-code/netbox-script-manager"],"tags_count":23,"template":false,"template_full_name":null,"purl":"pkg:github/kkthxbye-code/netbox-script-manager","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kkthxbye-code%2Fnetbox-script-manager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kkthxbye-code%2Fnetbox-script-manager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kkthxbye-code%2Fnetbox-script-manager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kkthxbye-code%2Fnetbox-script-manager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kkthxbye-code","download_url":"https://codeload.github.com/kkthxbye-code/netbox-script-manager/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kkthxbye-code%2Fnetbox-script-manager/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28479249,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T11:59:17.896Z","status":"ssl_error","status_checked_at":"2026-01-16T11:55:55.838Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-16T14:13:51.390Z","updated_at":"2026-01-16T14:13:54.727Z","avatar_url":"https://github.com/kkthxbye-code.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NetBox Script Manager\n\nImproved custom script support for netbox. Netbox version 3.5 removed several features related to custom scripts. This plugin attempts to undo these changes and add other improvements to scripts in netbox.\n\nThe plugin can be used in addition to the built-in script support and does not disable any netbox features.\n\n## Features\n\n* Scripts can be stored in nested modules.\n* Scripts can rely on non-script module files.\n* Scripts are loaded from a file-system folder.\n* It's possible to sync scripts by pulling any git repo located in the `SCRIPT_ROOT`\n* Name, group, description, task queues, comments and tags are editable in the UI.\n* Task queue is selectable in the UI.\n* Exceptions caused by errors in script files are displayed in the UI.\n* Log messages are saved and displayed when the script is running allowing live output for long running scripts.\n* It's possible to filter log lines by message and/or log level.\n* Changelog entries are listed in a tab when viewing a finished script execution.\n* It's possible to save script artifacts during the execution of a script. These artifacts will show up as downloadable files.\n* It's possible to re-run scripts.\n\n## What is not supported\n\n* Reports\n* DataSource/DataFile\n* `load_json` and `load_yaml` convenience methods\n* `script_order` - the ordering of scripts is instead based on `group` and `weight`\n\n## Compatibility\n\n| NetBox Version | Plugin Version |\n|----------------|----------------|\n|     3.5        |      0.1.0     |\n|     4.1        |      1.0.0     |\n|     4.2        |      1.1.0     |\n\n\n## Installing\n\nAdd the plugin to `local_requirements.txt` or `plugin_requirements.txt` (netbox-docker):\n\n```\nnetbox-script-manager\n```\n\nEnable the plugin in `/opt/netbox/netbox/netbox/configuration.py`,\n or if you use netbox-docker, your `/configuration/plugins.py` file:\n\n```python\nPLUGINS = [\n    'netbox_script_manager'\n]\n\nPLUGINS_CONFIG = {\n    \"netbox_script_manager\": {\n        \"SCRIPT_ROOT\": \"/path/to/script/folder/\",\n        \"DEFAULT_QUEUE\": \"high\"\n    },\n}\n```\n\n## Configuration\n\nThe following options are required:\n\n* `SCRIPT_ROOT`: Path to the script folder containing the customscripts module. \n\nThe following options are optional:\n\n* `DEFAULT_QUEUE`: Specifies what queue scripts are run in by default. Defaults to the `default` queue.\n\n\n## Migrating scripts\n\nThe most important change is to change the import and name of the base `Script` class.\n\nNetbox Script:\n\n```python\nfrom extras.scripts import Script\n\nclass MyCustomScript(Script):\n...\n```\n\nNetbox Script Manager Script:\n\n```python\nfrom netbox_script_manager.scripts import CustomScript\n\nclass MyCustomScript(CustomScript):\n...\n```\n\nIt is strongly recommended to do relative imports in your scripts, when using a nested structure or utility code.\n\n```python\nfrom .util import my_utility_method\nfrom ..subfolder import myCustomScript\n```\n\nThe alternative is to do an absolute import:\n\n```python\nfrom customscripts.nested_folder.util import my_utility_method\nfrom customscripts.subfolder import myCustomScript\n```\n\nPlease see the `Script folder` section for instructions regarding folder structure.\n\n## Script folder\n\nThe loading of scripts is a little different with netbox-script-manager. The `SCRIPT_ROOT` plugin setting must be set to define the path of the custom scripts, however the scripts must be located in a folder named `customscripts` in this path.\n\nA folder structure like this is required (`SCRIPT_ROOT` pointing to the `netboxscripts` folder):\n\n```bash\n├── netboxscripts # SCRIPT_ROOT\n│   ├── customscripts # Scripts will be discovered in this module, must be present\n│   │   ├── __init__.py\n│   │   ├── nestedmodule\n│   │   ├── root_script.py\n│   │   └── util\n│   └── __init__.py\n```\n\nThe reason for requiring this layout with a `customscripts` folder is to avoid name collisions when dynamically loading scripts. It also makes it easier to clear the internal python module cache which is needed for reloading scripts.\n\nLoading scripts is done either through the UI by pressing the `Load Scripts` button on the script view, or by calling the API endpoint `/api/plugins/script-manager/script-instances/load/`. Both of these require that the user has the `Can Add` action for the `Script Instance` object permission.\n\n## Git Sync\n\n\u003e :grey_exclamation: git must be installed on the system.\n\n\u003e :grey_exclamation: The netbox user must have the `sync` additional action for the `Script Instance` object permission.\n\n\u003e :warning: git recurses parent directories until finding a git directory. Make sure the `SCRIPT_ROOT` is a git directory.\n\nNetbox Script Manager has basic support for pulling down changes for git repositories. The Sync button is located on the script list and simply calls `git pull` on in the `SCRIPT_ROOT/customscripts` folder. If the git reposity requires authentication, it's recommended to setup SSH auth for the repo and provide the key in the users `$HOME/.ssh` folder.\n\nIf more advanced syncing is required, its recommended to handle this outside of netbox or alternatively use a custom script to do the sync.\n\n## Script Artifacts\n\nThe plugin allows you to, in a script, save arbritrary blobs of data as downloadable artifacts.\n\nExample:\n\n```python\nclass RootScript1(CustomScript):\n    class Meta:\n        name = \"Test Script\"\n        description = \"Testing\"\n\n    def run(self, data, commit):\n        # The data can be passed as bytes or a string. If passed as a string, the data will be encoded to bytes with the passed encoding automatically.\n        self.save_artifact(\"myfile.cfg\", b\"testfile\", content_type=\"text/plain\", encoding=\"utf-8\")\n```\n\n## Screenshots\n\nTODO\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkkthxbye-code%2Fnetbox-script-manager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkkthxbye-code%2Fnetbox-script-manager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkkthxbye-code%2Fnetbox-script-manager/lists"}