File tree Expand file tree Collapse file tree 3 files changed +42
-0
lines changed Expand file tree Collapse file tree 3 files changed +42
-0
lines changed Original file line number Diff line number Diff line change 69
69
* Support reporting of ESX virtualmachines ip and operating system. It requires
70
70
inventory_format schema v1.1.36 on server-side included in GLPI v10.0.17.
71
71
* Add --glpi-version option support to glpi-esx script
72
+ * Add guessed Total ESX memory size as memory component
72
73
73
74
toolbox:
74
75
* Fix task log reset for enabled tasks
Original file line number Diff line number Diff line change @@ -77,6 +77,16 @@ sub createInventory {
77
77
78
78
$inventory -> setHardware( $host -> getHardwareInfo() );
79
79
80
+ # Add a virtual memory component to report total memory size for system. This remains
81
+ # an extrapolated total size based on the reported available system memory size.
82
+ my $memory = $inventory -> getHardware(" MEMORY" );
83
+ if ($memory ) {
84
+ $inventory -> addEntry(
85
+ section => ' MEMORIES' ,
86
+ entry => _esxTotalMemory($memory ),
87
+ );
88
+ }
89
+
80
90
$inventory -> setOperatingSystem( $host -> getOperatingSystemInfo() );
81
91
82
92
foreach my $cpu ($host -> getCPUs()) {
@@ -126,6 +136,27 @@ sub createInventory {
126
136
127
137
}
128
138
139
+ # Return a total size memory component with capacity rounded to the upper multiple of
140
+ # 1GB if size is lower than 16GB, 4GB for greater size but lower than 100GB and 16GB
141
+ # for even larger values. With $size given in MB.
142
+ sub _esxTotalMemory {
143
+ my ($size ) = @_ ;
144
+
145
+ return unless $size && $size =~ / ^\d +$ / ;
146
+
147
+ my $base = $size < 16384 ? 1024 : $size >= 102400 ? 16384 : 4096;
148
+ my $capacity = (int (int ($size )/$base )+1) * $base ;
149
+
150
+ return {
151
+ CAPACITY => $capacity ,
152
+ CAPTION => " ESX Guessed Total Memory" ,
153
+ DESCRIPTION => " ESX Memory" ,
154
+ TYPE => " Total" ,
155
+ MANUFACTURER => " VMware" ,
156
+ NUMSLOTS => " 0" ,
157
+ };
158
+ }
159
+
129
160
sub getHostIds {
130
161
my ($self ) = @_ ;
131
162
Original file line number Diff line number Diff line change 278
278
"vmsystem" : " Physical" ,
279
279
"workgroup" : " teclib.local"
280
280
},
281
+ "memories" : [
282
+ {
283
+ "capacity" : 8192 ,
284
+ "caption" : " ESX Guessed Total Memory" ,
285
+ "type" : " Total" ,
286
+ "description" : " ESX Memory" ,
287
+ "manufacturer" : " VMware" ,
288
+ "numslots" : 0
289
+ }
290
+ ],
281
291
"networks" : [
282
292
{
283
293
"description" : " vmk0" ,
You can’t perform that action at this time.
0 commit comments