Module: check_mk
Branch: master
Commit: 15060ef6da96294cabff22e7bf94d2234355c122
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=15060ef6da9629…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Mar 7 12:39:21 2016 +0100
3265 FIX mk_inventory.solaris: fix problem on Solaris 10, do prtdiag and prtpicl only in
global zone
---
.werks/3265 | 10 ++++++++++
ChangeLog | 1 +
agents/plugins/mk_inventory.solaris | 36 ++++++++++++++++++++---------------
3 files changed, 32 insertions(+), 15 deletions(-)
diff --git a/.werks/3265 b/.werks/3265
new file mode 100644
index 0000000..91582d5
--- /dev/null
+++ b/.werks/3265
@@ -0,0 +1,10 @@
+Title: mk_inventory.solaris: fix problem on Solaris 10, do prtdiag and prtpicl only in
global zone
+Level: 1
+Component: inv
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.9i1
+Date: 1457350724
+
+
diff --git a/ChangeLog b/ChangeLog
index 3df0ae7..d9afd1b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -113,6 +113,7 @@
* 3192 snmp_extended_info: now inventorizes all physical components of devices which
support the ENTITY-MIB
* 3219 FIX: lnx_distro: Now detecting Oracle VM Server correctly
* 3229 FIX: lnx_distro: SLES based systems have now an OS name inventorized\
+ * 3265 FIX: mk_inventory.solaris: fix problem on Solaris 10, do prtdiag and prtpicl
only in global zone
1.2.8b1:
diff --git a/agents/plugins/mk_inventory.solaris b/agents/plugins/mk_inventory.solaris
index 5f461c5..1674674 100755
--- a/agents/plugins/mk_inventory.solaris
+++ b/agents/plugins/mk_inventory.solaris
@@ -28,7 +28,11 @@
INTERVAL=14400
FLAGFILE=$MK_VARDIR/mk_inventory.last.$REMOTE
-NOW=$(truss /usr/bin/date 2>&1 | grep ^time | awk -F"= " '{print
$2}')
+if [ `uname -r` = "5.10" ]; then
+ NOW=$(truss /usr/bin/date 2>&1 | grep ^time | awk -F"= " '{print
$2}')
+else
+ NOW=`date +%s`
+fi
UNTIL=$((NOW + INTERVAL + 600))
#check if flagfile exits
@@ -46,15 +50,23 @@ then
echo "<<<solaris_uname:sep(61):persist($UNTIL)>>>"
uname -X
- if type prtdiag > /dev/null; then
- echo "<<<solaris_prtdiag:sep(10):persist($UNTIL)>>>"
- if type sneep >/dev/null 2>&1; then
- SN=$(sneep -t serial)
- else
- SN=$(smbios -t SMB_TYPE_SYSTEM | grep 'Serial Number:' | awk
'{print substr($0, index($0,$3))}')
+ if zoneadm list | grep -q global
+ then
+ if type prtdiag > /dev/null; then
+ echo
"<<<solaris_prtdiag:sep(10):persist($UNTIL)>>>"
+ if type sneep >/dev/null 2>&1; then
+ SN=$(sneep -t serial)
+ else
+ SN=$(smbios -t SMB_TYPE_SYSTEM | grep 'Serial Number:' | awk
'{print substr($0, index($0,$3))}')
+ fi
+ echo "SerialNumber: $SN"
+ prtdiag -v
+ fi
+
+ if type prtpicl > /dev/null; then
+ echo "<<<solaris_prtpicl:persist($UNTIL)>>>"
+ prtpicl -v
fi
- echo "SerialNumber: $SN"
- prtdiag -v
fi
if type psrinfo > /dev/null; then
@@ -62,12 +74,6 @@ then
psrinfo -p -v
fi
- if type prtpicl > /dev/null; then
- echo "<<<solaris_prtpicl:persist($UNTIL)>>>"
- prtpicl -v
- fi
-
-
if type pkginfo >/dev/null ; then
echo "<<<solaris_pkginfo:sep(58):persist($UNTIL)>>>"
pkginfo -l