Most of our deployments are on Linux. It is ok to go with OS specific
commands. Please schedule a review.

--
Afkham Azeez
Sent from my phone
On Jan 23, 2012 12:37 PM, "Dileepa Jayakody" <dile...@wso2.com> wrote:

> Dear all,
>
> The bootup validator component now can be configured with custom
> Configuration Validators and Data Collectors as shown in the below sample
> [1]. A Data collector basically retrieves system information using some
> mechanism (OS independent library etc.) and the collected data can be used
> for the validation process by Configuration Validators.
>
> In HWDataCollector, system hardware related data such as CPU frequency,
> physical memory are collected; For this I have used a 3rd party library
> named JavaSysMon [2]. The initial attempt was to use SIGAR API, but it was
> unsuccessful as I had issues with loading native libraries of it.
> JavaSysMon seems to be a very good alternative for this requirement.
>
> Last few days I was looking at ways of retrieving the number of open file
> handles as per a requirement of the bootup validator component [3]. But
> AFAIU listing open files is OS dependent and cannot be achieved through
> regular Java APIs.
> For example in Linux the command to list open files for a particular
> process is: lsof -p <PID>
> Does anybody have an idea of retrieving the number of open file handles in
> Java? The only mechanism I can think of, at the moment is to use
> Runtime.getRuntime().exec("the cmd to list open files"); But this doesn't
> look like the smoothest solution for this, does anybody have a better idea?
> Appreciate your views on this.
>
> Thanks,
> Dileepa
>
> [1]Sample  config_recommendations.xml to configure bootup validator:
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <!--configuration bit values should be given in Mega bytes (1KB = 1024
> bytes, 1MB = 1024 KB, 1GB = 1024 MB), CPU value in MHz-->
> <Configuration>
>     <Validator class="org.wso2.carbon.core.bootup.validator.HWValidator">
>         <Parameter name="cpu">800</Parameter>
>         <Parameter name="ram">1024</Parameter>
>     </Validator>
>     <Validator class="org.wso2.carbon.core.bootup.validator.JVMValidator">
>         <Parameter name="heapMemory">512</Parameter>
>         <Parameter name="nonHeapMemory">512</Parameter>
>         <Parameter name="totalMemory">1024</Parameter>
>         <Parameter name="freeMemory">512</Parameter>
>     </Validator>
>
>     <!--Configuration Data Collectors to collect system-data for
> configuration validators to validate-->
>     <Collector
> class="org.wso2.carbon.core.bootup.data.collector.HWDataCollector"/>
>     <Collector
> class="org.wso2.carbon.core.bootup.data.collector.JVMDataCollector"/>
>
> </Configuration>
>
> [2] https://github.com/jezhumble/javasysmon
> [3] https://wso2.org/jira/browse/CARBONROADMAP-15
>
> On Wed, Jan 18, 2012 at 11:05 AM, Dileepa Jayakody <dile...@wso2.com>wrote:
>
>> Hi all,
>>
>> As per the offline discussion had with Pradeep and Azeez few days back, I
>> have implemented the bootup-validator component's framework to be
>> extensible.
>>
>> The component can be extended with new bootup validation tests by adding
>> new ConfigurationValidator classes with relevant parameters to validate; in
>> the config_recommendations.xml (the newly introduced xml in repository/conf)
>>
>> A sample config_recommendations.xml:
>>
>> <Configuration>
>>     <Validator class="org.wso2.carbon.core.bootup.validator.HWValidator">
>>         <Parameter name="cpu">800</Parameter>
>>         <Parameter name="ram">1000</Parameter>
>>     </Validator>
>>     <Validator class="org.wso2.carbon.core.bootup.validator.JVMValidator">
>>         <Parameter name="heapMemory">6000</Parameter>
>>         <Parameter name="nonHeapMemory">4000</Parameter>
>>         <Parameter name="totalMemory">10000</Parameter>
>>         <Parameter name="freeMemory">2000</Parameter>
>>     </Validator>
>> </Configuration>
>>
>> The system data collection can also be extended in the same manner.
>> At the moment I'm having trouble with Sigar API to retrieve HW
>> configuration data (CPU, RAM), will update the thread with progress.
>>
>> Thanks,
>> Dileepa
>>
>> On Fri, Jan 13, 2012 at 1:01 PM, Pradeep Fernando <prad...@wso2.com>wrote:
>>
>>> Hi,
>>>
>>> are we going to allow users to implement their own bootup tests, using
>>> somekind of extension mechanism. (we are providing all the gathered info,
>>> they decide on what to do with those). Is it a overkill ?
>>>
>>> are we doing any native calls within the carbon-env (Now). ?
>>>
>>> thanks,
>>> --Pradeep
>>>
>>> _______________________________________________
>>> Carbon-dev mailing list
>>> Carbon-dev@wso2.org
>>> http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev
>>>
>>>
>>
>>
>> --
>> Dileepa Jayakody,
>> Software Engineer, WSO2 Inc.
>> Lean . Enterprise . Middleware
>>
>> Mobile : +94777-857616
>>
>>
>
>
> --
> Dileepa Jayakody,
> Software Engineer, WSO2 Inc.
> Lean . Enterprise . Middleware
>
> Mobile : +94777-857616
>
>
> _______________________________________________
> Carbon-dev mailing list
> Carbon-dev@wso2.org
> http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev
>
>
_______________________________________________
Carbon-dev mailing list
Carbon-dev@wso2.org
http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev

Reply via email to