WLST to check the PermGen usage - weblogic

I would like to get the Max Perm Gen and Usage of a server in WL Domain using WLST.
SO far I was able to see it's possible to get the information from JMX, mBean.
The mBean location is "java.lang:Location=Server1,name=PS Perm Gen,type=MemoryPool"
I tried below code but it doesn't seem working.
testObject=ObjectName('java.lang:Location=Server1,name=PS Perm Gen,type=MemoryPool')
Or Trying below code didn't work either.
testBean=getMBean('javax.management.openmbean.CompositeData:Location=Server1,name=Usage,type=PS Perm Gen')
for item in testBean:
print item.getKey() + ':' + item.getValue()
Please help.
Update: -------------------------------------------------
Thanks for the quick reply. There's no WLST code to share in related to my topic yet because I'm trying to explore the possibility out of my search.
Basically, I'm trying to check the available Perm Gen size within WLST run before deploying an artefact to a WL managed server.
This is because WebLogic is not releasing the undeployed artefact's non-heap memory space out of WL managed server and if you keep doing deployment/undeployment without recycling, the WL managed server will eventually throw OOME of Perm Gen space.
We are trying the service outage as minimum and keeping the WL managed server up and running as long as possible.
I've searched everywhere about the WLST mBean tree location to get the non-heap memory status but failed.
But if you use JManage, you can get non-heap memory status through mBean object "java.lang:Location=Server1,name=PS Perm Gen,type=MemoryPool".
It will show like below in JManage:
Object Name java.lang:Location=Server1,name=PS Perm Gen,type=MemoryPool
Class Name sun.management.MemoryPoolImpl
Description Information on the management interface of the MBean
Configured Name Add to Application
So I was wondering why is it not possible to extract the mBean info from WLST if the mBean is there? So I'm trying to get help about anyone who had similar experience/situation.

I have found that you can connect to a managed server and then use something like this:
permObjectName=ObjectName('java.lang:type=MemoryPool,name=PS Perm Gen')
usoPerm=mbs.getAttribute(permObjectName,'Usage')
usoPerm.get('max') #Returns MaxPermSize in bytes
usoPerm.get('used') #Returns used Perm Space in bytes
However, I have tested this in several servers and it doesn't always work because the MBeanServer (mbs) is not able to 'see' the "java.lang" mbean tree.

Weblogic has different mbean hierarchies for different purposes. It considers all non-weblogic mbeans as "custom", and as such they reside in the "custom" tree.
https://docs.oracle.com/cd/E24329_01/web.1211/e24415/understandwls.htm#JMXCU239
To get the permgen usage of the machine you are connected to:
cd('custom:/java.lang/java.lang:type=MemoryPool,name=PS Perm Gen')
permgen=get("Usage").get("used")
If you are connected to a domain admin and want to get the information for a different server:
cd('domainCustom:/java.lang/java.lang:Location='+servername+',name=PS Perm Gen,type=MemoryPool')
permgen=get("Usage").get("used")

Related

Trying to push first app to SAP, getting error "exceeded the total routes". How can I correct this?

I am taking Pivotal's Cloud Foundry training. I set up a 30 day trial account at SAP and trying to push my first "hello, world" application, but getting error
Updating app web-app...
Mapping routes...
You have exceeded the total routes for your organization's quota. FAILED
How do I increase that quota? (This is my first and only push! Not sure why I am exceeding anything!)
I tried
> cf org P2000121914trial_trial
Getting info for org P2000121914trial_trial...
name: P2000121914trial_trial
domains: cfapps.us10.hana.ondemand.com
quota: SUBSCRIPTION_QUOTA
spaces: victor
isolation segments:
I also tried
> cf create-quota small -m 2048M -i 1024M -r 10 -s 10
Creating quota small as vgrazi#gmail.com...
FAILED
Server error, status code: 403, error code: 10003, message: You are not
authorized to perform the requested action
My manifest looks like this:
---
applications:
- name: web-app
memory: 32M
disk_quota: 256M
random-route: true
buildpack: "https://github.com/cloudfoundry/ruby-buildpack#v1.6.47"
Quotas in public CF deployments are typically set by the platform operator and are not adataptable by customers unless you have received Org Manager Permissions. I'm quite suprised this appears to be provisioned incorrectly at SAP.
In any case, you might try a cf routes --orglevel to see all the routes your org is consuming.
It sounds like this won't apply to your case, but a common "beginner" mistake in CF is that deleting an app does not delete any routes associated with it because they might still be in use by other applications. You can delete routes that are not associated with any app using cf delete-orphaned-routes.
In summary, this might be something that only their support can fix for you.
Plug: If you want to get up and running quickly, there are also providers that offer CF hosting with free tiers for developers. I'm a co-founder at Meshcloud we also offer a free 30-day trial. I can assure you org & space quotas are set up correctly ;-)
I had a similar issue, you need to assign some quota to your space. You do this in the SAP Cloud Platform Cockpit.
Select your CF Subaccount -> Quota Plans
Create a "New Plan", set some Memory capacity within that.
Assign the Plan you created to your Space.

Labview: error in accessing server addres space

I am trying to access the server address space and I am getting this Error.
LabVIEW: (Hex 0xFFFA8EBB) The node path refers to a node that does not exist in the server address space
The server is on a Plc and I am connected via Lan. the information i have is
Server-URL: opc.tcp://192.168.1.135:4840
Namespace-URI: urn:B&R/pv/
I have tried different things but i am not sure how to access the variables in address space. any suggestions would be helpful
B&R Publishes the Endpoints of your data in a fairly consistent manner. If you use a OPC UA browsing tool, you will find that the address space visible to Labview should start with
PLC.Modules.<Default>
B&R Automation Studio requires that you complete the default OPC UA configuration. Within that configuration you would need to enable the nodes/endpoints in question. You can then access these nodes in Labview.
You should check the following:
Under your controller, confirm that you have enabled OPC UA in the
configuration view.
Next, check that you have added a OPC UA Default View File to your
configuration for the hardware you are running.
Finally, in that file, ensure that you have enabled the endpoint/variable and that
it has at least the read permission. The quickest and most expedient
way is to ensure that you have gone to the top level of the OPC UA
Default View File and added the Everyone role and that Read is
enabled. This will cascade down to all enabled endpoints.
Save this and make sure it has been built and added to your controller. You should be able to access endpoints then.
For example, if I have a program called "LampController" running in B&R with a variable called switchState it would be addressed by:
PLC.Modules.<Default>.LampController.switchState
You need to use %26; in place of an ampersand. The ampersand is used to delimit the URI from the query segment. It's pretty unusual to even have an ampersand in a URI. Are you sure you typed it right?

MSMQ complaining about format name while reading messages

I have a non transacitonal private queue(errors) on a remote machine(10.3.35.3), running xp. I am trying to read messages from a machine which runs windows 2008.
I am using "FormatName:Direct=tcp:10.3.35.3\Private$\errors" to access the queue.
I can connect to it.
I can peek.
I have a eventHandler for ReceiveCompleted event, and it get fired once there is a message received from queue, however when I try to convert "source" object to messageQueue.
Friend Sub MyReceiveCompleted(ByVal [source] As [Object], ByVal asyncResult As ReceiveCompletedEventArgs)
Dim objMessageQueue As MessageQueue
Try
objMessageQueue = New MessageQueue
objMessageQueue = CType([source], MessageQueue)
At this point when I try to convert "source" object to MessageQueue object I got exception "The specified format name does not support the requested operation. For example, a direct queue format name cannot be deleted.".
full stack trace of exception
at System.Messaging.MessageQueue.GenerateQueueProperties()
at System.Messaging.MessageQueue.get_QueuePath()
at System.Messaging.MessageQueue.get_QueueName()
at MyReceiveCompleted(Object source, ReceiveCompletedEventArgs asyncResult)
I have tried different format names, no luck. can anyone please explain what is wrong in here? is there any other format name I need to use? can we know what formatname a queue will like beforehand?
Note: in here someone said to use id instead, when I look for id in properties of queue I got all 0s in "Type ID:" field.
Ok I give up on this, it is still not working becuase it is part of a very messy old code. I created my own little application(using the same code, same .net framework) and it can connect to remote queues and read/write/peek. so I believe this was an example of maintenance nightmare of a very very old code base.
during my research I have found some useful links, which may help someone who lands here in future. John Breakwell has following to contribute about remote queue
There is a new security in MSMQ4.0
A registry key in MSMQ3.0
some ports info regarding msmq
some more info about remote msmq 4.0 processing
To see if your msmq is installed in workgroup mode or other one, goto HKLM->Software-> Microsoft->MSMQ->Parameters check REG_DWORD workgroup.
1 is workgroup mode.
0 is AD mode.
and if you want to know the version of your msmq, check version section of this wiki page
I almost forgot to mention that as a rule of thumb I believe we should always read local and write remote, not other way round.

command for enabling/disabling app context in mod cluster?

Can anyone provide me a command to enable /disable context in mod cluster-1.0.10?
I have this
curl http://mydomain/mod_cluster-manager?Cmd=STOP-APP&Range=CONTEXT&JVMRoute=node1& Alias=default-host&Context=/myapp
but i am unable to understand Localhost(App or Web), Alias(App servers running on proxy) since i am newbie to this environment. It would be great if some one can explain me this or even provide me a new command.
Thanks!
Noooo! Please, don't use mod_cluster 1.0.10 unless you absolutely have to. If it is the case, make sure you are on the latest version of the maintenance branch: MOD_CLUSTER_1_0_10_GA_CP
The command you are asking for is this:
http://mydomain/mod_cluster-manager?nonce=YOUR_NONCE&Cmd=DISABLE-APP&Range=CONTEXT&JVMRoute=my-worker-server-1&Alias=alias&Context=/myapp
Explanation:
nonce, yes, it's exactly what they say on wiki in this context. It must be included if CheckNonce is on.
DISABLE-APP is the command that disables one of this resources:
LBgroup Load balancing group
Node (Worker)
Context (a particular app on a particular node)
Range=CONTEXT picks the last of the aforementioned three choices.
JVMRoute marks a particular node
Context marks a particular context on the selected node
Alias if there are more aliases-virtual servers on the node, select the right one. Leave it e.g. alias if you have only one server per node...doesn't matter.
HTH
karm

Setting Domain Credential during WebLogic WLST offline domain creation?

I have successfully created WLS 10.3.5 domains using offline WLST, along the lines of readTemplate(template); set("name","DomainName"); ...
One detail remains: I need to set the "Credential" of each domain to a common random value, across all domains, for "global trust". It's the setting that's behind Console / Domain / Security / General / Advanced / "Credential"
Question: I fail to find the property (or its location?) that one needs to set for this?
FWIW, I use post-processing on config.xml file level now to inject an encrypted common value string as <credential-encrypted> , but I'd rather just set this via WLST without tweaking the resulting XML.
Thanks in advance,
Matthias
I suggest you to use createDomain() command it will be much easy to work.
createDomain('/olddoamin/path/template.jar’,’domainPath’,’user’, ‘passwd’)
For more you can see the following link:
WLST by Examples: Domain migration made simple
As you told your navigation on the console, I found on WLST navigation property location it is having in the followingpath:
wls:/offline/mydomain/SecurityConfiguration/mydomain>ls()
-rw- CredentialEncrypted ????????
It is with -rw- so you can update it right?
Hope this will help you.
Right, this works. The key is to not work on the template, but to read the doman from its domain directory. Then it's just setting the attribute CredentialEncrypted:
readDomain(domain_dir)
cd('/SecurityConfiguration/' + 'domain_name)
set('CredentialEncrypted', encrypt(shared_credential,domain_dir))
updateDomain()
closeDomain()
shared_credential should be something random. I used a hex-encoded digest of the newly-created config.xml file, which contains enough randomness.