Skip to content

Commit 9d41278

Browse files
authored
Merge pull request #293 from amidaware/feat-properties
add docs for property field and agent note
2 parents 5911e3a + d596ec0 commit 9d41278

2 files changed

Lines changed: 98 additions & 0 deletions

File tree

docs/ee/reporting/functions/reporting_dataqueries.md

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,101 @@ You can access the custom field data for the clients data query like this:
204204
Note that you can't use dot notation for a property if it has spaces. See the above
205205
example for the **Custom Field 2** property
206206

207+
### properties - array of strings
208+
209+
This will allow injecting model @property fields into the data. The current supported
210+
fields are:
211+
212+
**Agent**
213+
214+
* client
215+
* timezone
216+
* is_posix
217+
* arch
218+
* status
219+
* checks
220+
* pending_actions_count
221+
* cpu_model
222+
* graphics
223+
* local_ips
224+
* make_model
225+
* physical_disks
226+
* serial_number
227+
228+
**AgentCustomField**
229+
230+
* value
231+
232+
**Alert**
233+
234+
* assigned_agent
235+
* site
236+
* client
237+
* get_result
238+
239+
**Policy**
240+
241+
* is_default_server_policy
242+
* is_default_workstation_policy
243+
244+
Automated Task
245+
246+
* schedule
247+
248+
**Check**
249+
250+
* readable_desc
251+
252+
**CheckResult**
253+
254+
* history_info
255+
256+
**Client**
257+
258+
* live_agent_count
259+
260+
**Site**
261+
262+
* live_agent_count
263+
264+
**Client Custom Field**
265+
266+
* value
267+
268+
**Site Custom Field**
269+
270+
* value
271+
272+
We can pull this data in a data query like this:
273+
274+
```yaml
275+
data_sources:
276+
agents:
277+
model: agent
278+
only:
279+
- hostname
280+
- operating_system
281+
- plat
282+
properties:
283+
- status
284+
- is_posix
285+
- make_model
286+
- cpu_model
287+
checks:
288+
model: check
289+
properties:
290+
- readable_desc
291+
```
292+
293+
You can access the property data directly on the agent in the template like this:
294+
295+
```
296+
{% for item in data_source.agents %}
297+
{{ item.status }}
298+
{{ item.make_model }}
299+
{% endfor %}
300+
```
301+
207302
### [filter](https://docs.djangoproject.com/en/4.2/ref/models/querysets/#filter) - object
208303

209304
Using the filter property, you can filter the amount of rows that are returned. This

docs/script_variables.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ Tactical RMM allows passing dashboard data into script as arguments or environme
77

88
For a full list of available fields, refer to the variables in the `models.py` files:
99

10+
!!!info
11+
@property functions under the model will work as well
12+
1013
[Agent](https://github.com/amidaware/tacticalrmm/blob/89aceda65a1c54fea7b18250ca63614f091eac6e/api/tacticalrmm/agents/models.py#L60)
1114

1215
[Client](https://github.com/amidaware/tacticalrmm/blob/89aceda65a1c54fea7b18250ca63614f091eac6e/api/tacticalrmm/clients/models.py#L18)

0 commit comments

Comments
 (0)