Which portal server node am I running on?
It is often useful to be able to work out which server node of your SAP NetWeaver Portal cluster you are connected to. For example, if you have an SAP NetWeaver Portal with a SID of ABC, consisting of two dispatchers (central instance 12 and dialog instance 13) each with two server nodes, you could be connected to instance 12 server0 or instance 12 server1 or instance 13 server0 or instance server1. If you are having some problems, the support people in your organization will need to know which server node to start looking at. This blog will describe a code fragment that can be used in a portal component to present details of the current server node that you are connected to. The good news is that most of the values we need to display are available as System properties, and so can be accessed via: 
String SID = System.getProperty("SAPSYSTEMNAME").toString(); String num = System.getProperty("SAPSYSTEM").toString(); String dir = System.getProperty("user.dir").toString(); String sep = System.getProperty("file.separator").toString(); dir = dir.substring(1+dir.lastIndexOf(sep)); String me = System.getProperty("SAPMYNAME").toString(); me = me.substring(0,me.indexOf("_"));
We use the file.system property to work out if we are on a Windows or Unix type system, and then use that to skip to the last part of the user.dir property, whcih shows us if we are on server0, server1 etc… To get our node number is a bit more complicated, and requires we find a property created as part of the use of DSR (Distributed Statistics Records). The property name contains the node ID, so we get a list of all the properties and run through the list finding a name that matches that node name… Here’s the code… String node = ""; Enumeration props = System.getProperties().keys(); while (props.hasMoreElements()) { String thisProp = props.nextElement().toString(); if (thisProp.startsWith("dsr."+me+"_") && thisProp.endsWith(".buffersize")) node = thisProp.substring(5+thisProp.indexOf("_"+SID+"_"),thisProp.lastIndexOf("_")); }
Now we need to present the details – I’ll use some HTMLB structures, so remember to include an appropriate ServicesReference definition in portalapp.xml… IPageContext myContext; myContext = PageContextFactory.createPageContext(request, response); Form myForm = myContext.createFormDocument("Where am I running?"); Group mySID = new Group(); mySID.setTitle("SID: "+SID); mySID.setWidth("300"); Group host = new Group(); host.setTitle("Host: "+me); host.setWidth("300"); mySID.addComponent(host); Group myGroup = new Group(); host.addComponent(myGroup); myGroup.setWidth("350"); myGroup.setTitle("Instance number: "+num); myGroup.setDesign(GroupDesign.SAPCOLOR); myForm.addComponent(mySID); GridLayout gl = new GridLayout(); myGroup.addComponent(gl); int row = 1; InputField ifHere = new InputField("here"); ifHere.setString("You are here"); ifHere.setTooltip("standort"); ifHere.setEnabled(false); InputField ifServer = new InputField("server"); ifServer.setString(dir); ifServer.setEnabled(false); Label label = new Label("Server number"); ifServer.setLabel(label); gl.addComponent(row, 1, label); gl.addComponent(row, 2, ifServer); gl.addComponent(row, 3, ifHere); row++; InputField ifNode = new InputField("node"); ifNode.setString(node); ifNode.setEnabled(false); label = new Label("Node number"); ifNode.setLabel(label); gl.addComponent(row, 1, label); gl.addComponent(row, 2, ifNode); gl.addComponent(row, 3, ifHere); myContext.render();
When run, it should look similar to: 
It would be great if you could send me the corresponding PAR as it is a nice to have feature.
please send to yogiatsap@yahoo.com
rgds
How to Find Dispatcher and Server Nodes IDs for a Portal Cluster (EP 6.0)
Troubleshooting Portal Server Nodes using Firefox Browser
regards,
Piyush
Asking them to enter javascript commands and decrypt cookie details or navigate to administrator options isn't very friendly...
A simple iView under their portal role probably makes more sense.
you don't have to query system properties, there is also a portal service that you can ask for details like server name, node id, etc..
It's called IClusterInformation
regards, Karsten