-
Notifications
You must be signed in to change notification settings - Fork 3
Getting timeouts in CB_Activity?
The script simply can't run through all devices before it crashes. It's simple, really. Every time you introduce a column, you also introduce another 32000 (or how many devices you have) cells of data.
Here's what I currently use to fill this CB_Activity-Link-GAM Sheets template. This time filtering only active devices, of any kind.
It will upload fresh data to the DevicesGAM sheet, and then in the AdjustData sheet I manipulate that data to look like I want, and then only include exactly the data I want in the Devices sheet, to minimise the amount of data the query needs to search. This extra step also makes this new GAM-feed sheet compatible with the old version of CB_LookUp.
time gam config csv_output_row_filter "'^status$:regex:active'" redirect csv - multiprocess todrive tdfileid FileIDOfTheCB_ActivityGAMSheet tdtitle "CB_Activity-Link-GAM" tdsheet DevicesGAM tdupdatesheet true redirect stdout ./logfile.log redirect stderr stdout print cros fields ou,serialNumber,lastSync,status,activeTimeRanges,recentusers listlimit 1
Then you just schedule that to run as often as you like. No script time limits and rarely any crashes.
I use this for other purposes. Of course I mean using GAMADV-XTD3. :-)
Here's how you can upload fresh device data into the same sheet again and again.
The gam command below will upload devices to the sheet called Devices, filter only those that are active and are tagged as Chromebox models.
gam config csv_output_row_filter "'^model$:regex:Chromebox','^status$:regex:active'" redirect csv - multiprocess todrive tdfileid FileIDOfTheCB_ActivitySheet tdtitle "CB_Activity" tdsheet Devices tdupdatesheet true print cros fields serialNumber,ou,lastSync,model,recentusers,status listlimit 1
Do note that the headers of the columns are different, and also in another order in my GAM example. You can adjust the order, but you can't decide the headers, as they are pulled straight from the API. You may have to adjust column references in CB_LookUp to match these new columns.
These are just my filters, no need to have them, but Deprovisioned devices, for example, aren't that relevant for CB_LookUp.
If you only want to skip deprovisioned devices you could instead use a drop filter only.
config csv_output_row_drop_filter "'^status$:regex:deprovisioned'"