Notifications

8 views

Description

Discovery's "Linux - Azure" probe doesn't work properly if the Linux VM is on a Static IP Address.

Below is the script that the probe uses to detect if the Linux is on Azure, however since the Linux server is using Static IP address, there is no such file as /var/lib/dhcp/dhclient.eth0.leases or /var/lib/dhclient/dhclient-eth0.leases.

#!/bin/sh 
# For more information please refer the following guide:
#http://blog.mszcool.com/index.php/2015/04/detecting-if-a-virtual-machine-runs-in-microsoft-azure-linux-windows-to-protect-your-software-when-distributed-via-the-azure-marketplace/

if `grep -q unknown-245 /var/lib/dhcp/dhclient.eth0.leases`; then
echo "true"
elif `grep -q unknown-245 /var/lib/dhclient/dhclient-eth0.leases`; then
echo "true"
else
curl –connect-timeout 1 `grep FullConfig /var/lib/waagent/GoalState.1.xml >/dev/null 2>&1 | perl -pe 's/<.?FullConfig>//g; s/\s//g'` >/dev/null 2>&1 && echo "true" || echo "false"
fi

Steps to Reproduce

  1. Run a Quick Discovery to an Azure Linux server which has a static IP

Workaround

This problem is currently under review. You can contact ServiceNow Technical Support or subscribe to this Known Error article by clicking the Subscribe button at the top right of this form to be notified when more information will become available..

  1. Navigate to Probes > Linux - Azure
  2. Filter for the is_azure.sh probe parameter.
  3. Replace the script with the following:
#!/bin/sh
# For more information please refer the following guide:
#http://blog.mszcool.com/index.php/2015/04/detecting-if-a-virtual-machine-runs-in-microsoft-azure-linux-windows-to-protect-your-software-when-distributed-via-the-azure-marketplace/

if [ -f /var/lib/dhcp/dhclient.eth0.leases ] && `grep -q unknown-245 /var/lib/dhcp/dhclient.eth0.leases`; then
echo "true"
elif [ -f /var/lib/dhclient/dhclient-eth0.leases ] && `grep -q unknown-245 /var/lib/dhclient/dhclient-eth0.leases`; then
echo "true"
elif [[ -n `waagent -version 2>/dev/null` ]]; then
echo "true"
else
if [ -f /var/lib/waagent/GoalState.1.xml ] && `grep FullConfig /var/lib/waagent/GoalState.1.xml`; then
curl –connect-timeout 1 `grep FullConfig /var/lib/waagent/GoalState.1.xml >/dev/null 2>&1 | perl -pe 's/<.?FullConfig>//g; s/\s//g'` >/dev/null 2>&1 && echo "true" || echo "false"
else
echo "false"
fi
fi

Related Problem: PRB1327557

Seen In

There is no data to report.

Intended Fix Version

New York

Safe Harbor Statement

This "Intended Fix Version" information is meant to outline ServiceNow's general product direction and should not be relied upon in making a purchasing decision. The information provided here is for information purposes only and may not be incorporated into any contract. It is not a commitment, promise, or legal obligation to deliver any material, code, or functionality. The development, release, and timing of any features or functionality described for our products remains at ServiceNow's sole discretion.

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2019-05-21 11:43:20
Published:2019-05-03