@@ -31,6 +31,8 @@
lsb_release
uuidgen
virtwhat
+hostname
+ip
"
# mail alerts / debug messages
@@ -222,6 +224,47 @@
echo ${OSREL}
}
+# get hostname
+function get_system_hostname {
+ HN=`${HOSTNAME} -f`
+ debug "SYSTEM-HOSTNAME: ${HN}"
+ echo ${HN}
+}
+
+# get all system ipv4 addresses
+function get_system_ipv4 {
+ IPV4ADDR=`${IP} -4 addr show scope global | ${GREP} inet | ${AWK} '{print $2}' | ${AWK} -F/ '{print $1}' | ${SORT} -u`
+ debug "SYSTEM-IPV4-ADDRESSES: ${IPV4ADDR}"
+ echo ${IPV4ADDR}
+}
+
+# get all system ipv6 addresses
+function get_system_ipv6 {
+ IPV6ADDR=`${IP} -6 addr show scope global | ${GREP} inet | ${AWK} '{print $2}' | ${AWK} -F/ '{print $1}' | ${SORT} -u`
+ debug "SYSTEM-IPV6-ADDRESSES: ${IPV6ADDR}"
+ echo ${IPV6ADDR}
+}
+
+# get primary network interface from default route
+function get_system_default_interface {
+ INT=`${IP} -4 route show default | ${AWK} '{print $NF}'`
+ debug "SYSTEM-DEFAULT-IFACE: ${INT}"
+ echo ${INT}
+}
+
+# get primary ip from interface
+function get_system_default_interface_ip_from_int {
+ DEVICE=${1}
+ DEFAULTIP=`${IP} -4 addr show dev ${DEVICE} | ${GREP} inet | ${HEAD} -n1 | ${AWK} '{print $2}' | ${AWK} -F/ '{print $1}'`
+ debug "SYSTEM-DEFAULT-IP: ${DEFAULTIP}"
+ echo ${DEFAULTIP}
+}
+
+# get system default ip
+function get_system_default_ip {
+ get_system_default_interface_ip_from_int `get_system_default_interface`
+}
+
# encode url parameters
rawurlencode() {
local string="${1}"
@@ -261,6 +304,10 @@
get_system_productname \
get_system_biosversion \
get_system_net_info \
+ get_system_default_ip \
+ get_system_ipv4 \
+ get_system_ipv6 \
+ get_system_hostname \
get_system_type \
get_system_kernelversion \
get_system_arch \
|
@@ -1,5 +1,5 @@
<?php
-$config["isdf"]["postvars"] = array("get_system_uuid","get_system_serial","get_system_cpu","get_system_memory","get_system_manufacturer","get_system_productname","get_system_biosversion","get_system_net_info","get_system_type","get_system_kernelversion","get_system_arch","get_system_os");
+$config["isdf"]["postvars"] = array("get_system_uuid","get_system_serial","get_system_cpu","get_system_memory","get_system_manufacturer","get_system_productname","get_system_biosversion","get_system_net_info","get_system_default_ip","get_system_ipv4","get_system_ipv6","get_system_hostname","get_system_type","get_system_kernelversion","get_system_arch","get_system_os");
?>
|