librenms/librenms-agent

HP-UX Support?

Opened this issue · 0 comments

elif [ "${OS}" = "HP-UX" ] ; then
  set -- `swlist -l bundle "HPUX*OE"`
  until [ $# -eq 0 ]; do
    case "$1" in (*HPUX*OE*)
      REV="$2"
      break;;
    esac
    shift
  done
  ARCH=`uname -m`
  OSSTR="${OS} ${REV}(${ARCH})"

Tested on a handful of my systems gives output like:

  • HP-UX B.11.31.1403(ia64)
  • HP-UX B.11.31.1209(ia64)
  • HP-UX B.11.11.0406(9000/785)

Also, FWIW:

  • the thing seems to be portable, you might swap bash for sh.
  • All supported (e.g. current) versions of AIX support 'oslevel -s' which will return the major/minor level (AIX 7.2), the technology / maintenance level (TL or ML for oldies) and the Service Pack and BUILDDATE (in YYWW double-digit year, double-digit week of year, format) AIX 7200-03-01-1920. I think anything since AIX 5.2 or 5.3 supports oslevel -s. Some people still have AIX 4.3.3 or older, but hell, those boxes are way out of support from IBM.
--- distro 2020-05-26 19:32:49.775568586 -0400
+++ distro      2020-05-26 19:34:51.321190894 -0400
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/usr/bin/env sh
 # Detects which OS and if it is Linux then it will detect which Linux Distribution.

 OS=`uname -s`
@@ -11,7 +11,19 @@
   OSSTR="${OS} ${REV}(${ARCH} `uname -v`)"

 elif [ "${OS}" = "AIX" ] ; then
-  OSSTR="${OS} `oslevel` (`oslevel -r`)"
+  OSSTR="${OS} `oslevel` (`oslevel -s`)"
+
+elif [ "${OS}" = "HP-UX" ] ; then
+  set -- `swlist -l bundle "HPUX*OE"`
+  until [ $# -eq 0 ]; do
+    case "$1" in (*HPUX*OE*)
+      REV="$2"
+      break;;
+    esac
+    shift
+  done
+  ARCH=`uname -m`
+  OSSTR="${OS} ${REV}(${ARCH})"

 elif [ "${OS}" = "Linux" ] ; then
   KERNEL=`uname -r`