itemprototype.get

説明

integer/array itemprototype.get(object parameters)

このメソッドは、指定された パラメータに従ってアイテムのプロトタイプを取得できます。

このメソッドは、すべてのタイプのユーザーが利用できます。メソッドを呼び出す権限は、ユーザーロールの設定で取り消すことができます。詳細については、ユーザーロール を参照してください。

パラメータ

(object) 必要な出力を定義するパラメータ。

このメソッドは以下のパラメータをサポートしています。

パラメータ 説明
discoveryids ID/array 指定したLLDルールに属するアイテムのプロトタイプのみを返します。
graphids ID/array 指定したグラフのプロトタイプで使用されているアイテムのプロトタイプのみを返します。
hostids ID/array 指定したホストに属するアイテムのプロトタイプのみを返します。
inherited boolean true に設定すると、テンプレートから継承されたアイテムのプロトタイプのみを返します。
itemids ID/array 指定したIDを持つアイテムのプロトタイプのみを返します。
monitored boolean true に設定すると、監視対象ホストに属する有効なアイテムのプロトタイプのみを返します。
templated boolean true に設定すると、テンプレートに属するアイテムのプロトタイプのみを返します。
templateids ID/array 指定したテンプレートに属するアイテムのプロトタイプのみを返します。
triggerids ID/array 指定したトリガーのプロトタイプで使用されているアイテムのプロトタイプのみを返します。
selectDiscoveryRule query アイテムのプロトタイプが属するローレベルディスカバリルールを含む discoveryRule プロパティを返します。
selectGraphs query アイテムのプロトタイプが使用されているグラフのプロトタイプを含む graphs プロパティを返します。

count をサポートします。
selectHosts query アイテムのプロトタイプが属するホストの配列を含む hosts プロパティを返します。
selectTags query tags プロパティでアイテムのプロトタイプのタグを返します。
selectTriggers query アイテムのプロトタイプが使用されているトリガーのプロトタイプを含む triggers プロパティを返します。

count をサポートします。
selectPreprocessing query アイテムのプロトタイプの前処理オプションを含む preprocessing プロパティを返します。
selectValueMap query アイテムのプロトタイプの値マップを含む valuemap プロパティを返します。
filter object 指定したフィルターに完全に一致する結果のみを返します。

キーがプロパティ名、値が一致対象の単一の値または値の配列であるオブジェクトを受け付けます。

text データ型 のプロパティはサポートしていません。

追加のプロパティをサポートします:
host - アイテムのプロトタイプが属するホストの技術名。
limitSelects integer サブセレクトで返されるレコード数を制限します。

以下のサブセレクトに適用されます:
selectGraphs - 結果は name でソートされます。
selectTriggers - 結果は description でソートされます。
sortfield string/array 指定したプロパティで結果をソートします。

指定可能な値: itemid, name, key_, delay, type, status, history, trends, discovered.
countOutput boolean これらのパラメータは リファレンスコメント で説明されています。
editable boolean
excludeSearch boolean
limit integer
output query
preservekeys boolean
search object
searchByAny boolean
searchWildcardsEnabled boolean
sortorder string/array
startSearch boolean

戻り値

(integer/array) 次のいずれかを返します:

  • オブジェクトの配列
  • countOutputパラメータが使用されている場合、取得されたオブジェクトの数

LLDルールからアイテムのプロトタイプを取得する

特定のLLDルールIDに対するすべてのアイテムのプロトタイプを取得します。

リクエスト:

{
    "jsonrpc": "2.0",
    "method": "itemprototype.get",
    "params": {
        "output": "extend",
        "discoveryids": "27426"
    },
    "id": 1
}

レスポンス:

{
    "jsonrpc": "2.0",
    "result": [
        {
            "itemid": "23077",
            "type": "0",
            "snmp_oid": "",
            "hostid": "10079",
            "name": "Incoming network traffic on en0",
            "key_": "net.if.in[en0]",
            "delay": "1m",
            "history": "1w",
            "trends": "365d",
            "status": "0",
            "value_type": "3",
            "trapper_hosts": "",
            "units": "bps",
            "logtimefmt": "",
            "templateid": "0",
            "valuemapid": "0",
            "params": "",
            "ipmi_sensor": "",
            "authtype": "0",
            "username": "",
            "password": "",
            "publickey": "",
            "privatekey": "",
            "interfaceid": "0",
            "description": "",
            "evaltype": "0",
            "jmx_endpoint": "",
            "master_itemid": "0",
            "timeout": "",
            "url": "",
            "query_fields": [],
            "posts": "",
            "status_codes": "200",
            "follow_redirects": "1",
            "post_type": "0",
            "http_proxy": "",
            "headers": [],
            "retrieve_mode": "0",
            "request_method": "0",
            "output_format": "0",
            "ssl_cert_file": "",
            "ssl_key_file": "",
            "ssl_key_password": "",
            "verify_peer": "0",
            "verify_host": "0",
            "allow_traps": "0",
            "discover": "0",
            "uuid": "",
            "parameters": []
        },
        {
            "itemid": "10010",
            "type": "0",
            "snmp_oid": "",
            "hostid": "10001",
            "name": "Processor load (1 min average per core)",
            "key_": "system.cpu.load[percpu,avg1]",
            "delay": "1m",
            "history": "1w",
            "trends": "365d",
            "status": "0",
            "value_type": "0",
            "trapper_hosts": "",
            "units": "",
            "logtimefmt": "",
            "templateid": "0",
            "valuemapid": "0",
            "params": "",
            "ipmi_sensor": "",
            "authtype": "0",
            "username": "",
            "password": "",
            "publickey": "",
            "privatekey": "",
            "interfaceid": "0",
            "description": "The processor load is calculated as system CPU load divided by number of CPU cores.",
            "evaltype": "0",
            "jmx_endpoint": "",
            "master_itemid": "0",
            "timeout": "",
            "url": "",
            "query_fields": [],
            "posts": "",
            "status_codes": "200",
            "follow_redirects": "1",
            "post_type": "0",
            "http_proxy": "",
            "headers": [],
            "retrieve_mode": "0",
            "request_method": "0",
            "output_format": "0",
            "ssl_cert_file": "",
            "ssl_key_file": "",
            "ssl_key_password": "",
            "verify_peer": "0",
            "verify_host": "0",
            "allow_traps": "0",
            "discover": "0",
            "uuid": "",
            "parameters": []
        }
    ],
    "id": 1
}

依存アイテムの検索

特定のアイテムIDに対する依存アイテムを1つ検索します。

リクエスト:

{
    "jsonrpc": "2.0",
    "method": "item.get",
    "params": {
        "output": "extend",
        "filter": {
            "type": 18,
            "master_itemid": "25545"
        },
        "limit": "1"
    },
    "id": 1
}

レスポンス:

{
    "jsonrpc": "2.0",
    "result": [
        {
            "itemid": "25547",
            "type": "18",
            "snmp_oid": "",
            "hostid": "10116",
            "name": "Seconds",
            "key_": "apache.status.uptime.seconds",
            "delay": "0",
            "history": "90d",
            "trends": "365d",
            "status": "0",
            "value_type": "3",
            "trapper_hosts": "",
            "units": "",
            "logtimefmt": "",
            "templateid": "0",
            "valuemapid": "0",
            "params": "",
            "ipmi_sensor": "",
            "authtype": "0",
            "username": "",
            "password": "",
            "publickey": "",
            "privatekey": "",
            "interfaceid": "0",
            "description": "",
            "evaltype": "0",
            "master_itemid": "25545",
            "jmx_endpoint": "",
            "timeout": "",
            "url": "",
            "query_fields": [],
            "posts": "",
            "status_codes": "200",
            "follow_redirects": "1",
            "post_type": "0",
            "http_proxy": "",
            "headers": [],
            "retrieve_mode": "0",
            "request_method": "0",
            "output_format": "0",
            "ssl_cert_file": "",
            "ssl_key_file": "",
            "ssl_key_password": "",
            "verify_peer": "0",
            "verify_host": "0",
            "allow_traps": "0",
            "discover": "0",
            "uuid": "",
            "parameters": []
        }
    ],
    "id": 1
}

HTTPエージェントのアイテムプロトタイプを検索

特定のホストIDについて、リクエストメソッドが HEAD のHTTPエージェントのアイテムプロトタイプを検索します。

リクエスト:

{
    "jsonrpc": "2.0",
    "method": "itemprototype.get",
    "params": {
        "hostids": "10254",
        "filter": {
            "type": 19,
            "request_method": 3
        }
    },
    "id": 1
}

レスポンス:

{
    "jsonrpc": "2.0",
    "result": [
        {
            "itemid": "28257",
            "type": "19",
            "snmp_oid": "",
            "hostid": "10254",
            "name": "discovered",
            "key_": "item[{#INAME}]",
            "delay": "{#IUPDATE}",
            "history": "90d",
            "trends": "30d",
            "status": "0",
            "value_type": "3",
            "trapper_hosts": "",
            "units": "",
            "logtimefmt": "",
            "templateid": "28255",
            "valuemapid": "0",
            "params": "",
            "ipmi_sensor": "",
            "authtype": "0",
            "username": "",
            "password": "",
            "publickey": "",
            "privatekey": "",
            "flags": "2",
            "interfaceid": "2",
            "description": "",
            "evaltype": "0",
            "jmx_endpoint": "",
            "master_itemid": "0",
            "timeout": "",
            "url": "{#IURL}",
            "query_fields": [],
            "posts": "",
            "status_codes": "",
            "follow_redirects": "0",
            "post_type": "0",
            "http_proxy": "",
            "headers": [],
            "retrieve_mode": "0",
            "request_method": "3",
            "output_format": "0",
            "ssl_cert_file": "",
            "ssl_key_file": "",
            "ssl_key_password": "",
            "verify_peer": "0",
            "verify_host": "0",
            "allow_traps": "0",
            "discover": "0",
            "uuid": "",
            "parameters": []
        }
    ],
    "id": 1
}

関連項目

ソース

CItemPrototype::get() in ui/include/classes/api/services/CItemPrototype.php.