Skip to content
This repository
Newer
Older
100755 791 lines (693 sloc) 22.46 kb
7c9bc74b »
2010-11-15 Add tool which outputs JSON output for a system which should help som…
1 #!/bin/bash
2 #
064590a5 »
2012-01-12 OS-855 Add zpool information to sysinfo
3 # Copyright (c) 2012 Joyent Inc., All rights reserved.
7c9bc74b »
2010-11-15 Add tool which outputs JSON output for a system which should help som…
4 #
52521b66 »
2011-01-20 [OS-144] update sysinfo to support new parsable option (-p) and be mu…
5 # Output some info representing the system. Default: JSON
7c9bc74b »
2010-11-15 Add tool which outputs JSON output for a system which should help som…
6 #
3401458a »
2011-03-26 Reapply+Fix "[HEAD-340] make sysinfo cache its output so we're not ga…
7 # IMPORTANT:
8 #
9 # - Don't use anything here that you don't include in the live image!
10 #
11 # - This data gets cached in /tmp/.sysinfo.* and *DOES NOT* automatically
12 # have the cache refreshed. If you change something where the change
13 # needs to be visible to sysinfo, make sure you run this with either
14 # the -f or -u flag after changing the system's state.
a734b68d »
2010-11-16 Modified to include network information and also work with tools on t…
15 #
16
3401458a »
2011-03-26 Reapply+Fix "[HEAD-340] make sysinfo cache its output so we're not ga…
17 #set -o xtrace
52521b66 »
2011-01-20 [OS-144] update sysinfo to support new parsable option (-p) and be mu…
18
e05c2ce9 »
2011-07-11 [HVM-476] merge hvm sysinfo changes.
19 PATH=/bin:/usr/bin:/sbin:/usr/sbin:/smartdc/bin:/opt/local/bin:/opt/local/sbin
20
c6599975 »
2011-03-28 [HEAD-340] make sysinfo cache filenames be variables.
21 CACHE_FILE_PARSABLE="/tmp/.sysinfo.parsable"
22 CACHE_FILE_JSON="/tmp/.sysinfo.json"
3401458a »
2011-03-26 Reapply+Fix "[HEAD-340] make sysinfo cache its output so we're not ga…
23 CACHE="true"
e05c2ce9 »
2011-07-11 [HVM-476] merge hvm sysinfo changes.
24 UNAME_S=$(uname -s)
c0e65169 »
2011-10-04 OS-650 add support for minimal 'sysinfo' information when in a zone.
25 ZONENAME=$(zonename)
3401458a »
2011-03-26 Reapply+Fix "[HEAD-340] make sysinfo cache its output so we're not ga…
26 FORCE=
27 PARSABLE=
28 UPDATE_ONLY=
74f2204d »
2011-10-04 OS-668 remove Linux specific bits from sysinfo and normalize formatting.
29
3401458a »
2011-03-26 Reapply+Fix "[HEAD-340] make sysinfo cache its output so we're not ga…
30 while getopts fnpu? name
31 do
32 case $name in
33 f)
34 # Force re-running commands (don't read the cached values)
35 FORCE="true"
36 ;;
37 p)
38 # Output key=value format, not json
39 PARSABLE="true"
40 ;;
41 u)
42 # Update cache *only*, do not output.
43 FORCE="true"
44 UPDATE_ONLY="true"
45 ;;
46 ?)
75ae5195 »
2012-05-29 OS-1236 fix sysinfo to not try to use polo which is gone.
47 printf "Usage: %s: [-f] [-p] [-u]\n" $0
3401458a »
2011-03-26 Reapply+Fix "[HEAD-340] make sysinfo cache its output so we're not ga…
48 exit 2
49 ;;
50 esac
51 done
30c4d9e5 »
2011-03-24 HEAD-140: create system for NICs to receive beacon info (sysinfo update)
52
c0e65169 »
2011-10-04 OS-650 add support for minimal 'sysinfo' information when in a zone.
53 if [[ ${UNAME_S} != "SunOS" ]]; then
54 echo "This program is for use in SmartOS only."
52521b66 »
2011-01-20 [OS-144] update sysinfo to support new parsable option (-p) and be mu…
55 exit 1
56 fi
57
3401458a »
2011-03-26 Reapply+Fix "[HEAD-340] make sysinfo cache its output so we're not ga…
58 if [[ ${EUID} != 0 ]]; then
59 echo "This program can only be run as root."
60 exit 1
61 fi
62
63 # If we're not forcing update and we have a cached version, use that!
64 if [[ -z ${FORCE} ]]; then
c6599975 »
2011-03-28 [HEAD-340] make sysinfo cache filenames be variables.
65 if [[ -z ${PARSABLE} && -s ${CACHE_FILE_JSON} ]]; then
66 exec cat ${CACHE_FILE_JSON}
3401458a »
2011-03-26 Reapply+Fix "[HEAD-340] make sysinfo cache its output so we're not ga…
67 exit 3
c6599975 »
2011-03-28 [HEAD-340] make sysinfo cache filenames be variables.
68 elif [[ -s ${CACHE_FILE_PARSABLE} ]]; then
69 exec cat ${CACHE_FILE_PARSABLE}
3401458a »
2011-03-26 Reapply+Fix "[HEAD-340] make sysinfo cache its output so we're not ga…
70 exit 3
71 fi
72 fi
73
74f2204d »
2011-10-04 OS-668 remove Linux specific bits from sysinfo and normalize formatting.
74 # configfile here is only used on headnode
75 configfile="$(svcprop -p 'joyentfs/usb_copy_path' svc:/system/filesystem/smartdc:default 2>/dev/null)/config"
76 if [[ ! -f ${configfile} ]]; then
77 configfile="/mnt/$(svcprop -p 'joyentfs/usb_mountpoint' svc:/system/filesystem/smartdc:default 2>/dev/null)/config"
46d42d27 »
2011-01-21 [OS-154] make sysinfo read from correct config file.
78 fi
79
a734b68d »
2010-11-16 Modified to include network information and also work with tools on t…
80 # helper to set global "normalized" to the expanded version of MAC ($1)
81 function normalize_mac()
82 {
b5375e0b »
2011-03-14 NET-16: Name a NIC on a Compute Node
83 local mac=$1
a734b68d »
2010-11-16 Modified to include network information and also work with tools on t…
84 if [ -z "${mac}" ]; then
52521b66 »
2011-01-20 [OS-144] update sysinfo to support new parsable option (-p) and be mu…
85 echo "FATAL: unable to normalize empty mac!"
86 exit 1
a734b68d »
2010-11-16 Modified to include network information and also work with tools on t…
87 fi
88
89 normalized=`echo ${mac} | awk -F':' '{ print $1, $2, $3, $4, $5, $6 }' | { read o1 o2 o3 o4 o5 o6 junk
90 printf "%02x:%02x:%02x:%02x:%02x:%02x" 0x${o1} 0x${o2} 0x${o3} 0x${o4} 0x${o5} 0x${o6}
91 }`
92
93 # ensure results are 'normal'
94 echo "${normalized}" | grep "[a-fA-F0-9]\{2\}\:[a-fA-F0-9]\{2\}\:[a-fA-F0-9]\{2\}\:[a-fA-F0-9]\{2\}\:[a-fA-F0-9]\{2\}\:[a-fA-F0-9]\{2\}" >/dev/null 2>&1
95 if [ "$?" != "0" ]; then
52521b66 »
2011-01-20 [OS-144] update sysinfo to support new parsable option (-p) and be mu…
96 echo "FATAL: failed to normalize MAC '${mac}'"
97 exit 1
a734b68d »
2010-11-16 Modified to include network information and also work with tools on t…
98 fi
99 }
7c9bc74b »
2010-11-15 Add tool which outputs JSON output for a system which should help som…
100
52521b66 »
2011-01-20 [OS-144] update sysinfo to support new parsable option (-p) and be mu…
101 function get_smbios_system_info()
102 {
103 # This puts the variables we're pulling out into the local environment
186127f8 »
2012-08-06 OS-1448 sysinfo chokes if the bios has crazy characters in some field…
104 eval $(smbios -t SMB_TYPE_SYSTEM | tr -d "\"" \
52521b66 »
2011-01-20 [OS-144] update sysinfo to support new parsable option (-p) and be mu…
105 | egrep "Manufacturer: |Product: |Serial Number: |UUID: " \
106 | sed -e 's/^ *//' \
107 | sed -e 's/: /="/' \
108 | sed -e 's/ *$/"/' \
109 | sed -e 's/Serial Number/Serial_Number/')
c9746479 »
2010-12-10 OS-41 add buildstamp to sysinfo output.
110
dddb4cbd »
2011-05-03 [HEAD-401] first compute node "steals" the uuid of the headnode, resu…
111 # overwrite UUID if config dictates otherwise
36d759bc »
2011-05-04 [HEAD-407] UUID override should come from GRUB via MAPI rather than t…
112 tmp_uuid=$(/usr/bin/bootparams | grep "^override_uuid=" | cut -f2 -d'=')
dddb4cbd »
2011-05-03 [HEAD-401] first compute node "steals" the uuid of the headnode, resu…
113 if [[ -n $tmp_uuid ]]; then
114 UUID=$tmp_uuid
115 fi
e05c2ce9 »
2011-07-11 [HVM-476] merge hvm sysinfo changes.
116
117 #echo "${UUID}"
118 #echo "${Product}"
119 #echo "${Serial_Number}"
120 #echo "${Manufacturer}"
121 }
122
c0e65169 »
2011-10-04 OS-650 add support for minimal 'sysinfo' information when in a zone.
123 function get_nonglobal_info()
124 {
33343e06 »
2012-06-08 OS-1264 add support for boot time in sysinfo for both GZ and NGZ.
125 UUID=$(/usr/sbin/mdata-get sdc:uuid)
c0e65169 »
2011-10-04 OS-650 add support for minimal 'sysinfo' information when in a zone.
126 QUOTA=$(/usr/sbin/zfs get -Ho value quota /)
127 }
128
52521b66 »
2011-01-20 [OS-144] update sysinfo to support new parsable option (-p) and be mu…
129 function get_memory_mib()
130 {
74f2204d »
2011-10-04 OS-668 remove Linux specific bits from sysinfo and normalize formatting.
131 # Get (misnamed in prtconf) memory size in Mebibytes
c0e65169 »
2011-10-04 OS-650 add support for minimal 'sysinfo' information when in a zone.
132 Memory_in_MiB=`prtconf 2>/dev/null \
e05c2ce9 »
2011-07-11 [HVM-476] merge hvm sysinfo changes.
133 | grep "Memory size: [0-9]* Megabytes" \
134 | cut -d' ' -f3`
52521b66 »
2011-01-20 [OS-144] update sysinfo to support new parsable option (-p) and be mu…
135
136 #echo "${Memory_in_MiB}"
137 }
138
e05c2ce9 »
2011-07-11 [HVM-476] merge hvm sysinfo changes.
139 function get_smartos_cpu_info()
52521b66 »
2011-01-20 [OS-144] update sysinfo to support new parsable option (-p) and be mu…
140 {
c0e65169 »
2011-10-04 OS-650 add support for minimal 'sysinfo' information when in a zone.
141 if [[ ${ZONENAME} == "global" ]]; then
142 CPU_Version=`smbios -t SMB_TYPE_PROCESSOR | grep -v "Version: 0000000000" \
143 | grep "Version: " \
144 | head -n1 \
145 | tr -s ' ' \
146 | sed -e 's/^ *Version: //' \
147 | sed -e 's/ *$//'`
148
149 CPU_Count=`smbios -t SMB_TYPE_PROCESSOR | grep -v "Version: 0000000000" \
150 | grep "Version: " \
151 | wc -l \
152 | tr -d ' '`
153
c34487db »
2012-05-03 OS-1147 remove has_hvx.c and replace with isainfo
154 isainfo=$(isainfo -x)
155 if [[ -n $(echo " ${isainfo} " | /usr/bin/grep " vmx ") ]]; then
156 CPU_Virtualization="vmx"
f969bd94 »
2012-05-03 OS-1147 remove has_hvx.c and replace with isainfo
157 elif [[ -n $(echo " ${isainfo} " | /usr/bin/grep " amd_svm ") ]]; then
c34487db »
2012-05-03 OS-1147 remove has_hvx.c and replace with isainfo
158 CPU_Virtualization="svm"
c0e65169 »
2011-10-04 OS-650 add support for minimal 'sysinfo' information when in a zone.
159 else
c34487db »
2012-05-03 OS-1147 remove has_hvx.c and replace with isainfo
160 CPU_Virtualization="none"
c0e65169 »
2011-10-04 OS-650 add support for minimal 'sysinfo' information when in a zone.
161 fi
162 fi
52521b66 »
2011-01-20 [OS-144] update sysinfo to support new parsable option (-p) and be mu…
163
164 CPU_Cores=`psrinfo \
165 | grep "^[0-9]" \
166 | wc -l \
167 | tr -d ' '`
168
169 #echo "${CPU_Version}"
170 #echo "${CPU_Count}"
171 #echo "${CPU_Cores}"
172 }
173
174 function get_live_image_buildstamp()
175 {
6ce82f9b »
2011-03-09 [HEAD-154] remove support for joyent_buildstamp (data is available th…
176 # Add joyent buildstamp to SYSTEM_INFO
74f2204d »
2011-10-04 OS-668 remove Linux specific bits from sysinfo and normalize formatting.
177 Live_Image=$(uname -v | sed -e "s/.*_//")
178
52521b66 »
2011-01-20 [OS-144] update sysinfo to support new parsable option (-p) and be mu…
179 #echo "${Live_Image}"
180 }
181
e05c2ce9 »
2011-07-11 [HVM-476] merge hvm sysinfo changes.
182 function get_system_type()
183 {
184 Uname_System=${UNAME_S}
185 }
186
153f39ed »
2011-07-24 [HVM-508] add 'VM Capable' flag to sysinfo.
187 function get_vm_capable()
188 {
189 # XXX all compute nodes should now support VMs
190 VM_Capable="true"
191 }
192
135023f5 »
2011-01-26 [HEAD-131] add hostname to sysinfo output.
193 function get_hostname()
194 {
195 Hostname=$(hostname)
196 }
197
064590a5 »
2012-01-12 OS-855 Add zpool information to sysinfo
198 function get_zpool_disks()
199 {
200 local zpool=$1
201 Zpool_disks=
202
203 for disk in $(/usr/bin/disklist -n); do
204 local disk_in_pool=$(/usr/sbin/zpool status ${zpool} | grep ${disk})
205 if [[ -n ${disk_in_pool} ]]; then
206 Zpool_disks="${Zpool_disks},${disk}"
207 fi
208 done
209
210 Zpool_disks=${Zpool_disks/#,/}
211 }
212
213 function get_zpool_profile()
214 {
215 local zpool=$1
216 local profiles=( mirror raidz3 raidz2 raidz )
217 Zpool_profile="striped"
218
219 for profile in ${profiles[*]}; do
220 if [[ -n $(/usr/sbin/zpool status ${zpool} | grep ${profile}) ]]; then
221 Zpool_profile=${profile}
222 break
223 fi
224 done
225 }
226
227 function get_zpool()
228 {
229 if [[ $(zpool list) != "no pools available" ]]; then
70a6ae80 »
2012-04-25 OS-1125 fix detection of zpool.
230 Zpool=$(svcprop -p "config/zpool" svc:/system/smartdc/init);
064590a5 »
2012-01-12 OS-855 Add zpool information to sysinfo
231
232 local used=$(zfs get -Hp -o value used ${Zpool})
233 local available=$(zfs get -Hp -o value available ${Zpool})
234 local size=$(( $used + $available ))
235 Zpool_size=$(($size / 1024 / 1024 / 1024))
236
237 get_zpool_disks ${Zpool}
238 get_zpool_profile ${Zpool}
239 fi
240 }
241
52521b66 »
2011-01-20 [OS-144] update sysinfo to support new parsable option (-p) and be mu…
242 function get_disks()
243 {
74f2204d »
2011-10-04 OS-668 remove Linux specific bits from sysinfo and normalize formatting.
244 ORIGIFS=$IFS
52521b66 »
2011-01-20 [OS-144] update sysinfo to support new parsable option (-p) and be mu…
245
74f2204d »
2011-10-04 OS-668 remove Linux specific bits from sysinfo and normalize formatting.
246 # set $IFS to end-of-line
247 IFS=`echo -en "\n\b"`
52521b66 »
2011-01-20 [OS-144] update sysinfo to support new parsable option (-p) and be mu…
248
74f2204d »
2011-10-04 OS-668 remove Linux specific bits from sysinfo and normalize formatting.
249 count=1
250 for line in $(/usr/bin/disklist -s 2>/dev/null); do
251 Disks[${count}]=${line}
252 ((count++))
253 done
52521b66 »
2011-01-20 [OS-144] update sysinfo to support new parsable option (-p) and be mu…
254
74f2204d »
2011-10-04 OS-668 remove Linux specific bits from sysinfo and normalize formatting.
255 # set $IFS back
256 IFS=$ORIGIFS
52521b66 »
2011-01-20 [OS-144] update sysinfo to support new parsable option (-p) and be mu…
257 }
258
259 function get_nic_mappings()
260 {
c217975f »
2011-12-17 bootparams: make sure we're reading what we think we do.
261 admin_nic=`/usr/bin/bootparams 2>/dev/null | grep "^admin_nic=" | cut -d '=' -f2-`
46d42d27 »
2011-01-21 [OS-154] make sysinfo read from correct config file.
262 if [[ -z ${admin_nic} ]] && [[ -f ${configfile} ]]; then
e05c2ce9 »
2011-07-11 [HVM-476] merge hvm sysinfo changes.
263 admin_nic=`grep "^admin_nic=" ${configfile} | cut -f2- -d'='`
52521b66 »
2011-01-20 [OS-144] update sysinfo to support new parsable option (-p) and be mu…
264 fi
265 if [[ -n ${admin_nic} ]]; then
266 normalize_mac ${admin_nic}
267 ADMIN_NIC=${normalized}
268 fi
c217975f »
2011-12-17 bootparams: make sure we're reading what we think we do.
269 external_nic=`/usr/bin/bootparams 2>/dev/null | grep "^external_nic=" | cut -d '=' -f2-`
46d42d27 »
2011-01-21 [OS-154] make sysinfo read from correct config file.
270 if [[ -z ${external_nic} ]] && [[ -f ${configfile} ]]; then
e05c2ce9 »
2011-07-11 [HVM-476] merge hvm sysinfo changes.
271 external_nic=`grep "^external_nic=" ${configfile} | cut -f2- -d'='`
52521b66 »
2011-01-20 [OS-144] update sysinfo to support new parsable option (-p) and be mu…
272 fi
273 if [[ -n ${external_nic} ]]; then
274 normalize_mac ${external_nic}
275 EXTERNAL_NIC=${normalized}
a734b68d »
2010-11-16 Modified to include network information and also work with tools on t…
276 fi
c217975f »
2011-12-17 bootparams: make sure we're reading what we think we do.
277 internal_nic=`/usr/bin/bootparams 2>/dev/null | grep "^internal_nic=" | cut -d '=' -f2-`
46d42d27 »
2011-01-21 [OS-154] make sysinfo read from correct config file.
278 if [[ -z ${internal_nic} ]] && [[ -f ${configfile} ]]; then
e05c2ce9 »
2011-07-11 [HVM-476] merge hvm sysinfo changes.
279 internal_nic=`grep "^internal_nic=" ${configfile} | cut -f2- -d'='`
d6deb539 »
2010-11-29 Add IPv4 address to output for interfaces which have them.
280 fi
52521b66 »
2011-01-20 [OS-144] update sysinfo to support new parsable option (-p) and be mu…
281 if [[ -n ${internal_nic} ]]; then
282 normalize_mac ${internal_nic}
283 INTERNAL_NIC=${normalized}
284 fi
285
286 #echo "${ADMIN_NIC}"
287 #echo "${EXTERNAL_NIC}"
288 #echo "${INTERNAL_NIC}"
289 }
290
e05c2ce9 »
2011-07-11 [HVM-476] merge hvm sysinfo changes.
291 function get_smartos_network_interfaces()
52521b66 »
2011-01-20 [OS-144] update sysinfo to support new parsable option (-p) and be mu…
292 {
293 count=1
b5375e0b »
2011-03-14 NET-16: Name a NIC on a Compute Node
294 nic_tag_count=1
dd4083dd »
2011-03-24 HEAD-217: Add support to for network configuration as seen at Sprint
295 NicTagList="admin"
296 seen_nic_tag_admin="true"
297
52521b66 »
2011-01-20 [OS-144] update sysinfo to support new parsable option (-p) and be mu…
298 # ignore 'LINK SLOT ADDRESS INUSE CLIENT' line
3401458a »
2011-03-26 Reapply+Fix "[HEAD-340] make sysinfo cache its output so we're not ga…
299 for line in $(pfexec /sbin/dladm show-phys -m \
300 | grep -v "^LINK " | awk '{ print $1,$3 }' | tr ' ' '='); do
301
52521b66 »
2011-01-20 [OS-144] update sysinfo to support new parsable option (-p) and be mu…
302 nicnames=
303 fields=(${line//=/ })
304 iface=${fields[0]}
305 normalize_mac ${fields[1]}
306 mac=${normalized}
3401458a »
2011-03-26 Reapply+Fix "[HEAD-340] make sysinfo cache its output so we're not ga…
307 ip4addr=$(ifconfig ${iface} 2>/dev/null \
308 | grep "inet " | awk '{ print $2 }')
52521b66 »
2011-01-20 [OS-144] update sysinfo to support new parsable option (-p) and be mu…
309
310 if [[ -n "${ADMIN_NIC}" ]] && [[ "${ADMIN_NIC}" == "${mac}" ]]; then
311 nicnames="admin"
312 NIC_admin=${iface}
313 fi
314 if [[ -n "${EXTERNAL_NIC}" ]] && [[ "${EXTERNAL_NIC}" == "${mac}" ]]; then
315 [[ -n ${nicnames} ]] && nicnames="${nicnames},"
316 nicnames="${nicnames}external"
dd4083dd »
2011-03-24 HEAD-217: Add support to for network configuration as seen at Sprint
317 NicTagList="${NicTagList},external"
52521b66 »
2011-01-20 [OS-144] update sysinfo to support new parsable option (-p) and be mu…
318 NIC_external=${iface}
319 fi
320 if [[ -n "${INTERNAL_NIC}" ]] && [[ "${INTERNAL_NIC}" == "${mac}" ]]; then
321 [[ -n ${nicnames} ]] && nicnames="${nicnames},"
322 nicnames="${nicnames}internal"
dd4083dd »
2011-03-24 HEAD-217: Add support to for network configuration as seen at Sprint
323 NicTagList="${NicTagList},internal"
52521b66 »
2011-01-20 [OS-144] update sysinfo to support new parsable option (-p) and be mu…
324 NIC_internal=${iface}
325 fi
326
b5375e0b »
2011-03-14 NET-16: Name a NIC on a Compute Node
327 for tag in "${NicTagsMacs[@]}"; do
328 tag_fields=(${tag//=/ })
329 tag_name=${tag_fields[0]}
330 normalize_mac ${tag_fields[1]}
331 tag_mac=${normalized}
332 if [[ "${tag_mac}" == "${mac}" ]]; then
333 [[ -n ${nicnames} ]] && nicnames="${nicnames},"
334 nicnames="${nicnames}${tag_name}"
335 NicTags[${nic_tag_count}]="${tag_name}=${iface}"
336 ((nic_tag_count++))
337 fi
dd4083dd »
2011-03-24 HEAD-217: Add support to for network configuration as seen at Sprint
338
339 # Build up the list of tags
340 eval "seen_nic_tag=\${seen_nic_tag_${tag_name}}"
341 if [[ -z "${seen_nic_tag}" ]]; then
342 NicTagList="${NicTagList},${tag_name}"
343 eval "seen_nic_tag_${tag_name}=true"
344 fi
b5375e0b »
2011-03-14 NET-16: Name a NIC on a Compute Node
345 done
346
52521b66 »
2011-01-20 [OS-144] update sysinfo to support new parsable option (-p) and be mu…
347 NetworkInterfaces[${count}]=${iface}
348 eval "Network_Interface_${iface}_MAC_Address=${mac}"
349 eval "Network_Interface_${iface}_IPv4_Address=${ip4addr}"
350 if [[ -n ${nicnames} ]]; then
351 eval "Network_Interface_${iface}_NIC_Names=${nicnames}"
352 fi
353 ((count++))
354 done
355
8134b224 »
2011-03-22 NET-35: Add network link status to sysinfo
356 for line in $(dladm show-phys -p -olink,state); do
357 fields=(${line//:/ })
358 iface=${fields[0]}
359 link_status=${fields[1]}
360 eval "Network_Interface_${iface}_Link_Status=${link_status}"
361
362 done
363
52521b66 »
2011-01-20 [OS-144] update sysinfo to support new parsable option (-p) and be mu…
364 #echo "${NIC_admin}"
365 #echo "${NIC_external}"
366 #echo "${NIC_internal}"
367 #for iface in "${NetworkInterfaces[@]}"
368 #do
369 # eval "mac=\${Network_Interface_${iface}_MAC_Address}"
370 # eval "ipv4=\${Network_Interface_${iface}_IPv4_Address}"
371 # eval "nicnames=\${Network_Interface_${iface}_NIC_Names}"
372 # echo "mac: ${mac} ---- ${ipv4} ---- ${nicnames}"
373 #done
374 }
375
95849175 »
2011-08-28 [NET-121] Allow assigning IPs on LNs to compute nodes
376 function get_smartos_vnics()
377 {
378 count=1
379
380 # ignore 'LINK SLOT ADDRESS INUSE CLIENT' line
381 for line in $(pfexec /sbin/dladm show-vnic -z '' \
382 | grep -v "^LINK " | awk '{ print $1,$2,$4,$6 }' | tr ' ' '='); do
383 fields=(${line//=/ })
384 iface=${fields[0]}
385 over=${fields[1]}
386 normalize_mac ${fields[2]}
387 mac=${normalized}
388 vlan=${fields[3]}
389 link_status=$(pfexec /sbin/dladm show-link -p -o state ${iface})
390 ip4addr=$(ifconfig ${iface} 2>/dev/null \
391 | grep "inet " | awk '{ print $2 }')
392 VirtualNetworkInterfaces[${count}]=${iface}
393 eval "Virtual_Network_Interface_${iface}_MAC_Address=${mac}"
394 eval "Virtual_Network_Interface_${iface}_IPv4_Address=${ip4addr}"
395 eval "Virtual_Network_Interface_${iface}_Link_Status=${link_status}"
396 eval "Virtual_Network_Interface_${iface}_VLAN=${vlan}"
397 eval "Virtual_Network_Interface_${iface}_Host_Interface=${over}"
398 ((count++))
399 done
400 }
401
b5375e0b »
2011-03-14 NET-16: Name a NIC on a Compute Node
402 function get_nic_tags()
403 {
404 count=1
3401458a »
2011-03-26 Reapply+Fix "[HEAD-340] make sysinfo cache its output so we're not ga…
405 for line in $(/usr/bin/bootparams 2>/dev/null \
e828a4d3 »
2011-06-27 [NET-108] New NIC Tag Does Not Work
406 | grep "^[a-zA-Z0-9_]*_nic=" \
407 ; grep "^[a-zA-Z0-9_]*_nic=" ${configfile} 2>/dev/null); do
b5375e0b »
2011-03-14 NET-16: Name a NIC on a Compute Node
408 fields=(${line//=/ })
409 key=${fields[0]}
3401458a »
2011-03-26 Reapply+Fix "[HEAD-340] make sysinfo cache its output so we're not ga…
410 if [[ $key != "admin_nic" ]] \
411 && [[ $key != "external_nic" ]] \
412 && [[ $key != "internal_nic" ]]; then
413
b5375e0b »
2011-03-14 NET-16: Name a NIC on a Compute Node
414 NicTagsMacs[${count}]=$(echo ${line} | sed -e 's/_nic//')
415 ((count++))
416 fi
417 done
418 }
419
b32deffa »
2011-01-31 [OS-187] add bootparams to sysinfo.
420 function get_bootparams()
421 {
e05c2ce9 »
2011-07-11 [HVM-476] merge hvm sysinfo changes.
422 WHICH_GREP="/usr/xpg4/bin/grep"
423
b32deffa »
2011-01-31 [OS-187] add bootparams to sysinfo.
424 count=1
425 for line in $(/usr/bin/bootparams); do
426 fields=(${line//=/ })
427 key=$(echo ${fields[0]} | sed -e "s/\-/\_/g")
e05c2ce9 »
2011-07-11 [HVM-476] merge hvm sysinfo changes.
428 if ! (echo "${key}" | ${WHICH_GREP} \
b32deffa »
2011-01-31 [OS-187] add bootparams to sysinfo.
429 -e "^tty" \
430 -e "^atapi" \
431 -e "^ata_dma" \
432 -e "^keyboard_" \
433 -e "^bios_boot_device" \
434 -e "^lba_access_" \
435 -e "^boot_ncpus" \
436 -e "^boot_file" \
437 -e "^whoami" \
438 -e "^mfg_name" \
439 -e "^impl_arch_name" \
440 -e "_max_ncpus$" \
441 >/dev/null); then
442 Bootparams[${count}]=${line}
443 ((count++))
c0e65169 »
2011-10-04 OS-650 add support for minimal 'sysinfo' information when in a zone.
444 fi
b32deffa »
2011-01-31 [OS-187] add bootparams to sysinfo.
445 done
446 }
447
33343e06 »
2012-06-08 OS-1264 add support for boot time in sysinfo for both GZ and NGZ.
448 function get_boot_time()
449 {
450 # This is all there is to it.
451 Boot_Time=$(/usr/bin/kstat -p -m unix -n system_misc -s boot_time | cut -f2)
452 }
453
84314cd3 »
2012-06-11 OS-1275 add datacenter name and headnode id to sysinfo when available.
454 function get_dc_info()
455 {
456 if [[ -f /.dcinfo ]]; then
457 Datacenter_Name=$(source /.dcinfo; echo "${SDC_DATACENTER_NAME}")
458 # Headnode ID is only valid if it's an integer.
459 Headnode_ID=$(source /.dcinfo; echo "${SDC_DATACENTER_HEADNODE_ID}" \
460 | grep "^[0-9]*$")
461 fi
462 }
463
52521b66 »
2011-01-20 [OS-144] update sysinfo to support new parsable option (-p) and be mu…
464 function output_parsable()
465 {
466 cat <<END
99b4256e »
2011-02-03 [HEAD-111] we need single quotes since things like passwords will con…
467 Live_Image='${Live_Image}'
e05c2ce9 »
2011-07-11 [HVM-476] merge hvm sysinfo changes.
468 System_Type='${Uname_System}'
33343e06 »
2012-06-08 OS-1264 add support for boot time in sysinfo for both GZ and NGZ.
469 Boot_Time='${Boot_Time}'
c0e65169 »
2011-10-04 OS-650 add support for minimal 'sysinfo' information when in a zone.
470 END
471
84314cd3 »
2012-06-11 OS-1275 add datacenter name and headnode id to sysinfo when available.
472 if [[ -n ${Datacenter_Name} ]]; then
473 cat <<END
474 Datacenter_Name='${Datacenter_Name}'
475 END
476 fi
477
478 if [[ -n ${Headnode_ID} ]]; then
479 cat <<END
480 Headnode_ID=${Headnode_ID}
481 END
482 fi
483
c0e65169 »
2011-10-04 OS-650 add support for minimal 'sysinfo' information when in a zone.
484 if [[ ${ZONENAME} == "global" ]]; then
485 cat <<END
99b4256e »
2011-02-03 [HEAD-111] we need single quotes since things like passwords will con…
486 Manufacturer='${Manufacturer}'
487 Product='${Product}'
488 Serial_Number='${Serial_Number}'
153f39ed »
2011-07-24 [HVM-508] add 'VM Capable' flag to sysinfo.
489 VM_Capable='${VM_Capable}'
99b4256e »
2011-02-03 [HEAD-111] we need single quotes since things like passwords will con…
490 CPU_Type='${CPU_Version}'
b0e2e31a »
2011-04-08 [HVM-36] add CPU Virtualization to sysinfo output.
491 CPU_Virtualization='${CPU_Virtualization}'
52521b66 »
2011-01-20 [OS-144] update sysinfo to support new parsable option (-p) and be mu…
492 CPU_Physical_Cores=${CPU_Count}
c0e65169 »
2011-10-04 OS-650 add support for minimal 'sysinfo' information when in a zone.
493 Nic_Tags=${NicTagList}
494 END
495 else
496 echo "Zfs_Quota='${QUOTA}'"
497 fi
498
499 cat <<END
500 UUID='${UUID}'
501 Hostname='${Hostname}'
52521b66 »
2011-01-20 [OS-144] update sysinfo to support new parsable option (-p) and be mu…
502 CPU_Total_Cores=${CPU_Cores}
503 MiB_of_Memory=${Memory_in_MiB}
504 END
505
506 for entry in "${Disks[@]}"; do
507 fields=(${entry//=/ })
508 disk=${fields[0]}
509 size=${fields[1]}
510 gb_size=$((${size} / 1000000000))
511 echo "Disk_${disk}_size_in_GB=${gb_size}"
512 done
513
99b4256e »
2011-02-03 [HEAD-111] we need single quotes since things like passwords will con…
514 [[ -n ${NIC_admin} ]] && echo "NIC_admin='${NIC_admin}'"
515 [[ -n ${NIC_external} ]] && echo "NIC_external='${NIC_external}'"
516 [[ -n ${NIC_internal} ]] && echo "NIC_internal='${NIC_internal}'"
52521b66 »
2011-01-20 [OS-144] update sysinfo to support new parsable option (-p) and be mu…
517
b5375e0b »
2011-03-14 NET-16: Name a NIC on a Compute Node
518 for tag in "${NicTags[@]}"; do
519 tag_fields=(${tag//=/ })
520 tag_name=${tag_fields[0]}
521 int=${tag_fields[1]}
522 echo "NIC_${tag_name}='${int}'"
523 done
524
52521b66 »
2011-01-20 [OS-144] update sysinfo to support new parsable option (-p) and be mu…
525 for iface in "${NetworkInterfaces[@]}"; do
526 mac_var="Network_Interface_${iface}_MAC_Address"
527 ipv4_var="Network_Interface_${iface}_IPv4_Address"
528 nicnames_var="Network_Interface_${iface}_NIC_Names"
8134b224 »
2011-03-22 NET-35: Add network link status to sysinfo
529 link_status_var="Network_Interface_${iface}_Link_Status"
30c4d9e5 »
2011-03-24 HEAD-140: create system for NICs to receive beacon info (sysinfo update)
530 detected_tag_var="Network_Interface_${iface}_Detected_Nic_Tag"
52521b66 »
2011-01-20 [OS-144] update sysinfo to support new parsable option (-p) and be mu…
531
532 eval "mac=\${${mac_var}}"
533 eval "ipv4=\${${ipv4_var}}"
534 eval "nicnames=\${${nicnames_var}}"
8134b224 »
2011-03-22 NET-35: Add network link status to sysinfo
535 link_status="unknown"
536 eval "link_status=\${${link_status_var}}"
30c4d9e5 »
2011-03-24 HEAD-140: create system for NICs to receive beacon info (sysinfo update)
537 eval "detected_tag=\${${detected_tag_var}}"
52521b66 »
2011-01-20 [OS-144] update sysinfo to support new parsable option (-p) and be mu…
538
99b4256e »
2011-02-03 [HEAD-111] we need single quotes since things like passwords will con…
539 echo "${mac_var}='${mac}'"
540 echo "${ipv4_var}='${ipv4}'"
541 echo "${nicnames_var}='${nicnames}'"
8134b224 »
2011-03-22 NET-35: Add network link status to sysinfo
542 echo "${link_status_var}='${link_status}'"
30c4d9e5 »
2011-03-24 HEAD-140: create system for NICs to receive beacon info (sysinfo update)
543 if [[ -n "${detected_tag}" ]] ; then
544 echo "${detected_tag_var}='${detected_tag}'"
545 fi
52521b66 »
2011-01-20 [OS-144] update sysinfo to support new parsable option (-p) and be mu…
546 done
b32deffa »
2011-01-31 [OS-187] add bootparams to sysinfo.
547
95849175 »
2011-08-28 [NET-121] Allow assigning IPs on LNs to compute nodes
548 for iface in "${VirtualNetworkInterfaces[@]}"; do
549 mac_var="Virtual_Network_Interface_${iface}_MAC_Address"
550 ipv4_var="Virtual_Network_Interface_${iface}_IPv4_Address"
551 link_status_var="Virtual_Network_Interface_${iface}_Link_Status"
552 vlan_var="Virtual_Network_Interface_${iface}_VLAN"
553 host_var="Virtual_Network_Interface_${iface}_Host_Interface"
554
555 eval "mac=\${${mac_var}}"
556 eval "ipv4=\${${ipv4_var}}"
557 eval "link_status=\${${link_status_var}}"
558 eval "vlan=\${${vlan_var}}"
559 eval "host=\${${host_var}}"
560
561 echo "${mac_var}='${mac}'"
562 echo "${ipv4_var}='${ipv4}'"
563 echo "${link_status_var}='${link_status}'"
564 echo "${vlan_var}='${vlan}'"
c0e65169 »
2011-10-04 OS-650 add support for minimal 'sysinfo' information when in a zone.
565 if [[ ${ZONENAME} == "global" ]]; then
566 echo "${host_var}='${host}'"
567 fi
95849175 »
2011-08-28 [NET-121] Allow assigning IPs on LNs to compute nodes
568 done
569
b32deffa »
2011-01-31 [OS-187] add bootparams to sysinfo.
570 for entry in "${Bootparams[@]}"; do
571 fields=(${entry//=/ })
572 key=$(echo ${fields[0]} | sed -e "s/\-/\_/g")
573 val=${fields[1]}
99b4256e »
2011-02-03 [HEAD-111] we need single quotes since things like passwords will con…
574 echo "Bootparam_${key}='${val}'"
b32deffa »
2011-01-31 [OS-187] add bootparams to sysinfo.
575 done
52521b66 »
2011-01-20 [OS-144] update sysinfo to support new parsable option (-p) and be mu…
576 }
577
578 function output_json()
579 {
580 cat <<END
7c9bc74b »
2010-11-15 Add tool which outputs JSON output for a system which should help som…
581 {
52521b66 »
2011-01-20 [OS-144] update sysinfo to support new parsable option (-p) and be mu…
582 "Live Image": "${Live_Image}",
e05c2ce9 »
2011-07-11 [HVM-476] merge hvm sysinfo changes.
583 "System Type": "${Uname_System}",
33343e06 »
2012-06-08 OS-1264 add support for boot time in sysinfo for both GZ and NGZ.
584 "Boot Time": "${Boot_Time}",
c0e65169 »
2011-10-04 OS-650 add support for minimal 'sysinfo' information when in a zone.
585 END
586
84314cd3 »
2012-06-11 OS-1275 add datacenter name and headnode id to sysinfo when available.
587 if [[ -n ${Datacenter_Name} ]]; then
588 cat <<END
589 "Datacenter Name": "${Datacenter_Name}",
590 END
591 fi
592
593 if [[ -n ${Headnode_ID} ]]; then
594 cat <<END
595 "Headnode ID": ${Headnode_ID},
596 END
597 fi
598
c0e65169 »
2011-10-04 OS-650 add support for minimal 'sysinfo' information when in a zone.
599 if [[ ${ZONENAME} == "global" ]]; then
600 cat <<END
52521b66 »
2011-01-20 [OS-144] update sysinfo to support new parsable option (-p) and be mu…
601 "Manufacturer": "${Manufacturer}",
602 "Product": "${Product}",
603 "Serial Number": "${Serial_Number}",
388ab253 »
2011-07-26 [HVM-525] fixed sysinfo to make 'VM Capable' a boolean instead of str…
604 "VM Capable": ${VM_Capable},
52521b66 »
2011-01-20 [OS-144] update sysinfo to support new parsable option (-p) and be mu…
605 "CPU Type": "${CPU_Version}",
b0e2e31a »
2011-04-08 [HVM-36] add CPU Virtualization to sysinfo output.
606 "CPU Virtualization": "${CPU_Virtualization}",
52521b66 »
2011-01-20 [OS-144] update sysinfo to support new parsable option (-p) and be mu…
607 "CPU Physical Cores": ${CPU_Count},
c0e65169 »
2011-10-04 OS-650 add support for minimal 'sysinfo' information when in a zone.
608 END
609 else
610 echo " \"ZFS Quota\": \"${QUOTA}\","
611 fi
612
613 cat <<END
614 "UUID": "${UUID}",
615 "Hostname": "${Hostname}",
52521b66 »
2011-01-20 [OS-144] update sysinfo to support new parsable option (-p) and be mu…
616 "CPU Total Cores": ${CPU_Cores},
617 "MiB of Memory": "${Memory_in_MiB}",
618 END
619
c0e65169 »
2011-10-04 OS-650 add support for minimal 'sysinfo' information when in a zone.
620 if [[ ${ZONENAME} == "global" ]]; then
064590a5 »
2012-01-12 OS-855 Add zpool information to sysinfo
621 if [[ -n ${Zpool} ]]; then
622 echo ' "Zpool": "'${Zpool}'",'
623 echo ' "Zpool Disks": "'${Zpool_disks}'",'
624 echo ' "Zpool Profile": "'${Zpool_profile}'",'
625 echo ' "Zpool Size in GiB":' ${Zpool_size}','
626 fi
627
c0e65169 »
2011-10-04 OS-650 add support for minimal 'sysinfo' information when in a zone.
628 echo ' "Disks": {'
629
52521b66 »
2011-01-20 [OS-144] update sysinfo to support new parsable option (-p) and be mu…
630 printed=0
631 for entry in "${Disks[@]}"; do
632 fields=(${entry//=/ })
633 disk=${fields[0]}
634 size=${fields[1]}
635 gb_size=$((${size} / 1000000000))
636 ((printed++))
637 trailing_comma=","
638 [[ ${printed} -eq ${#Disks[*]} ]] && trailing_comma=''
639 echo " \"${disk}\": {\"Size in GB\": ${gb_size}}${trailing_comma}"
640 done
641
642 cat <<END
a734b68d »
2010-11-16 Modified to include network information and also work with tools on t…
643 },
b32deffa »
2011-01-31 [OS-187] add bootparams to sysinfo.
644 "Boot Parameters": {
645 END
646 printed=0
647 for entry in "${Bootparams[@]}"; do
648 fields=(${entry//=/ })
649 key=$(echo ${fields[0]} | sed -e "s/\-/\_/g")
650 val=${fields[1]}
651 ((printed++))
652 trailing_comma=","
653 [[ ${printed} -eq ${#Bootparams[*]} ]] && trailing_comma=''
654 echo " \"${key}\": \"$val\"${trailing_comma}"
655 done
656 cat <<END
657 },
a734b68d »
2010-11-16 Modified to include network information and also work with tools on t…
658 "Network Interfaces": {
52521b66 »
2011-01-20 [OS-144] update sysinfo to support new parsable option (-p) and be mu…
659 END
660
661 printed=0
662 for iface in "${NetworkInterfaces[@]}"; do
663 mac_var="Network_Interface_${iface}_MAC_Address"
664 ipv4_var="Network_Interface_${iface}_IPv4_Address"
665 nicnames_var="Network_Interface_${iface}_NIC_Names"
8134b224 »
2011-03-22 NET-35: Add network link status to sysinfo
666 link_status_var="Network_Interface_${iface}_Link_Status"
30c4d9e5 »
2011-03-24 HEAD-140: create system for NICs to receive beacon info (sysinfo update)
667 detected_tag_var="Network_Interface_${iface}_Detected_Nic_Tag"
978bf244 »
2011-01-26 [OS-166] fix JSON output from sysinfo for networks
668 nic_names_fmt=
30c4d9e5 »
2011-03-24 HEAD-140: create system for NICs to receive beacon info (sysinfo update)
669 detected_fmt=
52521b66 »
2011-01-20 [OS-144] update sysinfo to support new parsable option (-p) and be mu…
670
671 eval "mac=\${${mac_var}}"
672 eval "ipv4=\${${ipv4_var}}"
673 eval "nicnames=\${${nicnames_var}}"
8134b224 »
2011-03-22 NET-35: Add network link status to sysinfo
674 eval "link_status=\${${link_status_var}}"
30c4d9e5 »
2011-03-24 HEAD-140: create system for NICs to receive beacon info (sysinfo update)
675 eval "detected_tag=\${${detected_tag_var}}"
676
677 if [[ -n "${detected_tag}" ]] ; then
3401458a »
2011-03-26 Reapply+Fix "[HEAD-340] make sysinfo cache its output so we're not ga…
678 detected_fmt="\"Detected NIC Name\": \"${detected_tag}\", "
30c4d9e5 »
2011-03-24 HEAD-140: create system for NICs to receive beacon info (sysinfo update)
679 fi
52521b66 »
2011-01-20 [OS-144] update sysinfo to support new parsable option (-p) and be mu…
680
681 nic_names_array=$(echo "${nicnames}" | sed -e "s/,/\", \"/g")
682 if [[ -n ${nic_names_array} ]]; then
683 nic_names_fmt="\"${nic_names_array}\""
684 fi
685
686 ((printed++))
687 trailing_comma=","
688 [[ ${printed} -eq ${#NetworkInterfaces[*]} ]] && trailing_comma=''
3401458a »
2011-03-26 Reapply+Fix "[HEAD-340] make sysinfo cache its output so we're not ga…
689 echo -n " \"${iface}\": {"
690 echo -n "\"MAC Address\": \"${mac}\", "
691 echo -n "\"ip4addr\": \"${ipv4}\", "
692 echo -n "\"Link Status\": \"${link_status}\", "
693 echo -n "${detected_fmt}"
694 echo -n "\"NIC Names\": [${nic_names_fmt}]}"
695 echo "${trailing_comma}"
52521b66 »
2011-01-20 [OS-144] update sysinfo to support new parsable option (-p) and be mu…
696 done
697
c0e65169 »
2011-10-04 OS-650 add support for minimal 'sysinfo' information when in a zone.
698 echo " },"
699 fi
700
701 cat << END
95849175 »
2011-08-28 [NET-121] Allow assigning IPs on LNs to compute nodes
702 "Virtual Network Interfaces": {
703 END
704 printed=0
705 for iface in "${VirtualNetworkInterfaces[@]}"; do
706 mac_var="Virtual_Network_Interface_${iface}_MAC_Address"
707 ipv4_var="Virtual_Network_Interface_${iface}_IPv4_Address"
708 link_status_var="Virtual_Network_Interface_${iface}_Link_Status"
709 vlan_var="Virtual_Network_Interface_${iface}_VLAN"
710 parent_var="Virtual_Network_Interface_${iface}_Host_Interface"
711
712 eval "mac=\${${mac_var}}"
713 eval "ipv4=\${${ipv4_var}}"
714 eval "link_status=\${${link_status_var}}"
715 eval "vlan=\${${vlan_var}}"
716 eval "host=\${${host_var}}"
717
718 ((printed++))
719 trailing_comma=","
720 [[ ${printed} -eq ${#VirtualNetworkInterfaces[*]} ]] && trailing_comma=''
721 echo -n " \"${iface}\": {"
722 echo -n "\"MAC Address\": \"${mac}\", "
723 echo -n "\"ip4addr\": \"${ipv4}\", "
724 echo -n "\"Link Status\": \"${link_status}\", "
c0e65169 »
2011-10-04 OS-650 add support for minimal 'sysinfo' information when in a zone.
725 if [[ ${ZONENAME} == "global" ]]; then
726 echo -n "\"Host Interface\": \"${host}\", "
727 fi
728 echo -n "\"VLAN\": \"${vlan}\"}"
95849175 »
2011-08-28 [NET-121] Allow assigning IPs on LNs to compute nodes
729 echo "${trailing_comma}"
730 done
731
732 cat <<END
7c9bc74b »
2010-11-15 Add tool which outputs JSON output for a system which should help som…
733 }
734 }
52521b66 »
2011-01-20 [OS-144] update sysinfo to support new parsable option (-p) and be mu…
735 END
736 }
737
c0e65169 »
2011-10-04 OS-650 add support for minimal 'sysinfo' information when in a zone.
738 if [[ ${ZONENAME} == "global" ]]; then
739 get_smbios_system_info
740 get_vm_capable
064590a5 »
2012-01-12 OS-855 Add zpool information to sysinfo
741 get_zpool
c0e65169 »
2011-10-04 OS-650 add support for minimal 'sysinfo' information when in a zone.
742 get_disks
743 get_bootparams
744 else
745 get_nonglobal_info
746 fi
52521b66 »
2011-01-20 [OS-144] update sysinfo to support new parsable option (-p) and be mu…
747 get_memory_mib
74f2204d »
2011-10-04 OS-668 remove Linux specific bits from sysinfo and normalize formatting.
748 get_smartos_cpu_info
52521b66 »
2011-01-20 [OS-144] update sysinfo to support new parsable option (-p) and be mu…
749 get_live_image_buildstamp
e05c2ce9 »
2011-07-11 [HVM-476] merge hvm sysinfo changes.
750 get_system_type
135023f5 »
2011-01-26 [HEAD-131] add hostname to sysinfo output.
751 get_hostname
52521b66 »
2011-01-20 [OS-144] update sysinfo to support new parsable option (-p) and be mu…
752 get_nic_mappings
b5375e0b »
2011-03-14 NET-16: Name a NIC on a Compute Node
753 get_nic_tags
74f2204d »
2011-10-04 OS-668 remove Linux specific bits from sysinfo and normalize formatting.
754 get_smartos_network_interfaces
755 get_smartos_vnics
33343e06 »
2012-06-08 OS-1264 add support for boot time in sysinfo for both GZ and NGZ.
756 get_boot_time
84314cd3 »
2012-06-11 OS-1275 add datacenter name and headnode id to sysinfo when available.
757 get_dc_info
52521b66 »
2011-01-20 [OS-144] update sysinfo to support new parsable option (-p) and be mu…
758
3401458a »
2011-03-26 Reapply+Fix "[HEAD-340] make sysinfo cache its output so we're not ga…
759 # whenever we update the cache, update both
760 if [[ ${CACHE} == "true" ]]; then
e05c2ce9 »
2011-07-11 [HVM-476] merge hvm sysinfo changes.
761 output_parsable >> ${CACHE_FILE_PARSABLE}.new.$$ \
762 && chmod 600 ${CACHE_FILE_PARSABLE}.new.$$ \
763 && mv ${CACHE_FILE_PARSABLE}.new.$$ ${CACHE_FILE_PARSABLE}
764 output_json >> ${CACHE_FILE_JSON}.new.$$ \
765 && chmod 600 ${CACHE_FILE_JSON}.new.$$ \
766 && mv ${CACHE_FILE_JSON}.new.$$ ${CACHE_FILE_JSON}
3401458a »
2011-03-26 Reapply+Fix "[HEAD-340] make sysinfo cache its output so we're not ga…
767 fi
768
769 # if we also want output, give it now
770 if [[ -z ${UPDATE_ONLY} ]]; then
771 if [[ ${PARSABLE} == "true" ]]; then
772 if [[ -z ${CACHE} ]]; then
773 # We shouldn't read/write cache
774 output_parsable
775 else
c6599975 »
2011-03-28 [HEAD-340] make sysinfo cache filenames be variables.
776 cat ${CACHE_FILE_PARSABLE} \
3401458a »
2011-03-26 Reapply+Fix "[HEAD-340] make sysinfo cache its output so we're not ga…
777 || output_parsable
778 fi
779 else
780 if [[ -z ${CACHE} ]]; then
781 # We shouldn't read/write cache
782 output_json
783 else
c6599975 »
2011-03-28 [HEAD-340] make sysinfo cache filenames be variables.
784 cat ${CACHE_FILE_JSON} \
3401458a »
2011-03-26 Reapply+Fix "[HEAD-340] make sysinfo cache its output so we're not ga…
785 || output_json
786 fi
787 fi
52521b66 »
2011-01-20 [OS-144] update sysinfo to support new parsable option (-p) and be mu…
788 fi
789
790 exit 0
Something went wrong with that request. Please try again.