logo

NJP

Updating Discovery "Linux - Distribution" probe to account for Debian

Import · Aug 21, 2017 · article

To update the Discovery "Linux - Distribution" probe to account for Debian hosts, add the following to the probe's post processor script (addition highlighted in blue):

...

else if (lowercaseOutput.indexOf('centos') != -1) {

current.os = "Linux CentOS";

versionMatch = /release ([0-9\.]+)/.exec(lowercaseOutput);

}

else if (lowercaseOutput.indexOf('ubuntu') != -1) {

current.os = "Linux Ubuntu";

versionMatch = /version="([0-9\.]+)/.exec(lowercaseOutput);

}

else if (lowercaseOutput.indexOf('debian') != -1) {

current.os = "Linux Debian";

versionMatch = /debian \\m ([0-9\.\-]+)/.exec(lowercaseOutput);

}

else {

current.os = "GNU/Linux";

}

if(versionMatch && versionMatch[1])

current.os_version = versionMatch[1];

},

type: "ProbePostProcessor"

});

The corresponding probe parameter also required (Debian generally has a /etc/issue file instead of /etc/*release):

!/bin/sh

if [ -f /etc/*release ]; then

cat /etc/*release

else

cat /etc/issue

fi

View original source

https://www.servicenow.com/community/itom-articles/updating-discovery-quot-linux-distribution-quot-probe-to-account/ta-p/2319947