Retrieving the computer name automatically

Hi,

First time i’ve posted on here, so not sure if this may have been covered before.

I have RT set up in our school and I would like to be able to retrieve the name of the machine that a user is posting a request from and insert it into a custom field. This would have to be done automatically, as our users wouldn’t do it themselves.

Any ideas how I could do this?

Ideally, I’d also like to be able to turn this into a link, which I can click on to launch our VNC viewer and connect directly to their machine - but this is not as important as getting the name in the first place.

Any help would be much appreciated.

Cheers
Tony Ayre
Network Manager
Minehead Middle School

Tony,

If they are submitting the ticket through the web interface you may be able
to rely on the source IP of the connection, but there is no way to get the
computer name (that I am aware of).

-ToddOn Mon, Nov 10, 2008 at 8:19 AM, Tony A localzuk@gmail.com wrote:

Hi,

First time i’ve posted on here, so not sure if this may have been covered
before.

I have RT set up in our school and I would like to be able to retrieve the
name of the machine that a user is posting a request from and insert it into
a custom field. This would have to be done automatically, as our users
wouldn’t do it themselves.

Any ideas how I could do this?

Ideally, I’d also like to be able to turn this into a link, which I can
click on to launch our VNC viewer and connect directly to their machine -
but this is not as important as getting the name in the first place.

Any help would be much appreciated.

Cheers
Tony Ayre
Network Manager
Minehead Middle School


The rt-users Archives

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Would it be possible to use the source IP and/or the account
name to pull the machine name from AT?

KenOn Mon, Nov 10, 2008 at 08:56:13AM -0500, Todd Chapman wrote:

Tony,

If they are submitting the ticket through the web interface you may be able
to rely on the source IP of the connection, but there is no way to get the
computer name (that I am aware of).

-Todd

On Mon, Nov 10, 2008 at 8:19 AM, Tony A localzuk@gmail.com wrote:

Hi,

First time i’ve posted on here, so not sure if this may have been covered
before.

I have RT set up in our school and I would like to be able to retrieve the
name of the machine that a user is posting a request from and insert it into
a custom field. This would have to be done automatically, as our users
wouldn’t do it themselves.

Any ideas how I could do this?

Ideally, I’d also like to be able to turn this into a link, which I can
click on to launch our VNC viewer and connect directly to their machine -
but this is not as important as getting the name in the first place.

Any help would be much appreciated.

Cheers
Tony Ayre
Network Manager
Minehead Middle School


The rt-users Archives

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com


The rt-users Archives

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Hi Todd,

My thoughts were down the lines of using dns resolution based on the IP address. I can’t really rely on the IP address itself, as this may well have changed by the time I get round to dealing with it.

So ideally, it’d just be a case of retrieving the REMOTE_HOST variable, running dns resolution against it and using the result of that. But my perl/scrip/RT knowledge is not yet at that level.

Cheers
Tony---- On Mon, 10 Nov 2008 Todd Chapman todd@chaka.net wrote ----

Tony,

If they are submitting the ticket through the web interface you may be able to rely on the source IP of the connection, but there is no way to get the computer name (that I am aware of).

-Todd

On Mon, Nov 10, 2008 at 8:19 AM, Tony A localzuk@gmail.com wrote:
Hi,

First time i’ve posted on here, so not sure if this may have been covered before.

I have RT set up in our school and I would like to be able to retrieve the name of the machine that a user is posting a request from and insert it into a custom field. This would have to be done automatically, as our users wouldn’t do it themselves.

Any ideas how I could do this?

Ideally, I’d also like to be able to turn this into a link, which I can click on to launch our VNC viewer and connect directly to their machine - but this is not as important as getting the name in the first place.

Any help would be much appreciated.

Cheers
Tony Ayre
Network Manager
Minehead Middle School


The rt-users Archives

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Hello,–Am 10. November 2008 14:15:08 +0000 schrieb Tony A localzuk@gmail.com:

My thoughts were down the lines of using dns resolution based on the IP
address. I can’t really rely on the IP address itself, as this may well
have changed by the time I get round to dealing with it.

So ideally, it’d just be a case of retrieving the REMOTE_HOST variable,
running dns resolution against it and using the result of that. But my
perl/scrip/RT knowledge is not yet at that level.

I have coded such a solution on basis of my ExtractCustomFieldValues
extension (ECFV). The solution works with the WebInterface by adding the
value of REMOTE_HOST as an Email-Header. It works also with the
Email-Interface provided your receiving SMTP-Server writes such a header
like “SenderIP: xxx.xxx.xxx.xxx” into the Mail.

ECFV scans the mail for this header and adds two CustomFieldValues (Host-IP
and HostName, you can name it like you wish). The latter is revealed by
DNS-resolution. This worked well for years, but I did not test the patch
against the 3.8 line of RT.

I can provide the patch and the configuration line in the template for ECFV
later this day.

Regards,
Dirk.

Hello,

–Am 11. November 2008 08:45:59 +0100 schrieb Dirk Pape
pape-rt@inf.fu-berlin.de:

I can provide the patch and the configuration line in the template for
ECFV later this day.

ok. This is ot so much later :slight_smile:

The patch can be found at
http://page.mi.fu-berlin.de/pape/rt3/patches/rt/web_xremoteip.patch. It
ist for RT 3.6 und must probably be adapted for 3.8

It uses $Message->head->replace(‘X-REMOTE-IP’,$ENV{‘REMOTE_ADDR’});
to add the REMOTE_ADDR from the environment to a header X-REMOTE-IP. This
is - in our local case - the same header the SMTP-Server writes into each
email message it receives.

You can change X-REMOTE-IP to your own X-Header.

If you look at my latest ECFV at
http://page.mi.fu-berlin.de/pape/rt3/ExtractCustomFieldValues.tgz (there
is also a cpan version done by Kevin Falcone or Alex Vandiver
http://search.cpan.org/~alexmv/RT-Extension-ExtractCustomFieldValues-1.8/)
you find a line in the shipped template reading

scan the Header X-REMOTE-IP for an IP-Address and get the hostname out of

it
host|X-REMOTE-IP|\d+.\d+.\d+.\d+|use Socket; ($) =
gethostbyaddr(inet_aton($
),AF_INET); $_ = “$_ (remote-ip)”;

this resolves the hostname from the IP in the header into a (global) ticket
custom field “host”. You may just adopt it to use your own X-Header.

You can also read the IP into another customfield by adding to the template:

hostip|X-REMOTE-IP|\d+.\d+.\d+.\d+|

you may add |q to the end of each line, if you don’t like the transaction
to be logged in RT (I recommend this).

So you have the two lines

host|X-REMOTE-IP|\d+.\d+.\d+.\d+|use Socket; ($) =
gethostbyaddr(inet_aton($
),AF_INET); $_ = “$_ (remote-ip)”;|q

hostip|X-REMOTE-IP|\d+.\d+.\d+.\d+||q

If you don’t have ECFV already installed there is a README and some hints
in the wiki.

I hope this helps.

Regards,
Dirk.