mirror of
https://github.com/GAM-team/GAM.git
synced 2026-06-28 01:41:36 +00:00
Added option ou_and_children <OrgUnitItem> to gam print|show crostelemetry
This commit is contained in:
@@ -832,7 +832,7 @@ gam info crostelemetry <SerialNumber>
|
||||
### Display data about all or selected devices.
|
||||
```
|
||||
gam show crostelemetry
|
||||
[(ou|org|orgunit <OrgUnitItem>)|(cros_sn <SerialNumber>)|(filter <String>)]
|
||||
[(ou|org|orgunit|ou_and_children <OrgUnitItem>)|(cros_sn <SerialNumber>)|(filter <String>)]
|
||||
<CrOSTelemetryFieldName>* [fields <CrOSTelemetryFieldNameList>]
|
||||
[start <Date>] [end <Date>] [listlimit <Number>]
|
||||
[reverselists <CrOSTelemetryListFieldNameList>]
|
||||
@@ -841,6 +841,7 @@ gam show crostelemetry
|
||||
Use these options to select CrOS devices; if none are chosen, all CrOS devices in the account are selected.
|
||||
|
||||
- `ou|org|orgunit <OrgUnitItem>` - Select CrOS devices directly in the OU `<OrgUnitItem>`
|
||||
- `ou_and_children <OrgUnitItem>` - Select CrOS devices in the OU `<OrgUnitItem>` and its sub OUs
|
||||
- `cros_sn <SerialNumber>` - Select the CrOS device with serial number `<SerialNumber>`.
|
||||
- `filter <String>` - Select the CrOS device with a filter.
|
||||
- `listlimit <Number>` - Limits the number of repetitions to `<Number>`; if not specified or `<Number>` equals zero, there is no limit.
|
||||
@@ -857,7 +858,7 @@ By default, Gam displays the information as an indented list of keys and values:
|
||||
### Print data about all or selected devices.
|
||||
```
|
||||
gam print crostelemetry [todrive <ToDriveAttribute>*]
|
||||
[(ou|org|orgunit <OrgUnitItem>)|(cros_sn <SerialNumber>)|(filter <String>)]
|
||||
[(ou|org|orgunit|ou_and_children <OrgUnitItem>)|(cros_sn <SerialNumber>)|(filter <String>)]
|
||||
<CrOSTelemetryFieldName>* [fields <CrOSTelemetryFieldNameList>]
|
||||
[reverselists <CrOSTelemetryListFieldNameList>]
|
||||
[start <Date>] [end <Date>] [listlimit <Number>]
|
||||
@@ -866,6 +867,7 @@ gam print crostelemetry [todrive <ToDriveAttribute>*]
|
||||
Use these options to select CrOS devices; if none are chosen, all CrOS devices in the account are selected.
|
||||
|
||||
- `ou|org|orgunit <OrgUnitItem>` - Select CrOS devices directly in the OU `<OrgUnitItem>`
|
||||
- `ou_and_children <OrgUnitItem>` - Select CrOS devices in the OU `<OrgUnitItem>` and its sub OUs
|
||||
- `cros_sn <SerialNumber>` - Select the CrOS device with serial number `<SerialNumber>`.
|
||||
- `filter <String>` - Select the CrOS device with a filter.
|
||||
- `listlimit <Number>` - Limits the number of repetitions to `<Number>`; if not specified or `<Number>` equals zero, there is no limit.
|
||||
|
||||
@@ -10,6 +10,11 @@ Add the `-s` option to the end of the above commands to suppress creating the `g
|
||||
|
||||
See [Downloads](https://github.com/taers232c/GAMADV-XTD3/wiki/Downloads) for Windows or other options, including manual installation.
|
||||
|
||||
### 6.63.11
|
||||
|
||||
Added option `ou_and_children <OrgUnitItem>` to `gam print|show crostelemetry` to simplify getting
|
||||
telemetry data for all ChromeOS devices in an OU and its children.
|
||||
|
||||
### 6.63.10
|
||||
|
||||
Added option `addcsvdata <FieldName> <String>` to these commands. This adds additional columns of data to the CSV file output
|
||||
|
||||
@@ -108,7 +108,7 @@ users in a particular archived state. This option can be used with the following
|
||||
(query <QueryUser>)|
|
||||
(queries <QueryUserList>)
|
||||
```
|
||||
Prior to bersion `6.20.05`, the `notarchived|archived` option could only be used with the following `<UserTypeEntity>`:
|
||||
Prior to version `6.20.05`, the `notarchived|archived` option could only be used with the following `<UserTypeEntity>`:
|
||||
```
|
||||
(group|group_ns|group_susp <GroupItem>)|
|
||||
(groups|groups_ns|groups_susp <GroupList>)|
|
||||
|
||||
@@ -330,7 +330,7 @@ writes the credentials into the file oauth2.txt.
|
||||
admin@server:/Users/admin/bin/gamadv-xtd3$ rm -f /Users/admin/GAMConfig/oauth2.txt
|
||||
admin@server:/Users/admin/bin/gamadv-xtd3$ ./gam version
|
||||
WARNING: Config File: /Users/admin/GAMConfig/gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: /Users/admin/GAMConfig/oauth2.txt, Not Found
|
||||
GAMADV-XTD3 6.63.10 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
||||
GAMADV-XTD3 6.63.11 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
||||
Ross Scroggs <ross.scroggs@gmail.com>
|
||||
Python 3.10.8 64-bit final
|
||||
MacOS High Sierra 10.13.6 x86_64
|
||||
@@ -972,7 +972,7 @@ writes the credentials into the file oauth2.txt.
|
||||
C:\GAMADV-XTD3>del C:\GAMConfig\oauth2.txt
|
||||
C:\GAMADV-XTD3>gam version
|
||||
WARNING: Config File: C:\GAMConfig\gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: C:\GAMConfig\oauth2.txt, Not Found
|
||||
GAMADV-XTD3 6.63.10 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
||||
GAMADV-XTD3 6.63.11 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
||||
Ross Scroggs <ross.scroggs@gmail.com>
|
||||
Python 3.11.5 64-bit final
|
||||
Windows-10-10.0.17134 AMD64
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Print the current version of Gam with details
|
||||
```
|
||||
gam version
|
||||
GAMADV-XTD3 6.63.10 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
||||
GAMADV-XTD3 6.63.11 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
||||
Ross Scroggs <ross.scroggs@gmail.com>
|
||||
Python 3.11.5 64-bit final
|
||||
MacOS Monterey 12.6.6 x86_64
|
||||
@@ -15,7 +15,7 @@ Time: 2023-06-02T21:10:00-07:00
|
||||
Print the current version of Gam with details and time offset information
|
||||
```
|
||||
gam version timeoffset
|
||||
GAMADV-XTD3 6.63.10 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
||||
GAMADV-XTD3 6.63.11 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
||||
Ross Scroggs <ross.scroggs@gmail.com>
|
||||
Python 3.11.5 64-bit final
|
||||
MacOS Monterey 12.6.6 x86_64
|
||||
@@ -27,7 +27,7 @@ Your system time differs from www.googleapis.com by less than 1 second
|
||||
Print the current version of Gam with extended details and SSL information
|
||||
```
|
||||
gam version extended
|
||||
GAMADV-XTD3 6.63.10 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
||||
GAMADV-XTD3 6.63.11 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
||||
Ross Scroggs <ross.scroggs@gmail.com>
|
||||
Python 3.11.5 64-bit final
|
||||
MacOS Monterey 12.6.6 x86_64
|
||||
@@ -64,7 +64,7 @@ MacOS High Sierra 10.13.6 x86_64
|
||||
Path: /Users/Admin/bin/gamadv-xtd3
|
||||
Version Check:
|
||||
Current: 5.35.08
|
||||
Latest: 6.63.10
|
||||
Latest: 6.63.11
|
||||
echo $?
|
||||
1
|
||||
```
|
||||
@@ -72,7 +72,7 @@ echo $?
|
||||
Print the current version number without details
|
||||
```
|
||||
gam version simple
|
||||
6.63.10
|
||||
6.63.11
|
||||
```
|
||||
In Linux/MacOS you can do:
|
||||
```
|
||||
@@ -82,7 +82,7 @@ echo $VER
|
||||
Print the current version of Gam and address of this Wiki
|
||||
```
|
||||
gam help
|
||||
GAM 6.63.10 - https://github.com/taers232c/GAMADV-XTD3
|
||||
GAM 6.63.11 - https://github.com/taers232c/GAMADV-XTD3
|
||||
Ross Scroggs <ross.scroggs@gmail.com>
|
||||
Python 3.11.5 64-bit final
|
||||
MacOS Monterey 12.6.6 x86_64
|
||||
|
||||
@@ -2416,13 +2416,13 @@ gam info crostelemetry <SerialNumber>
|
||||
[reverselists <CrOSTelemetryListFieldNameList>]
|
||||
[formatjson]
|
||||
gam show crostelemetry
|
||||
[(ou|org|orgunit <OrgUnitItem>)|(cros_sn <SerialNumber>)|(filter <String>)]
|
||||
[(ou|org|orgunit|ou_and_children <OrgUnitItem>)|(cros_sn <SerialNumber>)|(filter <String>)]
|
||||
<CrOSTelemetryFieldName>* [fields <CrOSTelemetryFieldNameList>]
|
||||
[start <Date>] [end <Date>] [listlimit <Number>]
|
||||
[reverselists <CrOSTelemetryListFieldNameList>]
|
||||
[formatjson]
|
||||
gam print crostelemetry [todrive <ToDriveAttribute>*]
|
||||
[(ou|org|orgunit <OrgUnitItem>)|(cros_sn <SerialNumber>)|(filter <String>)]
|
||||
[(ou|org|orgunit|ou_and_children <OrgUnitItem>)|(cros_sn <SerialNumber>)|(filter <String>)]
|
||||
<CrOSTelemetryFieldName>* [fields <CrOSTelemetryFieldNameList>]
|
||||
[reverselists <CrOSTelemetryListFieldNameList>]
|
||||
[start <Date>] [end <Date>] [listlimit <Number>]
|
||||
|
||||
@@ -2,6 +2,11 @@
|
||||
|
||||
Merged GAM-Team version
|
||||
|
||||
6.63.11
|
||||
|
||||
Added option `ou_and_children <OrgUnitItem>` to `gam print|show crostelemetry` to simplify getting
|
||||
telemetry data for all ChromeOS devices in an OU and its children.
|
||||
|
||||
6.63.10
|
||||
|
||||
Added option `addcsvdata <FieldName> <String>` to these commands. This adds additional columns of data to the CSV file output
|
||||
|
||||
@@ -23704,13 +23704,13 @@ CROS_TELEMETRY_TIME_OBJECTS = {'reportTime', 'lastUpdateTime', 'lastUpdateCheckT
|
||||
# [reverselists <CrOSTelemetryListFieldNameList>]
|
||||
# [formatjson [quotechar <Character>]]
|
||||
# gam show crostelemetry
|
||||
# [(ou|org|orgunit <OrgUnitItem>)|(cros_sn <SerialNumber>)|(filter <String>)]
|
||||
# [(ou|org|orgunit|ou_and_children <OrgUnitItem>)|(cros_sn <SerialNumber>)|(filter <String>)]
|
||||
# <CrOSTelemetryFieldName>* [fields <CrOSTelemetryFieldNameList>]
|
||||
# [start <Date>] [end <Date>] [listlimit <Number>]
|
||||
# [reverselists <CrOSTelemetryListFieldNameList>]
|
||||
# [formatjson [quotechar <Character>]]
|
||||
# gam print crostelemetry [todrive <ToDriveAttribute>*]
|
||||
# [(ou|org|orgunit <OrgUnitItem>)|(cros_sn <SerialNumber>)|(filter <String>)]
|
||||
# [(ou|org|orgunit|ou_and_children <OrgUnitItem>)|(cros_sn <SerialNumber>)|(filter <String>)]
|
||||
# <CrOSTelemetryFieldName>* [fields <CrOSTelemetryFieldNameList>]
|
||||
# [reverselists <CrOSTelemetryListFieldNameList>]
|
||||
# [start <Date>] [end <Date>] [listlimit <Number>]
|
||||
@@ -23778,10 +23778,11 @@ def doInfoPrintShowCrOSTelemetry():
|
||||
reverseLists = []
|
||||
action = Act.Get()
|
||||
if action == Act.INFO:
|
||||
pfilter = f'serialNumber={getString(Cmd.OB_SERIAL_NUMBER)}'
|
||||
sn = getString(Cmd.OB_SERIAL_NUMBER)
|
||||
pfilters = [(f'serialNumber={sn}', f'serialNumber={sn}')]
|
||||
Act.Set(Act.SHOW)
|
||||
else:
|
||||
pfilter = None
|
||||
pfilters = []
|
||||
csvPF = CSVPrintFile(['deviceId'], CROS_TELEMETRY_SCALAR_FIELDS, CROS_TELEMETRY_LIST_FIELDS) if Act.csvFormat() else None
|
||||
FJQC = FormatJSONQuoteChar(csvPF)
|
||||
diskPercentOnly = showOrgUnitPath = False
|
||||
@@ -23791,19 +23792,31 @@ def doInfoPrintShowCrOSTelemetry():
|
||||
myarg = getArgument()
|
||||
if csvPF and myarg == 'todrive':
|
||||
csvPF.GetTodriveParameters()
|
||||
elif myarg in ['ou', 'org', 'orgunit', 'limittoou', 'crossn', 'filter']:
|
||||
if pfilter:
|
||||
elif myarg in ['ou', 'org', 'orgunit', 'limittoou', 'ouandchildren', 'crossn', 'filter']:
|
||||
if pfilters:
|
||||
Cmd.Backup()
|
||||
usageErrorExit(Msg.ONLY_ONE_DEVICE_SELECTION_ALLOWED.format(pfilter))
|
||||
usageErrorExit(Msg.ONLY_ONE_DEVICE_SELECTION_ALLOWED.format(pfilters[0][1]))
|
||||
if myarg == 'crossn':
|
||||
pfilter = f'serialNumber={getString(Cmd.OB_SERIAL_NUMBER)}'
|
||||
sn = getString(Cmd.OB_SERIAL_NUMBER)
|
||||
pfilters = [(f'serialNumber={sn}', f'serialNumber={sn}')]
|
||||
elif myarg == 'filter':
|
||||
pfilter = getString(Cmd.OB_STRING)
|
||||
pf = getString(Cmd.OB_STRING)
|
||||
pfilters = [(pf, pf)]
|
||||
else:
|
||||
if cd is None:
|
||||
cd = buildGAPIObject(API.DIRECTORY)
|
||||
_, orgUnitId = getOrgUnitId(cd)
|
||||
pfilter = f'orgUnitId={orgUnitId[3:]}'
|
||||
orgUnitPath, orgUnitId = getOrgUnitId(cd)
|
||||
pfilters = [(f'orgUnitId={orgUnitId[3:]}', f'orgUnitPath={orgUnitPath}')]
|
||||
if myarg == 'ouandchildren':
|
||||
try:
|
||||
subous = callGAPI(cd.orgunits(), 'list',
|
||||
throwReasons=GAPI.ORGUNIT_GET_THROW_REASONS,
|
||||
customerId=GC.Values[GC.CUSTOMER_ID], orgUnitPath=orgUnitId,
|
||||
type='all', fields='organizationUnits(orgUnitPath,orgUnitId)')
|
||||
except (GAPI.invalidOrgunit, GAPI.orgunitNotFound, GAPI.backendError, GAPI.badRequest, GAPI.invalidCustomerId, GAPI.loginRequired):
|
||||
checkEntityDNEorAccessErrorExit(cd, Ent.ORGANIZATIONAL_UNIT, orgUnitId)
|
||||
return
|
||||
pfilters.extend([(f'orgUnitId={subou["orgUnitId"][3:]}', f'orgUnitPath={subou["orgUnitPath"]}') for subou in subous.get('organizationUnits', [])])
|
||||
elif myarg == 'listlimit':
|
||||
listLimit = getInteger()
|
||||
elif myarg in CROS_START_ARGUMENTS:
|
||||
@@ -23841,30 +23854,31 @@ def doInfoPrintShowCrOSTelemetry():
|
||||
readMask = ','.join(set(fieldsList))
|
||||
if csvPF and FJQC.formatJSON:
|
||||
csvPF.SetJSONTitles(['deviceId', 'JSON'])
|
||||
printGettingAllAccountEntities(Ent.CROS_DEVICE, pfilter)
|
||||
pageMessage = getPageMessage()
|
||||
try:
|
||||
devices = callGAPIpages(cm.customers().telemetry().devices(), 'list', 'devices',
|
||||
pageMessage=pageMessage,
|
||||
throwReasons=[GAPI.PERMISSION_DENIED, GAPI.INVALID_ARGUMENT, GAPI.INVALID_INPUT],
|
||||
parent=parent, filter=pfilter,
|
||||
readMask=readMask, pageSize=GC.Values[GC.DEVICE_MAX_RESULTS])
|
||||
except (GAPI.invalidArgument, GAPI.invalidInput) as e:
|
||||
message = str(e).replace('\n', ',')
|
||||
entityActionFailedWarning([Ent.CROS_DEVICE, None], message)
|
||||
return
|
||||
except GAPI.permissionDenied as e:
|
||||
accessErrorExitNonDirectory(API.CHROMEMANAGEMENT, str(e))
|
||||
if csvPF:
|
||||
for device in devices:
|
||||
_printDevice(device)
|
||||
else:
|
||||
jcount = len(devices)
|
||||
performActionNumItems(jcount, Ent.CROS_DEVICE)
|
||||
j = 0
|
||||
for device in devices:
|
||||
j += 1
|
||||
_showDevice(device, j, jcount)
|
||||
for pfilter in pfilters:
|
||||
printGettingAllAccountEntities(Ent.CROS_DEVICE, pfilter[1])
|
||||
pageMessage = getPageMessage()
|
||||
try:
|
||||
devices = callGAPIpages(cm.customers().telemetry().devices(), 'list', 'devices',
|
||||
pageMessage=pageMessage,
|
||||
throwReasons=[GAPI.PERMISSION_DENIED, GAPI.INVALID_ARGUMENT, GAPI.INVALID_INPUT],
|
||||
parent=parent, filter=pfilter[0],
|
||||
readMask=readMask, pageSize=GC.Values[GC.DEVICE_MAX_RESULTS])
|
||||
except (GAPI.invalidArgument, GAPI.invalidInput) as e:
|
||||
message = str(e).replace('\n', ',')
|
||||
entityActionFailedWarning([Ent.CROS_DEVICE, None], message)
|
||||
return
|
||||
except GAPI.permissionDenied as e:
|
||||
accessErrorExitNonDirectory(API.CHROMEMANAGEMENT, str(e))
|
||||
if csvPF:
|
||||
for device in devices:
|
||||
_printDevice(device)
|
||||
else:
|
||||
jcount = len(devices)
|
||||
performActionNumItems(jcount, Ent.CROS_DEVICE)
|
||||
j = 0
|
||||
for device in devices:
|
||||
j += 1
|
||||
_showDevice(device, j, jcount)
|
||||
if csvPF:
|
||||
csvPF.writeCSVfile('CrOS Devices Telemetry')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user