Python Toolkit for N-Central RMM API
Project description
npycentral
A Python toolkit for the N-able N-Central RMM API.
Installation
pip install npycentral
Quick Start
from npycentral import NCentralClient
client = NCentralClient(
base_url="https://your-ncentral.example.com",
jwt="your-jwt-token",
base_so_id="50" # Almost always 50 - see note below
)
Getting Your JWT Token
- In N-Central, go to Administration > User Management > Users
- Select your API user (or create one)
- Go to the API Access tab
- Generate a new JWT token
Service Organization ID
For most N-Central instances, your SO ID is 50. This is the default for single-SO setups, which covers the vast majority of deployments.
If you're unsure, you can check in N-Central (it's in the URL when viewing All Devices) or fetch it:
service_orgs = client.get_service_orgs()
for so in service_orgs:
print(f"{so.soName}: {so.soId}")
Examples
List Windows Servers and Check for Issues
from npycentral import NCentralClient
client = NCentralClient(
base_url="https://ncentral.example.com",
jwt="your-jwt",
base_so_id="50"
)
servers = client.get_devices(filter_name="Servers - Windows")
for server in servers:
issues = client.get_device_active_issues(server.deviceId)
print(f"{server.longName} - {len(issues)} active issues")
for issue in issues:
print(f" [{issue.serviceName}] {issue.notificationState}")
Get Device Details by Name
# Get a specific device by name
device = client.get_device(device_name="DC01")
print(f"Device ID: {device.deviceId}")
print(f"Last Check-in: {device.last_checkin_datetime}")
# For better performance, narrow down with a filter first
device = client.get_device(device_name="DC01", filter_name="Domain Controllers")
Check Disk Health
device = client.get_device(device_name="FILESERVER01")
disk_status = client.check_device_disk_health(device.deviceId)
print(disk_status)
# Output: Disk Health: 3 monitors (2 normal, 1 warning, 0 failed)
# C: Normal | D: Normal | E: Warning
Get Hardware and Software Inventory
device = client.get_device(device_name="WORKSTATION01")
# Load full asset details (lazy-loaded to save API calls)
assets = device.load_assets()
# Hardware summary
hw = client.get_device_hardware_summary(device.deviceId)
print(f"Model: {hw['manufacturer']} {hw['model']}")
print(f"CPU: {hw['processor']}")
print(f"RAM: {hw['memory_gb']} GB")
# Software inventory
sw = client.get_device_software_inventory(device.deviceId)
print(f"Pending patches: {len(sw['pending_patches'])}")
for patch in sw['pending_patches'][:5]:
print(f" - {patch.title}")
Run a Script and Wait for Completion
# Run an automation policy/script on a device
result = client.run_and_monitor_task(
device_id=device.deviceId,
task_id=12345, # Your script/task ID from N-Central
timeout=300 # Wait up to 5 minutes
)
print(f"Task completed with status: {result['status']}")
Generate Deep Links for Tickets
device = client.get_device(device_name="PROBLEMPC")
# Get URLs you can paste into tickets
overview_url = client.get_device_overview_url(device.deviceId)
remote_url = client.get_device_remote_control_url(device.deviceId)
print(f"Device Overview: {overview_url}")
print(f"Remote Control: {remote_url}")
Performance Notes
-
Name lookups are slower than ID lookups. The N-Central API doesn't support looking up devices by name directly, so
get_device(device_name="...")fetches all devices and searches locally. Usefilter_nameto limit the scope when possible. -
Device lists are cached. By default, device lists are cached for 5 minutes to avoid hammering the API. You can clear the cache with
client.clear_device_cache()or adjust the TTL withclient.set_device_cache_ttl(seconds).
API Reference
See docs/api-reference.md for the complete function reference.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file npycentral-0.1.0.tar.gz.
File metadata
- Download URL: npycentral-0.1.0.tar.gz
- Upload date:
- Size: 24.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c9e9d0fa146de87e6b5b7f27409bb0609bc4f6a88b063f43ca73785c5caca7d
|
|
| MD5 |
629cf73945a7bf2d5e13174a2b745e9f
|
|
| BLAKE2b-256 |
a11cc264feef77fcb9a19f0609057695deba54b40fd2bb072d61630ae5e04e39
|
File details
Details for the file npycentral-0.1.0-py3-none-any.whl.
File metadata
- Download URL: npycentral-0.1.0-py3-none-any.whl
- Upload date:
- Size: 27.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
191bb8626d30aa644a30e922651bd99019ffeabb7b33709edc499f70c4e17ba5
|
|
| MD5 |
f2801917582c1047e23033f3b9637b3e
|
|
| BLAKE2b-256 |
97981712250815bcf1d55f384ccf693c78c33d8201e8754182ae8914e723cb91
|