syno

command module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2026 License: MIT Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

syno

Test

Find the Synology NAS on your network and check on it from the terminal.

syno finds a NAS without logging in, the way Synology's Web Assistant does, and then reads its state through the DSM Web API: the system, storage pools, volumes and disks, and a health check you can run from cron.

$ syno discover
NAME   IP             MAC                 DSM                         SOURCE
nas    192.168.1.10   90:09:d0:12:34:56   https://192.168.1.10:5001   mdns,arp

$ syno doctor
✓ pools               1 pool healthy
! volumes             /volume1 88% used
✓ disks               4 disks healthy
✓ disk-temperature    hottest disk is 38°C
! scrubbing           Pool 1 has no scrubbing schedule
✓ system-temperature  52°C, no warning from DSM
✓ reboot              no reboot pending
✓ dsm-update          DSM is up to date
✓ security-advisor    no findings, last scan 3 days ago
✓ certificates        2 certificates valid, next expiry in 64 days

8 ok, 2 warn

syno is not affiliated with or endorsed by Synology Inc. Synology and DSM are trademarks of Synology Inc.

Install

Archives for macOS and Linux (arm64 and x86_64) are on the releases page.

With Go:

go install github.com/babarot/syno@latest

With Nix, from babarot/nur-packages:

nix profile install github:babarot/nur-packages#syno

Quick start

syno discover   # find the NAS on the local network
syno login      # log in once and save it as a profile
syno status     # system, pools, volumes and disks
syno doctor     # health checks, with an exit status for monitoring

Storage information needs an account in the administrators group.

Commands

discover

Finds Synology NAS on the local network without logging in. Candidates come from mDNS, from the ARP table (Synology's MAC address prefixes) and, with --scan, from a sweep of the local /24 networks for the DSM ports 5000 and 5001. Each candidate is then checked for a DSM Web API.

syno discover
syno discover --scan --json

login

Logs in to DSM, then saves the NAS and the account as a profile and the password in the OS keyring. Without --host, the NAS is found with discover. Before the password is sent, the server certificate is checked; see Security.

syno login
syno login --host https://192.168.1.10:5001 -u admin --profile home

When the account uses 2FA, syno asks for a code once and saves the device token DSM issues, so later commands do not ask again.

profile

syno profile list           # the current profile is marked with *
syno profile use office
syno profile remove office  # also removes its password from the keyring

remove keeps the keyring items when another profile uses the same URL and account.

Every command that logs in uses the profile given by --profile (-p), then SYNO_PROFILE, then the current profile.

status

Shows the system, CPU and memory usage, storage pools, volumes and disks. --raw prints the API responses as they are.

$ syno status
SYSTEM
  Host          https://192.168.1.10:5001
  Model         DS923+
  Serial        0000ABCDE0000
  DSM           DSM 7.2.2-72806 Update 4
  Uptime        12d 3h 4m
  Temperature   52°C
  CPU           4%
  Memory        21% of 3.8 GB

POOL     STATUS   TYPE                      DISKS   USED      TOTAL     USE%
Pool 1   normal   shr_with_1_disk_protect   4       19.1 TB   21.8 TB   88%

VOLUME     STATUS   FS      POOL     USED      TOTAL     USE%
/volume1   normal   btrfs   Pool 1   18.6 TB   21.1 TB   88%

DISK      MODEL                        SIZE     STATUS   SMART    TEMP   POOL
Drive 1   WDC WD80EFZZ-68BTXN0         7.3 TB   normal   normal   37°C   Pool 1
...

doctor

Runs health checks and reports each as ok, warn, fail, unknown or skip. syno doctor --list shows every check:

Check What it looks at
pools Failed or missing disks, and DSM's status of each storage pool
volumes Usage against the thresholds, and DSM's status of each volume
disks Disk status, SMART, the remaining life DSM estimates and uncorrectable sectors
disk-temperature Disk temperatures against the thresholds
scrubbing Whether data scrubbing is scheduled and when it last ran
system-temperature DSM's own temperature warning
reboot A reboot pending to finish an update
dsm-update A newer DSM (the NAS asks Synology's update server)
security-advisor Findings of the Security Advisor and the age of its last scan
certificates Broken, expired and expiring certificates
syno doctor --skip dsm-update   # turn checks off
syno doctor --only volumes,disks
syno doctor --json

The exit status follows the Nagios plugin convention, so syno doctor can be used from cron or a monitoring system as it is:

Exit status Meaning
0 Every check is ok or skipped
1 At least one check warns
2 At least one check fails
3 A check could not run, the NAS could not be reached, or the settings are invalid

api

Calls any DSM Web API with the saved account and prints the data field of the response as JSON. DSM has hundreds of APIs and few are documented, so this is the way to look around. The path and the latest version of each API come from SYNO.API.Info.

syno api --list storage                   # the APIs the NAS provides (no login needed)
syno api SYNO.Core.System info
syno api SYNO.Core.Share list -f additional='["share_quota"]'

For APIs that take JSON parameters, -f values that are not valid JSON are sent as JSON strings, so -f name=homes works as well as -f 'name="homes"'. A value that is valid JSON is sent as it is: quote a number the API expects as a string, as in -f 'id="123"'.

Configuration

syno keeps two files in ~/.config/syno (or $XDG_CONFIG_HOME/syno):

File Written by Holds
profiles.yaml syno Profiles: the DSM URL, the account and the TLS pin
config.yaml You Settings; syno only reads this file, so your comments stay

config.yaml holds the doctor settings. Leave out what you do not want to change:

doctor:
  skip: [dsm-update]
  thresholds:
    volume_usage: {warn: 85, fail: 95}       # percent
    disk_temperature: {warn: 50, fail: 60}   # Celsius
    scrub_age_days: 90
    security_scan_age_days: 30
    cert_expiry_days: 30
    renewable_cert_expiry_days: 14           # certificates DSM renews, such as Let's Encrypt

Unknown keys are errors, so a typo does not go unnoticed. --skip adds to doctor.skip, and --only ignores it.

Security

  • Passwords and 2FA device tokens are kept in the OS keyring: the Keychain on macOS and the Secret Service on Linux. On a machine without a keyring, set SYNO_PASSWORD.
  • The server certificate is verified. A NAS often has a certificate the system does not trust, such as DSM's self-signed one, or one for a domain name while you connect by IP address. In that case syno login shows the certificate and asks whether to pin its public key, as SSH does with host keys. Later commands then accept only that key, and fail if it changes. --trust-pin accepts a known pin without asking.
  • To avoid pinning, connect with a host name that has a valid certificate, for example syno login --host https://nas.example.com:5001.
  • syno login refuses plain HTTP unless --allow-http is given, since the password would be sent in clear text.
  • discover and api --list do not verify certificates. They only read SYNO.API.Info, which needs no login, and send no credentials.

Compatibility

syno has been tested with a DS923+ on DSM 7.2.2. Most of the DSM Web APIs it uses are not documented by Synology, and their responses may change between DSM versions. syno status --raw and syno api help to see what a NAS actually returns.

Development

make build   # ./syno
make test    # go vet and go test
make lint    # golangci-lint

License

MIT

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal
config
Package config reads and writes syno's files in ~/.config/syno: profiles.yaml, which syno writes, and config.yaml, which users write.
Package config reads and writes syno's files in ~/.config/syno: profiles.yaml, which syno writes, and config.yaml, which users write.
credential
Package credential keeps DSM secrets in the OS keyring: the Keychain on macOS, the Secret Service on Linux and the Credential Manager on Windows.
Package credential keeps DSM secrets in the OS keyring: the Keychain on macOS, the Secret Service on Linux and the Credential Manager on Windows.
doctor
Package doctor runs health checks against a DSM host.
Package doctor runs health checks against a DSM host.
dsm
Package dsm is a small client for the Synology DSM Web API.
Package dsm is a small client for the Synology DSM Web API.
version
Package version holds the release version.
Package version holds the release version.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL