Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » DSDP - Target Management » How to get remote process PID
How to get remote process PID [message #33192] Wed, 11 March 2009 18:55 Go to next message
Wendy Zheng is currently offline Wendy ZhengFriend
Messages: 20
Registered: July 2009
Junior Member
Hi,

Does RSE SDK provide API to query the remote process PID?
If I have IHost object, which API can I invoke to query all the processes
in IHost machine?

Thank you for sharing.

Regards,
Wendy
Re: How to get remote process PID [message #33265 is a reply to message #33192] Thu, 12 March 2009 14:33 Go to previous messageGo to next message
David McKnight is currently offline David McKnightFriend
Messages: 244
Registered: July 2009
Senior Member
Hi Wendy,

There is a process subsystem that can be used depending on the system type
of your host. Which system type are you using?

Once you have a connection that has a process subsystem, the following
IRemoteProcessSubSystem API is available:

/**
* Return a list of all processes on the remote system.
* This version is called directly by users.
* @param processNameFilter filter the results according to this object
* @param context A context object that will be associated with each returned
process
* @param monitor the progress monitor
* @return the list of all processes running on the host machine that
correspond to the filter,
* or null if there are none.
*/
public IRemoteProcess[] listAllProcesses(IHostProcessFilter
processNameFilter, IRemoteProcessContext context, IProgressMonitor monitor)
throws InterruptedException, SystemMessageException;

Dave


"Wendy Zheng" <wezheng@cisco.com> wrote in message
news:65a528e121c02ae41835b4db294cef21$1@www.eclipse.org...
> Hi,
>
> Does RSE SDK provide API to query the remote process PID? If I have IHost
> object, which API can I invoke to query all the processes
> in IHost machine?
> Thank you for sharing.
> Regards,
> Wendy
>
Re: How to get remote process PID [message #33442 is a reply to message #33265] Thu, 19 March 2009 23:05 Go to previous messageGo to next message
Wendy Zheng is currently offline Wendy ZhengFriend
Messages: 20
Registered: July 2009
Junior Member
Hi Dave,

Thank you for the suggestion. Yes, that is very convenient API to use.

Will you tell me how do I get IRemoteProcessSubSystem from IHost?

Currently we are busy with beta release, I use shell command
"ps -ef " to get all PIDs. But it is not idea solution.

Thank you.

Regards,
Wendy
Re: How to get remote process PID [message #33545 is a reply to message #33442] Fri, 20 March 2009 18:33 Go to previous messageGo to next message
David McKnight is currently offline David McKnightFriend
Messages: 244
Registered: July 2009
Senior Member
Hi Wendy,

Assuming that you have an IRemoteProcessSubSystem under your IHost, you
could do something like this:

ISubSystem[] sses = getHost().getSubSystems();
IRemoteProcessSubSystem pss = null;
for (int i = 0; i < sses.length && pss == null; i++){
if (sses[i] instanceof IRemoteProcesSubSystem){
pss = (IRemoteProcessSubSystem)sses[i];
}
}



"Wendy Zheng" <wezheng@cisco.com> wrote in message
news:08a4892cde8d760fc3bf157b6c37be2c$1@www.eclipse.org...
> Hi Dave,
> Thank you for the suggestion. Yes, that is very convenient API to use.
> Will you tell me how do I get IRemoteProcessSubSystem from IHost?
> Currently we are busy with beta release, I use shell command
> "ps -ef " to get all PIDs. But it is not idea solution.
>
> Thank you.
> Regards,
> Wendy
>
Re: How to get remote process PID [message #33709 is a reply to message #33545] Tue, 24 March 2009 21:52 Go to previous messageGo to next message
Wendy Zheng is currently offline Wendy ZhengFriend
Messages: 20
Registered: July 2009
Junior Member
Thank you, David.

Can we programmatically create IRemoteProcessSubSystem under IHost?
Will you show me how?

Looks like if it is not created, my program will not be able to find it
under IHost. Is it right?

Thank you.

Wendy
Re: How to get remote process PID [message #33743 is a reply to message #33709] Wed, 25 March 2009 14:51 Go to previous messageGo to next message
David McKnight is currently offline David McKnightFriend
Messages: 244
Registered: July 2009
Senior Member
You could need to have an appropriate subsystem configuration registered
against the SystemType that you're using. What is the system type in your
case? (i.e. SSH-only, Linux, Unix, etc.?)

Dave

"Wendy Zheng" <wezheng@cisco.com> wrote in message
news:f3862dc3e23927b81d389327e06d8b6e$1@www.eclipse.org...
> Thank you, David.
>
> Can we programmatically create IRemoteProcessSubSystem under IHost? Will
> you show me how?
> Looks like if it is not created, my program will not be able to find it
> under IHost. Is it right?
> Thank you.
>
> Wendy
>
Re: How to get remote process PID [message #34087 is a reply to message #33743] Tue, 31 March 2009 22:23 Go to previous messageGo to next message
Wendy Zheng is currently offline Wendy ZhengFriend
Messages: 20
Registered: July 2009
Junior Member
Hi Dave,

First I tried:

IRSESystemType systemType =
RSECorePlugin.getTheCoreRegistry().getSystemTypeById(IRSESys temType.SYSTEMTYPE_SSH_ONLY_ID);

then I tried:
IRSESystemType systemType =
RSECorePlugin.getTheCoreRegistry().getSystemTypeById(IRSESys temType.SYSTEMTYPE_UNIX_ID);

then call
host = registry.createHost(profile.getName(),systemType,hostName,ho stName,
"Connection to " + hostName);

to get IHost object.

Then I got IRemoteFileSubSystem through:
RemoteFileUtility.getFileSubSystem(IHost)

I got IRemoteCmdSubSystem through:
RemoteCommandHelpers.getCmdSubSystem(remoteHost);

When I do:
ISubSystem[] sses = IHost.getSubSystems()
I only see 3 sub systems:
- ssh.shells
- ssh.files
- ssh.terminals

I don't see IRemoteProcessSubSystem. Should I invoke API call to create
it?

Thank you !

Regards,
Wendy
Re: How to get remote process PID [message #34157 is a reply to message #34087] Wed, 01 April 2009 16:31 Go to previous messageGo to next message
David McKnight is currently offline David McKnightFriend
Messages: 244
Registered: July 2009
Senior Member
Hi Wendy,

You say you tried both an "SSH only" and a "Unix" conneciton but I'm not
sure which one you ended up using.

An SSH only connection does not have a process subsystem registered against
it by default. A "Unix" connection, on the other hand does - via the dstore
process service.

There are two process services in RSE that can be used:

1) dstore process service -can be used when a dstore server is installed and
works for linux and various unix flavours
2) linux shell process service - can be used via the shell subsystem for
linux systems

I don't know what type of system you're connecting to so I can't say whether
one of these options is possible for you. Could you tell me what the system
you're connecting to is?


"Wendy Zheng" <wezheng@cisco.com> wrote in message
news:5f623135b247a84d6a9d7432367ac6fe$1@www.eclipse.org...
> Hi Dave,
>
> First I tried:
>
> IRSESystemType systemType =
> RSECorePlugin.getTheCoreRegistry().getSystemTypeById(IRSESys temType.SYSTEMTYPE_SSH_ONLY_ID);
>
> then I tried:
> IRSESystemType systemType =
> RSECorePlugin.getTheCoreRegistry().getSystemTypeById(IRSESys temType.SYSTEMTYPE_UNIX_ID);
>
> then call host =
> registry.createHost(profile.getName(),systemType,hostName,ho stName,
> "Connection to " + hostName);
>
> to get IHost object.
>
> Then I got IRemoteFileSubSystem through:
> RemoteFileUtility.getFileSubSystem(IHost)
>
> I got IRemoteCmdSubSystem through:
> RemoteCommandHelpers.getCmdSubSystem(remoteHost);
>
> When I do:
> ISubSystem[] sses = IHost.getSubSystems()
> I only see 3 sub systems:
> - ssh.shells
> - ssh.files
> - ssh.terminals
>
> I don't see IRemoteProcessSubSystem. Should I invoke API call to create
> it?
> Thank you !
>
> Regards,
> Wendy
>
>
>
>
Re: How to get remote process PID [message #34188 is a reply to message #34157] Wed, 01 April 2009 21:06 Go to previous messageGo to next message
Wendy Zheng is currently offline Wendy ZhengFriend
Messages: 20
Registered: July 2009
Junior Member
Hi Dave,

I tried both "SSH - only" and "Unix" system types, they end up in the same
result.

My goal is to run RSE application from Window or Linux desktop to connect
to remote Linux host or Solaris host programmatically. Then launch the
process in the remote host and monitor the process status.

Will you suggest "dstore service" in this case?
Do I need to install dstore server in each remote host the application
will connect to?

Besides "dstore service", do I have other choices that my application will
be able get remote process infomatiion in either Linux or Solaris hosts?

Thank you!

Regards,
Wendy
Re: How to get remote process PID [message #34258 is a reply to message #34188] Mon, 06 April 2009 18:04 Go to previous messageGo to next message
David McKnight is currently offline David McKnightFriend
Messages: 244
Registered: July 2009
Senior Member
Hi Wendy,

For your linux system, you may want to create a "Linux" connection (instead
of an SSH Only connection) and configure the services (via the wizard) to
use Sftp, SSH shells and linux shell processes.

For each of your solaris systems, you may need the dstore server to be
installed. In that case, you might use a "Unix" connection and configure
the services (via the wizard) to use the dstore shell processes.

Dave


"Wendy Zheng" <wezheng@cisco.com> wrote in message
news:87c90986f5c0a0be3020e9860cd8dc71$1@www.eclipse.org...
> Hi Dave,
>
> I tried both "SSH - only" and "Unix" system types, they end up in the same
> result.
>
> My goal is to run RSE application from Window or Linux desktop to connect
> to remote Linux host or Solaris host programmatically. Then launch the
> process in the remote host and monitor the process status.
> Will you suggest "dstore service" in this case? Do I need to install
> dstore server in each remote host the application will connect to?
> Besides "dstore service", do I have other choices that my application will
> be able get remote process infomatiion in either Linux or Solaris hosts?
> Thank you!
>
> Regards,
> Wendy
>
>
>
Re: How to get remote process PID [message #34326 is a reply to message #34258] Tue, 07 April 2009 20:16 Go to previous message
Wendy Zheng is currently offline Wendy ZhengFriend
Messages: 20
Registered: July 2009
Junior Member
Thank you, Dave.

I got the clear picture of how it works.

Currently our system do remote process launching randomly,
install/run dstore server may not be feasible.

I will do process management through command subsystem for now.

When RSE SDK becomes more generic and flexible, we will switch back to
IRemoteProcessSubysystem.

Great thanks !

Regards,
Wendy
Re: How to get remote process PID [message #579784 is a reply to message #33192] Thu, 12 March 2009 14:33 Go to previous message
David McKnight is currently offline David McKnightFriend
Messages: 244
Registered: July 2009
Senior Member
Hi Wendy,

There is a process subsystem that can be used depending on the system type
of your host. Which system type are you using?

Once you have a connection that has a process subsystem, the following
IRemoteProcessSubSystem API is available:

/**
* Return a list of all processes on the remote system.
* This version is called directly by users.
* @param processNameFilter filter the results according to this object
* @param context A context object that will be associated with each returned
process
* @param monitor the progress monitor
* @return the list of all processes running on the host machine that
correspond to the filter,
* or null if there are none.
*/
public IRemoteProcess[] listAllProcesses(IHostProcessFilter
processNameFilter, IRemoteProcessContext context, IProgressMonitor monitor)
throws InterruptedException, SystemMessageException;

Dave


"Wendy Zheng" <wezheng@cisco.com> wrote in message
news:65a528e121c02ae41835b4db294cef21$1@www.eclipse.org...
> Hi,
>
> Does RSE SDK provide API to query the remote process PID? If I have IHost
> object, which API can I invoke to query all the processes
> in IHost machine?
> Thank you for sharing.
> Regards,
> Wendy
>
Re: How to get remote process PID [message #579860 is a reply to message #33265] Thu, 19 March 2009 23:05 Go to previous message
Wendy Zheng is currently offline Wendy ZhengFriend
Messages: 20
Registered: July 2009
Junior Member
Hi Dave,

Thank you for the suggestion. Yes, that is very convenient API to use.

Will you tell me how do I get IRemoteProcessSubSystem from IHost?

Currently we are busy with beta release, I use shell command
"ps -ef " to get all PIDs. But it is not idea solution.

Thank you.

Regards,
Wendy
Re: How to get remote process PID [message #579953 is a reply to message #33442] Fri, 20 March 2009 18:33 Go to previous message
David McKnight is currently offline David McKnightFriend
Messages: 244
Registered: July 2009
Senior Member
Hi Wendy,

Assuming that you have an IRemoteProcessSubSystem under your IHost, you
could do something like this:

ISubSystem[] sses = getHost().getSubSystems();
IRemoteProcessSubSystem pss = null;
for (int i = 0; i < sses.length && pss == null; i++){
if (sses[i] instanceof IRemoteProcesSubSystem){
pss = (IRemoteProcessSubSystem)sses[i];
}
}



"Wendy Zheng" <wezheng@cisco.com> wrote in message
news:08a4892cde8d760fc3bf157b6c37be2c$1@www.eclipse.org...
> Hi Dave,
> Thank you for the suggestion. Yes, that is very convenient API to use.
> Will you tell me how do I get IRemoteProcessSubSystem from IHost?
> Currently we are busy with beta release, I use shell command
> "ps -ef " to get all PIDs. But it is not idea solution.
>
> Thank you.
> Regards,
> Wendy
>
Re: How to get remote process PID [message #580030 is a reply to message #33545] Tue, 24 March 2009 21:52 Go to previous message
Wendy Zheng is currently offline Wendy ZhengFriend
Messages: 20
Registered: July 2009
Junior Member
Thank you, David.

Can we programmatically create IRemoteProcessSubSystem under IHost?
Will you show me how?

Looks like if it is not created, my program will not be able to find it
under IHost. Is it right?

Thank you.

Wendy
Re: How to get remote process PID [message #580038 is a reply to message #33709] Wed, 25 March 2009 14:51 Go to previous message
David McKnight is currently offline David McKnightFriend
Messages: 244
Registered: July 2009
Senior Member
You could need to have an appropriate subsystem configuration registered
against the SystemType that you're using. What is the system type in your
case? (i.e. SSH-only, Linux, Unix, etc.?)

Dave

"Wendy Zheng" <wezheng@cisco.com> wrote in message
news:f3862dc3e23927b81d389327e06d8b6e$1@www.eclipse.org...
> Thank you, David.
>
> Can we programmatically create IRemoteProcessSubSystem under IHost? Will
> you show me how?
> Looks like if it is not created, my program will not be able to find it
> under IHost. Is it right?
> Thank you.
>
> Wendy
>
Re: How to get remote process PID [message #580160 is a reply to message #33743] Tue, 31 March 2009 22:23 Go to previous message
Wendy Zheng is currently offline Wendy ZhengFriend
Messages: 20
Registered: July 2009
Junior Member
Hi Dave,

First I tried:

IRSESystemType systemType =
RSECorePlugin.getTheCoreRegistry().getSystemTypeById(IRSESys temType.SYSTEMTYPE_SSH_ONLY_ID);

then I tried:
IRSESystemType systemType =
RSECorePlugin.getTheCoreRegistry().getSystemTypeById(IRSESys temType.SYSTEMTYPE_UNIX_ID);

then call
host = registry.createHost(profile.getName(),systemType,hostName,ho stName,
"Connection to " + hostName);

to get IHost object.

Then I got IRemoteFileSubSystem through:
RemoteFileUtility.getFileSubSystem(IHost)

I got IRemoteCmdSubSystem through:
RemoteCommandHelpers.getCmdSubSystem(remoteHost);

When I do:
ISubSystem[] sses = IHost.getSubSystems()
I only see 3 sub systems:
- ssh.shells
- ssh.files
- ssh.terminals

I don't see IRemoteProcessSubSystem. Should I invoke API call to create
it?

Thank you !

Regards,
Wendy
Re: How to get remote process PID [message #580200 is a reply to message #34087] Wed, 01 April 2009 16:31 Go to previous message
David McKnight is currently offline David McKnightFriend
Messages: 244
Registered: July 2009
Senior Member
Hi Wendy,

You say you tried both an "SSH only" and a "Unix" conneciton but I'm not
sure which one you ended up using.

An SSH only connection does not have a process subsystem registered against
it by default. A "Unix" connection, on the other hand does - via the dstore
process service.

There are two process services in RSE that can be used:

1) dstore process service -can be used when a dstore server is installed and
works for linux and various unix flavours
2) linux shell process service - can be used via the shell subsystem for
linux systems

I don't know what type of system you're connecting to so I can't say whether
one of these options is possible for you. Could you tell me what the system
you're connecting to is?


"Wendy Zheng" <wezheng@cisco.com> wrote in message
news:5f623135b247a84d6a9d7432367ac6fe$1@www.eclipse.org...
> Hi Dave,
>
> First I tried:
>
> IRSESystemType systemType =
> RSECorePlugin.getTheCoreRegistry().getSystemTypeById(IRSESys temType.SYSTEMTYPE_SSH_ONLY_ID);
>
> then I tried:
> IRSESystemType systemType =
> RSECorePlugin.getTheCoreRegistry().getSystemTypeById(IRSESys temType.SYSTEMTYPE_UNIX_ID);
>
> then call host =
> registry.createHost(profile.getName(),systemType,hostName,ho stName,
> "Connection to " + hostName);
>
> to get IHost object.
>
> Then I got IRemoteFileSubSystem through:
> RemoteFileUtility.getFileSubSystem(IHost)
>
> I got IRemoteCmdSubSystem through:
> RemoteCommandHelpers.getCmdSubSystem(remoteHost);
>
> When I do:
> ISubSystem[] sses = IHost.getSubSystems()
> I only see 3 sub systems:
> - ssh.shells
> - ssh.files
> - ssh.terminals
>
> I don't see IRemoteProcessSubSystem. Should I invoke API call to create
> it?
> Thank you !
>
> Regards,
> Wendy
>
>
>
>
Re: How to get remote process PID [message #580220 is a reply to message #34157] Wed, 01 April 2009 21:06 Go to previous message
Wendy Zheng is currently offline Wendy ZhengFriend
Messages: 20
Registered: July 2009
Junior Member
Hi Dave,

I tried both "SSH - only" and "Unix" system types, they end up in the same
result.

My goal is to run RSE application from Window or Linux desktop to connect
to remote Linux host or Solaris host programmatically. Then launch the
process in the remote host and monitor the process status.

Will you suggest "dstore service" in this case?
Do I need to install dstore server in each remote host the application
will connect to?

Besides "dstore service", do I have other choices that my application will
be able get remote process infomatiion in either Linux or Solaris hosts?

Thank you!

Regards,
Wendy
Re: How to get remote process PID [message #580263 is a reply to message #34188] Mon, 06 April 2009 18:04 Go to previous message
David McKnight is currently offline David McKnightFriend
Messages: 244
Registered: July 2009
Senior Member
Hi Wendy,

For your linux system, you may want to create a "Linux" connection (instead
of an SSH Only connection) and configure the services (via the wizard) to
use Sftp, SSH shells and linux shell processes.

For each of your solaris systems, you may need the dstore server to be
installed. In that case, you might use a "Unix" connection and configure
the services (via the wizard) to use the dstore shell processes.

Dave


"Wendy Zheng" <wezheng@cisco.com> wrote in message
news:87c90986f5c0a0be3020e9860cd8dc71$1@www.eclipse.org...
> Hi Dave,
>
> I tried both "SSH - only" and "Unix" system types, they end up in the same
> result.
>
> My goal is to run RSE application from Window or Linux desktop to connect
> to remote Linux host or Solaris host programmatically. Then launch the
> process in the remote host and monitor the process status.
> Will you suggest "dstore service" in this case? Do I need to install
> dstore server in each remote host the application will connect to?
> Besides "dstore service", do I have other choices that my application will
> be able get remote process infomatiion in either Linux or Solaris hosts?
> Thank you!
>
> Regards,
> Wendy
>
>
>
Re: How to get remote process PID [message #580308 is a reply to message #34258] Tue, 07 April 2009 20:16 Go to previous message
Wendy Zheng is currently offline Wendy ZhengFriend
Messages: 20
Registered: July 2009
Junior Member
Thank you, Dave.

I got the clear picture of how it works.

Currently our system do remote process launching randomly,
install/run dstore server may not be feasible.

I will do process management through command subsystem for now.

When RSE SDK becomes more generic and flexible, we will switch back to
IRemoteProcessSubysystem.

Great thanks !

Regards,
Wendy
Previous Topic:Problems with a dStore connection
Next Topic:TCF communication protocol versioning
Goto Forum:
  


Current Time: Fri Apr 19 10:18:02 GMT 2024

Powered by FUDForum. Page generated in 0.02702 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top