> For the complete documentation index, see [llms.txt](https://docs.nexthink.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.nexthink.com/platform/ja/user-guide/software-metering/software-metering-nql-examples.md). Agents can also search and read this documentation through its [MCP server](https://docs.nexthink.com/~gitbook/mcp).

# ソフトウェアメータリングのNQL機能

{% hint style="warning" %}
\nNexthink Infinity からユーザーやデバイスを削除することができます。これが起こると、ソフトウェアメータリングデータが、関連付けられたユーザーやデバイスがない状態で残る場合があります。 Inventory オブジェクトのデータ保持に関する詳細については、\[understanding-key-data-platform-concepts]\(../../understanding-key-data-platform-concepts/ "mention") のドキュメントを参照してください。
{% endhint %}

## ソフトウェアメータリングデータをクエリする <a href="#softwaremeteringnqlexamples-queryingthesoftwaremeteringdata" id="softwaremeteringnqlexamples-queryingthesoftwaremeteringdata"></a>

ソフトウェアメータリングデータやその他の関連情報にアクセスするために、[調査](https://docs.nexthink.com/platform/ja/user-guide/investigations.md) モジュールで Nexthink Query Language (NQL) を使用します。

## NQL データの構造 <a href="#softwaremeteringnqlexamples-nqldatastructure" id="softwaremeteringnqlexamples-nqldatastructure"></a>

`software_metering.events` テーブルにはソフトウェア利用データが含まれています。各イベントの解像度は1週です。このデータの保持期間は90日です。

## NQLにおけるソフトウェアメータリングと他のテーブル間の時間枠の整合性

NQLを使用してソフトウェアメータリングデータをクエリする際、これらのイベントが7日ごとにグループ化されることに注意してください。これは、各イベントが1週間全日程にわたることを意味し、単日ではありません。毎週の`software_metering.event`の開始は、常に月曜日の00:00 UTCです。

**なぜ重要か**

この週間のグループ化のために、**時間枠が一致しない**と以下を引き起こす可能性があります：

* データの欠落、
* 部分的な結果の含有、または
* 不正確な比較―特に、より細かい時間単位を使用する`execution.events`などのイベントと組み合わせる場合。

例えば、これら2つのクエリは、いずれも月曜日の00:00 UTCからデータ取得を開始するため、同じ結果を返します：

```nql
software_metering.events from 2025-08-04 00:00:00 to 2025-08-08 10:00:00
| where application.name == "Firefox"
| summarize number_of_users = user.count()
```

```nql
execution.events from 2025-08-04 00:00:00 to 2025-08-08 10:00:00
| where application.name == "Firefox"
| summarize number_of_users = user.count()
```

### NQL クエリの例 <a href="#softwaremeteringnqlexamples-examplesofnqlqueries" id="softwaremeteringnqlexamples-examplesofnqlqueries"></a>

<details>

<summary>直近90日のデスクトップベースのソフトウェアで2時間未満しか使用していないユーザーのリストを取得する。</summary>

{% code lineNumbers="true" %}

```
Users during past 30d
| with software_metering.events during past 90d
| where meter_configuration.name == "*office*"
| compute desktop_app_usage = desktop_focus_time.sum()
| where desktop_app_usage != NULL and desktop_app_usage < 2h
| list user.name, desktop_app_usage
```

{% endcode %}

</details>

<details>

<summary>過去90日間アプリケーションパッケージがインストールされているが、アプリケーションの利用がないデバイスのリストを取得する。</summary>

{% code lineNumbers="true" %}

```
Devices during past 30d
| include software_metering.events during past 90d
| where meter_configuration.name  == "visio"
| compute desktop_app_usage = desktop_focus_time.sum()
| include package.installed_packages
| where Package.name == "*visio*"
| where package.type == program
| compute packages_installed = device.count()
| where desktop_app_usage == NULL and packages_installed > 0
| list device.name, desktop_app_usage, packages_installed
```

{% endcode %}

</details>

<details>

<summary>ウェブ使用時間が有効でない場合: ウェブベースソフトウェアに少なくとも一度アクセスしたユーザーのリストを取得する。</summary>

{% code lineNumbers="true" %}

```
users during past 30d
| with software_metering.events during past 90d
| where meter_configuration.name == "*miro*"
| where web_is_used == TRUE
| compute event_where_web_was_used = count()
| where event_where_web_was_used > 0
| summarize users_using_application = count()
```

{% endcode %}

</details>

***


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.nexthink.com/platform/ja/user-guide/software-metering/software-metering-nql-examples.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
