How to get port/socket information from kstat on Solaris - mapping

Is it possible to use kstat to get information about which processes have which ports open? I've looked into how lsof does it and apparently they read volatile kernel memory, which kstat seems to give access to (please correct me if I'm wrong).
I was just wondering if anyone knows how to filter kstat to display information about which processes a port has open. Perhaps which module should I look at?

On Solaris 11.2, you can use netstat -u to obtain that information. Per the man page:
–u
Lists the user, process id, and the program which originally
created the network endpoint or controls it now.
On earlier versions of Solaris, there's no easy way - you can use pfiles to some degree, but its utility in identifying sockets is limited.
Also see What process is listening on a certain port on Solaris?

No, kstat doesn't store process level information. Moreover, kstat doesn't give access to volatile kernel memory but only to specific kernel statistics.
Finally, you shouldn't have started a new question instead of following up here.

Related

How to add some OS level metrics to JMX for java JVM

Using JConsole someone can access to the metrics that were gathered by default for OS like memory, CPU load and ..., in addition to process specific metrics. My question is can we add some OS customized metrics, like the usage of some directory using Java Files API or checking if a specific port is responsive?
I gather so-called metrics using remote SSH and the commands like du -sh /directory that has so many delays and I want to get it using JMX so it could run faster.
This question talked about adding spring metrics.
As the linked question shows it is easy to expose a Java class as an MBean, so you could certainly write a class that collects the metrics you need. Implementing du in Java is not difficult. However, I'm not sure that it will solve your problem. The example of du -sh /directory is probably slow because it needs to recursively measure the size of a directory hierarchy. That will be just as slow (probably slower!) in Java.
As a side note I would normally use collectd or Telegraf for that kind of thing, but again the I/O cost for finding disk usage would be the same.
I would suggest adding some logs with times to your current script so that you can see where it spends time. If it takes less than a second to connect with SSH and 15 seconds to determine the directory size, for example, moving from SSH to JMX won't help.

iOS: How to learn how much memory a process is using (by pid number)?

I want to find one how much memory a bunch of processes are using on the iPhone.
Is there a way to do that programmatically?
Thanks.
AFAIK iOS developer tools will not allow you to check 'other' process memory consumption. You can't ask the OS information about the entire system, but not specify processes. :(
You can, anyways, check that memory by using a Jailbroken device. I do it, using:
ssh access (installing openssh first, off course) and using top or ps aux
system information (from Cydia) SystemInformation
Maybe there is another tool, but I was unable to find (and I tried!) one that give you exact information of each running process.
ps: remember that iOs devices use a default root password as alpine and you should change it on your first access to avoid security risks.

How to List TCP/UDP Connections in iOS 4

I am interested in deriving a list of active TCP/UDP network connections on an iOS 4.3 device. Basically, I'm looking for the same type of information one gets from issuing a "netstat -anp tcp" (or the same, but with udp) command under OS X Darwin.
I've searched Apple's iOS Developer Library (especially NSNetServices, CFNetServices, and the iOS Manual Pages) and the Internet, but with no good results. Yet, there is an iOS Netstat app (see http://itunes.apple.com/us/app/netstat/id400071873?mt=8&ign-mpt=uo%3D2) out there, so it appears possible.
Thanks in advance for any useful pointers/suggestions/thoughts.
I believe I have now answered my own question. Thought I had taken a close enough look at the sysctl() library function, but I hadn't! For example, the following will yield information about the current TCP connections:
sysctlbyname("net.inet.tcp.pcblist", ...)
To get information about UDP connection, simply use a different Management Information Base (MIB) name: net.inet.udp.pcblist.
For convenience, here's a link to the appropriate iOS man page:
http://developer.apple.com/library/ios/#documentation/System/Conceptual/ManPages_iPhoneOS/man3/sysctlbyname.3.html

Finding available LPT (parallel) ports and addresses in Delphi

I am doing direct I/O on a parallel port which is fine and necessary for speed. I would like to enumerate the available ports to offer the user a choice of ports at setup time rather than a tedious trawl through device manager to read the address manually. Does anyone know a means of doing this please?
Many thanks,
Brian
According to this Microsoft article, for Win2K and newer, you can find details of parallel-connected devices in the registry at HKLM\SYSTEM\CurrentControlSet\Enum\LPTENUM.

How do I obtain equipment serial numbers programmatically?

I need to run an equipment audit and to do that I need to obtain the Windows PC, monitor etc. serial numbers.
So I faced with going to each PC and manually writing down the numbers.
Is there a way I can get this programmatically so each user can run a small program and email me the results?
If this information is anywhere, it'd be in WMI (http://en.wikipedia.org/wiki/Windows_Management_Instrumentation) - you could write a VBscript script to query this information and save it to a remote share on a server for example.
Generally no. If your computers are all Dell, though, you might be able to get some information (maybe the serial number?) for the PC itself.
The monitor, if it supports VESA EDID (DDC, EDID, EEDID), may also include a 32 bit serial number - which may or may not have any relation to the serial number printed on the monitor's label. You may be able to access this through the display driver - Windows has access to portions of it (to display monitor resolution and timing) so I expect the manufacturer/model/serial number is stashed somewhere as well.
However, making such a program that would work across all systems and monitors would likely be much more work than simply going to each station and recording it, unless all the systems have the same hardware.
Good luck!
-Adam
I am not quite sure if this is exactly what you want, but there is pay software made by DameWare that allows you to easily remote connect to other machines and get lots of information. I haven't used it much yet, but I think there is a way to make batch scripts so it can go pull information like that for you, or see what apps are installed on the machines. Even worse case though, you don't have to run to each machine. (I am assuming you mean SN like the MS product ID)
WMI is definitely the way to go. You can get quite a bit of useful audit information through that API.
Michael Baird appears to have written a VBS script to read the EDID information. The script reads and parses the monitor EDID information from the registry in order to retrieve asset information.
http://cwashington.netreach.net/depo/view.asp?Index=980&ScriptType=vbscript

Resources