Perspective - Scripting - Get Computer name and IP of client

8.1.7

Is ther a way to get the computer name and the IP address of the client

I think the host session prop is the closest thing you can get: Session Properties - Ignition User Manual 8.1 - Ignition Documentation

What I need is that tags available in Perspective

image

There are host and address session props, but it’s not a certainty that the host will have been resolved to a hostname or just be an IP address.

In 8.1.9 you'll be able to opt-in to a setting on the gateway that has the gateway do a reverse DNS lookup to attempt to verify the hostname based on the provided IP:

"When enabled, Ignition's web server will attempt to resolve the remote HTTP client's hostname by performing a reverse DNS lookup using the remote HTTP client's IP address where appropriate, which could have a performance impact for each request which attempts a hostname lookup. When disabled, Ignition's web server will not attempt to resolve hostnames and any queries for the remote HTTP client's hostname will result in their IP address instead."

Can you provide more information where i can find this option?
Because when I try to get my project or session information I came only across the hostname of the gateway or de ip adres of de router and not the ip adres or hostname of the pc I want to gather. This because they have multiple machines and the screen at Machine 1 may only see the downtimes at Machine 1 etc. but another role may see the downtimes of all machines. So i need to do something with the hostnames/ip adresses.

This got “bumped” to 8.1.10 because of the unexpected release of 8.1.9, but when it’s available it can be enabled in Gateway Web Interface > Config > Networking > Web Server.

Any idea when the stable version 8.1.10 will be released?

Estimate is the first half of September.

So does that mean that the client IP address will also be available for use by chance?

Keep in mind that this operation works on the IP address of the TCP (http) connection to the server from the Server’s perspective. Clients behind a NAT firewall will be seen as the firewall’s IP, and with the name of the firewall via reverse DNS.

Users familiar with Vision’s total access to the local computer will forever be disappointed at the lack of access via browsers.

2 Likes

I have checked the ‘Resolve Client Hostnames’ option but only the IP is still being displayed. Is there any other way I can call the hostname of the client? like using system.net.getHostName or should I be looking at session.props.host?

You must have the DNS infrastructure used by your gateway know the names for the IP addresses it sees. Clients themselves are not (cannot be) trusted.

In Perspective you can only reference session.props.address and session.props.host. Reverse DNS lookups to turn an IP into a hostname are entirely dependent on DNS being set up in your network environment as @pturmel mentioned.