Flow designer- how to calculate total disk space on a server?

Damhoej
Giga Guru

I am trying to figure out how I can create an action in flow designer that wil get me the total disk space on a server.

example:

The server has 3 disks that have different sizes (100, 200 and 300 Gb) that totales to 600 Gb.

I would like to sum these values when different servers have different number of disks?

When I get the total I can use this value further down my flow.

Any suggestions?

11 REPLIES 11

And if the number of disks varies, how do I get the actual number of disks in the script?

joshvanharn
Kilo Guru

Discovery will populate the Disk Space variable on the 'computer' device with the available space. IF that doesn't work for you, a script running a sum query across all related disks would do the trick:

 

var totalDisk = new GlideQuery('cmdb_ci_disk')

.where('computer', {computer sys id})

.sum('size')

.orElse(0);

I know Discovery will get the answer, however I am aiming at using the SCCM 2012V2 integration, and that gives the challenge.

also SCCM integration gies disk space in Mb, Gb and Tb so that can be messy 😉

Muralidharan BS
Mega Sage
Mega Sage

HI,

I dont think there is a need of scripted action for this, check the below it may help you. 

I am choosing a config item first using - Look up record, and sending the record to "disk" table to check the no of disk associated. 

then looping all the records found in the disk table to a for loop to update the description of main CI (I set up in the first step).

I used description field to update so used ParseInt and if it is someother field you can try without a parseint. 

 

find_real_file.png

 

find_real_file.png

 

The only disadvantage of this in Paris is, it updates the record 3 times as there are 3 disks, but as you are in Quebec you can use the flow variables to overcome that. 

It looks like a viable solution but how will it cope with different size reporting (MB, GB and TB)?
Or does it just get the raw bytes and then a transformation is needed afterwards?