Pi-hole icon

Pi-hole

Get information from Pi-hole API

Actions10

Overview

This n8n node interacts with the Pi-hole API to retrieve the global status of a Pi-hole system. Specifically, for the Status resource and the Get operation, it fetches whether the Pi-hole is currently enabled or disabled. This node is useful in automation scenarios where you need to monitor the operational state of your network's ad-blocking service, such as:

  • Checking if Pi-hole is active before running network diagnostics.
  • Integrating Pi-hole status checks into monitoring dashboards.
  • Triggering alerts or follow-up actions based on Pi-hole's availability.

Example use case:
Automatically check Pi-hole's status every hour and send a notification if it becomes disabled.

Properties

Name Type Meaning
API Url String The base URL of your Pi-hole API endpoint (e.g., http://localhost/admin/api.php). This is required to connect to your Pi-hole instance.

Output

The output will be a JSON object containing the current status of the Pi-hole system. Typical fields include:

{
  "status": "enabled"
}

or

{
  "status": "disabled"
}
  • status: Indicates whether the Pi-hole is currently enabled or disabled.

Dependencies

  • Pi-hole API: You must have a running Pi-hole instance with its API accessible at the specified API URL.
  • API Url: Ensure the provided URL points to your Pi-hole's API endpoint.
  • n8n Configuration: No special credentials are required for this operation, but network access to the Pi-hole server is necessary.

Troubleshooting

Common Issues:

  • Incorrect API URL: If the API URL is wrong or unreachable, the node will fail to connect. Double-check the URL and network connectivity.
  • CORS or Network Errors: If n8n cannot reach the Pi-hole server due to firewall or network restrictions, you'll receive connection errors.
  • Unexpected Output: If the Pi-hole API changes or returns an unexpected response, the output may not contain the expected status field.

Error Messages and Resolutions:

  • "ECONNREFUSED" or "ENOTFOUND": The node cannot connect to the Pi-hole server. Verify the API URL and that the server is running.
  • "Invalid JSON response": The API did not return valid JSON. Check if the API endpoint is correct and accessible.

Links and References

Discussion