sigar

Sigar API for JAVA (need a guide)

情到浓时终转凉″ 提交于 2019-12-07 06:15:24
问题 I've downloaded Sigar API ( http://support.hyperic.com/display/SIGAR/Home ) and would like to use it in a project to get information about different processes which are running. My problem is that I can't really find some useful code snippets to learn from and the javadoc from their website isn't of much help, because I don't know what I should be looking for. Do you have any ideea where I could find more information? 回答1: To find the pid (which is needed to find out information about a

使用Java获取windows进程的路径

▼魔方 西西 提交于 2019-12-05 19:44:37
最近写一个小程序扫描服务器上项目的启动情况时遇到一问题,就是当服务器多个项目启动时,进程中显示的都是javaw.exe,无法分辨哪个javaw.exe属于哪个项目,所以就想获取进程的路径,但是网上百度都只能获取到进程pid,无法得到进程路径,之后通过google搜到了如下一段代码: /*1)、取当前进程ID*/ // 9420 @XMCX pid@计算机名 String pid = ManagementFactory .getRuntimeMXBean () .getName () ; //@之前为进程ID pid = pid .substring ( 0 , pid .indexOf ( '@' )) ; /*2)、根据进程ID取进程命令路径 D:\jdk1.6.0_18\bin\javaw.exe*/ Sigar sigar = new Sigar() ;//http://www.oschina.net/p/sigar System .out .println (sigar .getProcExe (pid) .getName ()) ; System .out .println (sigar .getProcArgs (pid)[ 0 ]) ; 刚好同时在CSDN论坛中提问有位大神也回复使用Sigar可以实现,遂下了sigar的jar包,然后一番折腾,终于弄出来了。

Sigar network speed

孤人 提交于 2019-12-05 18:45:48
this lib is kind of awesome to get cpu, ram and other staff. However, i can't figure out, how to get the network speed. that means. how much data is sended and received throw the network-cart in a amount of time? is there a way to give me this data? is this probably what i am searching for? Tcp stat = sigar.getTcp(); stat.getInSegs() + " segments received" stat.getOutSegs() + " segments send out" if there is no way in sigar, is there a other lib to use? thank's for help output: {DefaultGateway=193.171.36.1, PrimaryDns=140.78.2.62,SecondaryDns=140.78.3.62, DomainName=, HostName=Schneider-PC}

Sigar API for JAVA (need a guide)

不打扰是莪最后的温柔 提交于 2019-12-05 11:05:59
I've downloaded Sigar API ( http://support.hyperic.com/display/SIGAR/Home ) and would like to use it in a project to get information about different processes which are running. My problem is that I can't really find some useful code snippets to learn from and the javadoc from their website isn't of much help, because I don't know what I should be looking for. Do you have any ideea where I could find more information? To find the pid (which is needed to find out information about a certain process), you can use a ProcessFinder . The method to find a single process pid is findSingleProcess

sigar-amd64-winnt.dll … can't reference it or bundle it with .jar

好久不见. 提交于 2019-12-04 14:53:19
(It might be an obvious mistake I'm making, but I couldn't get it to work after 6 hours now.) I'm trying to get CPU information using the sigar.jar in my eclipse project (just testing the sigar API for now). It runs in eclipse without problems: what made it work in eclipse was to put the dll in the same folder as the sigar.jar I tested that adding a path to the dll as the "native code property" in the build path config dialog has no effect. Adding vm arguments in the run configuration also has no effect. I tested putting 2 fake paths in those 2 places and as long as I have the dll in the same

Java系统监控(淘汰sigar)

拟墨画扇 提交于 2019-12-04 05:41:21
Sigar是Hyperic-hq产品的基础包,是Hyperic HQ主要的数据收集组件。它用来从许多平台收集系统和处理信息. 这些平台包括:Linux, Windows, Solaris, AIX, HP-UX, FreeBSD and Mac OSX. Sigar有C,C#,Java和Perl API,java版的API为sigar.jar sigar.jar的底层是用C语言编写的,它通过本地方法来调用操作系统API来获取系统相关数据。Windows操作系统下Sigar.jar 依赖sigar-amd64-winnt.dll或sigar-x86-winnt.dll,linux 操作系统下则依赖libsigar-amd64-linux.so或libsigar-x86-linux.so 由于每个平台都要依赖.dll 所以的GitHub上发现了oshi 添加maven <dependency> <groupId>com.github.oshi</groupId> <artifactId>oshi-core</artifactId> <version>3.4.4</version> </dependency> 编写测试类 package com.sundablog.utlis; import java.util.Arrays; import java.util.List; import

no libsigar-amd64-linux.so in java.library.path

匿名 (未验证) 提交于 2019-12-02 21:59:42
打好jar包传到linux后,运行java -jar xxxx.jar后报错:no libsigar-amd64-linux.so in java.library.path ; sigar主要是用来获取主机信息的 ; 解决步骤: 要先去下个东西 http://pan.baidu.com/s/1pJK6Nur 我们需要获取到java.library.path这个路径,方法是写个用小的java程序来实现 ; System.out.println(System.getProperty("java.library.path")); 在main方法中写上这一条指令来打印系统中的java.library.path路径;(如我的centos的路径为:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib) ; 解压上面下载的压缩包,然后仔细阅读解压后生成的文件夹中的"备注.txt"这个文本的前5行,也就是下面列出来的内容: sigar 测试项目 在window环境下 只需要一下2个依赖: sigar.jar sigar-x86-winnt.dll 如果环境为linux,则在hyperic-sigar-1.6.4\sigar-bin\lib中寻找替换对应的sigar-x86-winnt.dll 文件(linux下为os文件

How to include SIGAR API in Java Project

*爱你&永不变心* 提交于 2019-12-01 18:33:11
I'm new on Java, so i don't know who to get the downloading zip-file (hyperic-sigar-1.6.4.zip) in the project where i've to use the Sigar-classes. I already try to import the Sigar.Jar file, but the problem is then that the sources are unknown for each class in sigar. So i use Eclipse Indigo for programming, may someone can help me :) Very Thanksfull greets Marcus First You need to add Sigar.jar to your library, then add .so file to your library (you need to pick file for your OS what you are using). You can find these files in "hyperic-sigar-1.6.4/sigar-bin/lib" . You can find the usage of

How to install SIGAR on Ubuntu-based Linux?

可紊 提交于 2019-12-01 17:12:02
I am using SIGAR in a java project with Maven and Spring. I have the Maven Dependency and Maven Repository included in my pom.xml file, as described in this link: http://mavenhub.com/mvn/thirdparty-uploads/org.hyperic/sigar/1.6.5.132 Furthermore, I am launching the program using Jetty (which launches the .war file created by mvn install ). However, SIGAR still won't work. Aparently I also need to install libsigar-amd64-linux-1.6.4. So I downloaded that file, but now I have no idea what to do with it. How do I fix this? Where do I put that file? Finally found the solution. I had to download

Sigar UnsatisfiedLinkError

徘徊边缘 提交于 2019-12-01 16:56:25
问题 I'm new to Sigar. I would like to run a simple test to know how I can monitor my system. I added sigar-1.6.4 and log4j as external libraries, but when I go to run it, I face this error: Exception in thread "main" java.lang.UnsatisfiedLinkError: org.hyperic.sigar.Sigar.getCpuInfoList()[Lorg/hyperic/sigar/CpuInfo; at org.hyperic.sigar.Sigar.getCpuInfoList(Native Method) Here is my code: import java.util.Map; import org.hyperic.sigar.CpuInfo; import org.hyperic.sigar.FileSystem; import org