Troubleshooting Netpicker with troubleshoot.sh

The troubleshoot.sh script checks a running Netpicker Docker Compose installation and explains problems it finds. Use it when you need a quick health check or when Netpicker Support asks for diagnostic information.

The normal check is read-only. Run it on the Docker host as a user that can access the Docker daemon. If the API container is down, the script may start a temporary, network-isolated container from the API image to inspect its database migration files; that container is removed afterward.

1. Run the standard health check

Open a terminal on the Netpicker Docker host, change to the Netpicker installation directory, and run:

cd /path/to/netpicker
./troubleshoot.sh

If the script is not executable, make it executable once and run it again:

chmod +x troubleshoot.sh
./troubleshoot.sh

The script automatically detects the Docker Compose project when exactly one Netpicker stack is present. If the host runs more than one Netpicker stack, specify the project name:

./troubleshoot.sh --project PROJECT_NAME

The report covers:

  • Netpicker version and repository state
  • Host CPU, memory, uptime, and disk space
  • Container state, health checks, resource limits, and Compose configuration
  • Database migration revision and container-to-container connectivity
  • Agent connectivity and backup upload paths
  • Redis and Celery task queues
  • Git repositories in the policy work directory
  • The latest backup and policy run for each device
  • Recent errors in container logs

At the end, the Summary section lists every warning and failure and prints one of these results:

  • Result: OK — all checks passed
  • Result: WARN — one or more warnings were found
  • Result: FAIL — one or more checks failed

2. Adjust the diagnostic run

Use these options to focus or expand the report:

Option Purpose
-p, --project NAME Check a specific Docker Compose project instead of auto-detecting it.
-s, --since DURATION Choose how far back to scan logs. The default is 1h; examples include 30m, 6h, or an ISO timestamp.
-i, --interval SECS Choose how long to watch task queues. The default is 15 seconds.
--task-age SECS Warn when queued tasks, backups, or policy runs have remained unfinished longer than this threshold. The default is 3,600 seconds.
--ignore REGEX Ignore log lines that match an extended regular expression. Repeat the option for multiple patterns.
-v, --verbose Show more log lines for each container.
--no-color Disable coloured terminal output, which is useful when saving or pasting the report.
-h, --help Show the script’s built-in usage information.

Examples:

# Scan the last six hours and include more log detail
./troubleshoot.sh --since 6h --verbose

# Check a named Compose project without coloured output
./troubleshoot.sh --project netpicker --no-color

# Warn when a task has run for more than two hours
./troubleshoot.sh --task-age 7200

3. Create a support bundle

Add --bundle to run the checks and create a compressed support bundle:

./troubleshoot.sh --bundle

The bundle is named like netpicker-support-HOST-YYYYMMDD-HHMMSS.tar.gz. It is written to the current directory, or to the system temporary directory if the current directory is not writable. It includes the report, system and container details, recent logs, Compose information, Redis state, agent information, and database migration details.

Review the archive before sharing it. The script masks secrets in environment variables, Compose files, and URLs on a best-effort basis, but logs may still contain sensitive information such as device names and addresses.

4. Understand the exit status

The script returns an exit status that can also be used by shell automation:

  • 0 — all checks passed
  • 1 — warnings were found
  • 2 — failures were found
  • 3 — the script could not run, for example because Docker was unavailable or the Compose project could not be identified
./troubleshoot.sh --no-color
status=$?
echo "Troubleshoot exit status: $status"

5. Resolve common startup errors

Cannot talk to the Docker daemon

Run the script as root or as a user that belongs to the Docker group and can run docker info.

No Netpicker stack found

Confirm that the Netpicker containers exist on this host. If the Compose project uses an unusual layout, pass its name with --project NAME.

Several Netpicker stacks found

Choose the stack explicitly:

docker compose ls
./troubleshoot.sh --project PROJECT_NAME

6. Use maintenance modes only when the report recommends them

The following modes do not run the diagnostic checks. They change or delete state, show what they will affect, ask for confirmation, and then exit. Do not combine them with each other or with --bundle. The --yes option skips confirmation, so use it only when you have already reviewed the targets.

Clear stuck Celery queues

./troubleshoot.sh --clear-queues

This deletes waiting and in-flight tasks from the Redis-backed Celery queues. Use it when the normal report says scheduled backups or policy runs are lost or stuck while kibbitzer and committer are idle. Deleted tasks do not resume; the next scheduled runs start afresh.

Terminate a long-running task

./troubleshoot.sh --terminate-task TASK_ID

Use the exact task ID printed by the task-queue check. The worker first sends SIGTERM and then SIGKILL if needed. The task does not run again. You can repeat --terminate-task TASK_ID to select more than one task. If a worker does not answer control commands, restart that worker instead.

Reset stale policy work directories

./troubleshoot.sh --reset-workdir

This runs git reset --hard and git clean in affected policy-workdir repositories, deleting uncommitted files left by old backup or policy runs. It skips repositories with newer files, a running Git command, or a rebase, and it keeps commits that have not been pushed to gitd. Stale Git lock files older than 10 minutes receive a separate confirmation prompt before removal and reset.

For the current implementation and built-in help, see troubleshoot.sh on GitHub. This article was verified against Netpicker 2.8.3 at commit 92530b9.

Would you like a hands-on session?

A couple times a week our in-house trainer is available for a private or group session. In this session we can cover our Slurp'it or Mock'it solution but also integrations with Netpicker, NetBox, Nautobot & Infrahub.

Yes, keep me informed

Connect with us on LinkedIn to stay updated on the latest happenings, news, and exciting developments at Slurp'it. Just click the button below to follow us and be a part of our professional network.

Newsletter