Operating System - HP-UX
1821984 Members
3292 Online
109638 Solutions
New Discussion юеВ

hostname lookup by application

 
Ceesjan van Hattum
Esteemed Contributor

hostname lookup by application

Hi,
Maybe many times asked by others, but we
have an application which has to return
the hostname.
But in our MC-Serviceguard it will give
the hostname of the active node, instead of
returning the packagename.
We cannot modify the application and do not
want to give both nodes the same hostname.
Is there a way of fooling the application?

Regards,
Ceesjan
ps. I do not know what the application uses
internally 'hostname; uname...'.
7 REPLIES 7
Ralph Grothe
Honored Contributor

Re: hostname lookup by application

How is your application pulling the name?
By system call like uname(), gethostname(), gethostbyname() etc.?
Or is it parsing the output from an external command?
Madness, thy name is system administration
Ralph Grothe
Honored Contributor

Re: hostname lookup by application

Sorry, I overlooked your PS, where you give the answer.
Maybe, could you run a syscall tracer like tusc on the process to get more insight?
Madness, thy name is system administration
Steve Lewis
Honored Contributor

Re: hostname lookup by application

Consider how ServiceGuard works. Nodes in a cluster can run more than one package at once, therefore can pretend to be more than one host at once. The package name/IP becomes a kind of virtual server that can run on many nodes.
The packages are listed in cmviewcl. How you gain access to the package is often via the IP address that is given to the package, which sits in the hosts files and in DNS for the clients, so that the clients don't have to know which node the package is running on.
If you cannot modify the application and do not know how it works then there really isn't much you can do to the app.
Ensuring that your application works in a package and isn't locked to a hostname is a key feature of serviceguard and should be in everyone's test plan.
I have seen projects get stuck on this issue with respect to software licencing checks.


Stephen Doud
Honored Contributor

Re: hostname lookup by application

To my knowledge there is no way to fool the application without adverse consequences to other parts of the system.
For instance, changing the hostname to the package IP alias will break SG commands.

The section labeled "Designing Applications to Run on Multiple Systems" in the "Managing Serviceguard" manual describes the correct approach:

http://docs.hp.com/cgi-bin/fsearch/framedisplay?top=/hpux/onlinedocs/B3936-90079/B3936-90079_top.html&con=/hpux/onlinedocs/B3936-90079/00/00/68-con.html&toc=/hpux/onlinedocs/B3936-90079/00/00/68-toc.html&searchterms=bind&queryid=20041111-112425

-sd.
Brian Crabtree
Honored Contributor

Re: hostname lookup by application

Ceesjan,

Uhmm, I sorta hate to offer this as a suggestion, and you might break something doing it, but you could try creating some small scripts from 'hostname' and 'uname' and putting them in a directory at the start of your PATH variable that would just echo out the hostname you want. Sorta a bad hack, but might resolve the problem.

Otherwise, contacting your application vendor to see how to do it would be the next best thing.

Brian
Ceesjan van Hattum
Esteemed Contributor

Re: hostname lookup by application

Greetings to you all.
We've found a way to set a fixed
'ServerName' into the applicationconfig.
Setting this var on the packagename
was the only way to solve it.
We didn't see the clue on page 229 of
the our appl.manual in very small letters.

Anyway,
thanks to you all.
Regards,
Ceesjan
Ceesjan van Hattum
Esteemed Contributor

Re: hostname lookup by application

applicationconfig