Nginx: The case of the missing load balancers

by tekwurx

In a recent HDMaaS (Helix Discovery Migration as a Service) project, one area that stood out during the data analysis phase was a significant drop in discovered load balancers – specifically Nginx.

How are Nginx load balancers discovered?

The Nginx load balancer TPL pattern triggers on Software Instance of type “Nginx Webserver” or “Nginx plus Webserver”. On inspection, we saw that this was being created successfully on both versions of BMC Discovery, but the report showed that the load balancer instance was not being created:

Search SoftwareInstance where type = ‘Nginx Webserver’ show type, name, product_version, #RunningSoftware:HostedSoftware:Host:.name as ‘Host’, #NetworkDevice:NetworkService:NetworkService:LoadBalancerInstance.name as ‘Name’

The TPL pattern for the load balancer creation relies on the Nginx configuration file on the Nginx Webserver Software Instance. If it is not available, the TPL pattern has a hard stop. Running the following report shows that the configuration file was available:

Search SoftwareInstance where type = ‘Nginx Webserver’ show type, name, product_version, configuration_file,  #RunningSoftware:HostedSoftware:Host:.name as ‘Host’, #NetworkDevice:NetworkService:NetworkService:LoadBalancerInstance.name as ‘Name’

The TPL pattern extracts other “.conf” files from this configuration file and issues a discovery.runCommand to capture these. This must successfully be captured for the load balancer to be created.

The perpetrator of the crime

Opening the Discovery Access for the server on BMC Discovery on-prem, we see:

However, looking at the same server on BMC Helix Discovery, we see:

The difference between the instances is the single quotes around the command. This causes the *.conf to be interpreted as a literal filename rather than a wildcard – hence the failure. The offending TPL line is line 120:

This is intended to escape the path, but this may be more suitable to Windows environments and warrant being inside the “IF” statement for Windows.

Case Closed

The Unix command now runs without the single quotes and successfully collects the file. This has been achieved by creating an overriding pattern for the Nginx load balancer and moving the path_include statement into the Windows “IF” loop.

Top