You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

PRTG API技术求助:如何筛选带有特定标签的所有设备?

Filtering PRTG Devices by Specific Tag via API

Hey there! I’ve spent plenty of time working with PRTG’s API to pull filtered device data, so let’s walk through exactly how to get devices with a specific tag.

The most flexible endpoint for this task is the table.json API, which lets you query device datasets and apply precise filters. Here’s how to structure your request:

Basic Request Structure

You’ll need to construct a GET request with these key parameters:

  • content=devices: Tells PRTG you want to retrieve device records
  • filter_tag=<your-tag>: The tag you want to filter devices by (exact match)
  • columns=<fields>: Specify which device details to return (e.g., objid, name, host, tags)
  • Authentication: Use username=<your-username> and passhash=<your-passhash> (passhash is preferred over plaintext password for security)

Full example URL:

https://your-prtg-server/api/table.json?content=devices&output=json&columns=objid,name,host,tags&filter_tag=production-server&username=prtg-admin&passhash=123456789

Example Testing with Curl

If you want to test quickly from the command line, use this curl command (replace placeholders with your actual data):

curl "https://your-prtg-server/api/table.json?content=devices&output=json&columns=objid,name,tags&filter_tag=production&username=admin&passhash=123456"

Advanced Filtering Options

  • Multiple tags (match any): Separate tags with commas to get devices that have at least one of the tags:
    filter_tag=production,web-server
    
  • Multiple tags (match all): Use a + (URL-encoded as %2B) to get devices that have all specified tags:
    filter_tag=production%2Bweb-server
    
  • Include subdevices: Add &show=subdevices to the request if you want to include child devices under parent groups/devices.

Authentication Notes

To get your passhash:

  1. Log into PRTG as an admin user
  2. Go to Setup > Account Settings > My Account
  3. Copy the value from the "Passhash" field (this is a unique hash for your account, safer to use than your password in API calls)

Troubleshooting Tips

  • Double-check the tag spelling: PRTG tags are case-sensitive, so make sure it matches exactly how the tag appears in your device settings
  • Verify permissions: Ensure your user account has access to the devices you’re trying to retrieve
  • Check for typos in the API endpoint or parameters (common mistakes include missing content=devices or incorrect passhash)

内容的提问来源于stack exchange,提问作者Vojta

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.26 10:17:14