How can i retrieve data from method of wmi class? - hyper-v

Good day, I am currently trying to do this:
out = connection.query("Select * From
Msvm_VirtualSystemManagementService.Msvm_SummaryInformation")
However, I need to find Ram usage by virtual machine of hyper-v host. Any idea how to obtain this?
Thanks in advance.

to query the memory settings use Msvm_MemorySettingData. To get the currently allocated/used RAM query Msvm_Memory (property NumberOfBlocks).
For more information about WMI classes please use the information provided here: https://msdn.microsoft.com/en-us/library/cc136986(v=vs.85).aspx

Related

query SCCM apps

Is there any table in the SCCM database that returns all applications located in a subfolder ?
This table returns all application and packages: "v_Package"
but i need to filter only applications and only the ones in a specific subfolder.
i also found the table "v_Applications" in my SQL server that returns only the applications but it is not present in the microsoft docs:
https://learn.microsoft.com/en-us/mem/configmgr/develop/core/understand/sqlviews/application-management-views-configuration-manager
is that normal ?
Could someone point me in the right direction ?
Thank you very much
The best "trick" if you want to do something that is possible in the SCCM Console via SQL is to do it and then watch SMSProv.log on your siteserver which will tell you what SQL and WQL command was used to produce your result. That is always a good point towards the direction you should take.
In this case you will see that the query takes the applications info from a function call fn_ListApplicationCIs_List(1031) which features a Column ObjectPath that is your folder so a quick
select DisplayName, ObjectPath from fn_ListApplicationCIs_List(1031)
should probably give you what you want.
The real info if you wanna go deeper is as far as I understand it in a view called vFolderMembers (which weirdly only contains those that are not in root) but going from there you would have to join some internal IDs to get to a readable name.
To also answer your other question: Yes v_Applications is a normal table but it does not contain the object Path (which is only relevant within the context of the console and not deployment) and yes it is (sadly) normal that Microsofts documentation is not always the best and never really complete in regards to SCCM matters.
wow that's great.
what a relief. i've been struggling with that for a while .
thank you so much for your help. it works exacly as i need.

How to sort all lists in a specific bin in Aerospike using aql?

I have a few question about ordered lists in Aerospike:
How can I see in the DB, using aql, if the list is ordered or not?
Does ordered list means it’s sorted?
I want to scan the db and change all lists (in a specific bin) to be ordered. I want to do is using set_type, but I can’t seem to make it work. Is that possible? how can I do it?
Thanks
I'm posting my answer from your cross-posted question here https://discuss.aerospike.com/t/list-oprations/5282:
You could scan the namespace with a ScanPolicy.includeBinData=false and for each record digest you get back use operate() to wrap the following operations into a single transaction:
ListOperation.setOrder() to ListOrder.ORDERED
ListOperation.sort() with a ListSortFlags.DROP_DUPLICATES
You will only need to run this once to clean up your database.
The ordering type will stick for all future operations. You'd just continue to use the ListWriteFlags.ADD_UNIQUE list policy.
This is for the Java client, but all other clients have these operations and policies in them.
I don't think AQL is the right tool to exploit the full power of lists. Perhaps it is not yet updated to the full functionality of lists. It is built on top of the C client. At least AQL ver 3.15.2.1 that I checked with is not. You might want to write a java client application.

How to check if the cloudera services like hive, Impala are running or not through java code?

I want to run some hive queries, and then need to collect different metrics like hdfs bytes read/write. For this I have written java code. But before running the code I just want to check if the cloudera services like hive, impala, yarn are running or not. If running then the code need to execute otherwise just exit. Is there any way to check the status of services by java code?
Sampson S gave you a correct answer, but it's not trivial to implement. The information is available via the REST API of the Cloudera Manager (CM) tools offered by Cloudera. You would have your Java program make a web GET request to CM, parse the JSON result and use that to make a decision. Alternatively, you could look at the code behind their APIs to make a more direct query.
But I think you should ask "Why?" What are you trying to accomplish? Are you replicating the functionality already provided by CM? When asking questions here on SO it's always helpful to provide some context. It seems like you may be new to the environment. Perhaps it already does what you want.

There is a "%{nas-name}" variable to get the current nas name and use into dialup.conf freeradius?

I am working with freeradius, I could install and configure it on linux server and I can receive request from remote devices but I need to make a change to the query that inserts into radacct table to save the name of the nas (for usage reports) but I can´t find something about it, this is really simple, I just need to know what variable to use, for example I know that I can use %{User-Name} variable to get the name of the user that is connecting to freeradius, I need a similar variable to get the nas name, that´s all.
I hope it exists and you can tell what it is.
Thanks in advance, have a nice day.
That's be %{%{NAS-Identifier}:-%{client:shortname}}

how would you retrieve cacti data remotely

I have a cacti instance that polls many servers. I have a different analytic platform where I need to get the data to this platfrom from cacti. Has anybody done something like this? Is it possible to retrieve cacti data remotely via web service calls or anything?
You could use the rrdtool dump data. Find where cacti stores the rrd files. Usually something like /var/lib/cacti/rra or /usr/share/cacti/rra
For each graph there should be a graph_name.rrd. Use rrdtool dump command to convert these into XML files which can be parsed and sent to your other program?
rrdtool dump graph_name.rrd
Please verify that the correct datasource is created as well as there is no mistakes when creating the graph template. You can also use a debug function at the top of the graph that tells you if it found the rd database or not.