MQ PCFParameter returning different values for Linux and Windows - vb.net

When using IBM PCF Messages to monitor a queue, getting values of Input Count (MQIA_OPEN_INPUT_COUNT), it works perfectly for MQ Servers installed in Windows environment, but not for Linux. Not sure if it is a code or environment issue.
If we connect to a Windows service and perform que query there are more parameters in the response if compared to the Linux.
Same code, different results. Not sure if it is a configuration on the Channel, permissions or any other environment issue. On both MQ Servers the queues are local.
I've tried using IBM.WMQ.MQC.MQCMD_INQUIRE_Q_STATUS, with no success. Didn't find any workaround to get MQIA_OPEN_INPUT_COUNT.
PCFMessages documentation is very limited, so I didn't find anything related to this problem at MQIA_OPEN_INPUT_COUNT documentation:
https://www.ibm.com/support/knowledgecenter/en/SSFKSJ_7.5.0/com.ibm.mq.ref.adm.doc/q087810_.htm
Any idea of how to solve this?
Public Function GetQtyQConnections(ByVal MQQueueName As String) As Integer
Dim queueManager As IBM.WMQ.MQQueueManager = Nothing
queueManager = New IBM.WMQ.MQQueueManager(AppSettings("MQQueueManagerName"), AppSettings("MQChannelName"), AppSettings("MQConnectionName"))
Dim oPCFMessageAgent As IBM.WMQ.PCF.PCFMessageAgent = New IBM.WMQ.PCF.PCFMessageAgent
oPCFMessageAgent.Connect(queueManager)
Dim pcfMsg As IBM.WMQ.PCF.PCFMessage = New IBM.WMQ.PCF.PCFMessage(IBM.WMQ.MQC.MQCMD_INQUIRE_Q)
pcfMsg.AddParameter(IBM.WMQ.MQC.MQCA_Q_NAME, MQQueueName)
Dim pcfResponse() As IBM.WMQ.PCF.PCFMessage = oPCFMessageAgent.Send(pcfMsg)
Dim pcfResponseLen As Integer = pcfResponse.Length
Dim inputcount As Integer = -1
For i As Integer = 0 To pcfResponseLen - 1
Dim oParams() As IBM.WMQ.PCF.PCFParameter = pcfResponse(i).GetParameters
For Each oParam As IBM.WMQ.PCF.PCFParameter In oParams
Select Case oParam.Parameter
Case IBM.WMQ.MQC.MQIA_OPEN_INPUT_COUNT
inputcount = Integer.Parse(oParam.GetValue())
End Select
Next
Next
Return inputcount
End Function
On Windows:
---------------
2016-QUEUENAME
20-1
134--3
2027-2018-03-12
2028-13.59.40
2019-
22-0
2030-
2029-
2124-
96-0
95-0
98--3
2004-2018-03-12
2005-13.59.40
3-0
2119-
61-0
6-0
5-1
184-1
188-0
4-2
7-1
2013-
34-0
9-0
8-1
272-2
2008-
17-0
15-5000
13-104857600
123--3
16-0
24-0
78-0
18-0
2012-
10-0
190-0
40-80
41-20
43-0
44-0
42-1
46-0
54-999999999
21-999999999
45-1
23-1
128--3
2023-
29-1
26-0
28-1
12-0
On Linux:
---------------
2016-QUEUENAME
20-6
2027-2019-03-11
2028-17.38.24
2030-
2029-
96-0
95-0
2119-
61-1
6-0
5-1
184-1
2013-QUEUEDESCRIPTION
10-0
2017-QUEUEMANAGER
2018-QUEUENAME
45-1
2024-QUEUEMANAGER

From your output I can see that the queue you have looked at on Windows is a local queue. The second parameter you display (20) is MQIA_Q_TYPE and it has a value of (1) MQQT_LOCAL.
The queue you have looked at on Linux however is a remote queue. It's MQIA_Q_TYPE (20) parameter has a value of (6) MQQT_REMOTE.
There are many differences between local queues and remote queues, and their attributes are quite different. Try using runmqsc and display a few local and remote queues to understand the differences. These differences have not occurred because of the different platform, just because of the different queue type.
You say in your question that on both MQ Servers the queues are local, but I'm afraid that is not what your output is showing.
Also, if you want to use the Inquire Queue command, please be sure you know that OpenInputCount and OpenOutputCount are only shown for local queues, not remote queues.

If your Linux and Windows releases of IBM MQ are at the same version level then you should get the same response parameters returned.
Why don't you format your output so that it is readable to the average human? Nobody will know what you mean by 2016, 2028, etc. (except for me and a few others)
Issues:
You did not specify the "Status Type" for the request. i.e. QUEUE vs HANDLE
You did not specify any attributes for the request.
Have a look at MQListQueueStatus01.java code I posted here: IBM MQ fetch LGETTIME using Java
Finally, why don't you use C# rather than VB? You could simply use all of the Java/MQ/PCF code that I post since C# is a clone of Java (so to speak).

Related

Setting a timeout on webservice consumer built with org.apache.axis.client.Call and running on Domino

I'm maintaining an antedeluvian Notes application which connects to a SAP back-end via a manually done 'Webservice'
The server is running Domino Release 7.0.4FP2 HF97.
The Webservice is not the more recently Webservice Consumer, but a large Java agent which is using Apache soap.jar (org.apache.soap). Below an example of the calling code.
private Call setupSOAPCall() {
Call call = new Call();
SOAPHTTPConnection conn = new SOAPHTTPConnection();
call.setSOAPTransport(conn);
call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
There has been a change in the SAP system which is now taking 8 minutes to complete (verified by SAP Team).
I'm getting an error message as follows:
[SOAPException: faultCode=SOAP-ENV:Client; msg=For input string: "906 "; targetException=java.lang.NumberFormatException: For input string: "906 "]
I found a blog article describing the error message quite closely:
https://thejavablog.wordpress.com/category/jmeter/
and I've come to the hypothesis that it is a timeout message that is returning to my Call object and that this timeout message is being incorrectly parsed, hence the NumberFormat Exception.
Looking at my logs I can see that there is a time difference of 62 seconds between my call and the response.
I recommended that the server setting in the server document, tab Internet Protocols/HTTP/Timeouts/Request timeouts be changed from 60 seconds to 600 seconds, and the http task restarted with
tell http restart
I've re-run the tests and I am getting the same error, and the time difference is still slightly more than 60 seconds, which is not what I was expecting.
I read Michael Rulnau's blog entry
http://www.mruhnau.net/2014/06/how-to-overcome-domino-webservice.html
which points to this APR
http://www-01.ibm.com/support/docview.wss?uid=swg1LO48272
but I'm not convinced that this would apply in this case, since there is no way that IBM would know that my Java agent is in fact making a Soap call.
My current hypothesis is that I have to use either the setTimeout() method on
org.apache.axis.client.Call
https://axis.apache.org/axis/java/apiDocs/org/apache/axis/client/Call.html
or on the org.apache.soap.transport.http.SOAPHTTPConnection
https://docs.oracle.com/cd/B13789_01/appdev.101/b12024/org/apache/soap/transport/http/SOAPHTTPConnection.html
and that the timeout value is an apache default, not something that is controlled by the Domino server.
I'd be grateful for any help.
I understand your approach, and I hope this is the correct one to solve your problem.
Add a debug (console write would be fine) that display the default Timeout then try to increase it to 10 min.
SOAPHTTPConnection conn = new SOAPHTTPConnection();
System.out.println("time out is :" + conn.getTimeout());
conn.setTimeout(600000);//10 min in ms
System.out.println("after setting it, time out is :" + conn.getTimeout());
call.setSOAPTransport(conn);
Now keep in mind that Dommino has also a Max LotusScript/Java execution time, check this value and (at least for a try) change it: http://www.ibm.com/support/knowledgecenter/SSKTMJ_9.0.1/admin/othr_servertasksagentmanagertab_r.html (it's version 9 help but this part should be identical)
I've since discovered that it wasn't my code generating the error; the default timeout for the apache axis SOAPHTTPConnetion is 0, i.e. no timeout.

How to monitor GlassFish thread pool via asadmin interface

I'm trying to use the asadmin interface to monitor a thread-pool on GlassFish 3.1.1. I'm executing the following command:
asadmin get -m server.network.my-listener.thread-pool.*
and I'm getting data back, but most of it has lastsampletime = -1 (so the related data is zero; and is worthless).
Note: I've also tried the REST interface, which I believe asadmin delegates to, and the JMX interface. Same problem: much of the data has lastsampletime = -1.
I've already turned monitoring to HIGH for all modules. What am I missing?
It seems like redeploying my application was necessary for the monitoring to actually get values. Perhaps I interpreted the manual incorrectly but it seems to suggest that a restart/redeploy wouldn't be required:
Oracle GlassFish Server 3.1 Administration Guide
Also, it is weird that the following shows there is no monitoring data:
asadmin get -m server.thread-pools.thread-pool.http-thread-pool.*
Instead you must go through a specific network listener like:
asadmin get -m server.network.http-listener-2.thread-pool.*
It also took me by surprise that enabling thread-pool monitoring IS NOT enough to see thread pool statistics. You must also enable http-service monitoring:
asadmin enable-monitoring
asadmin set server.monitoring-service.module-monitoring-levels.thread-pool=HIGH
asadmin set server.monitoring-service.module-monitoring-levels.http-service=HIGH
That's all you should need to do.
Enable monitoring, set to HIGH, for the http-service module on the DAS, stand-alone instance, or cluster you want to monitor.
Deploy an app to the DAS, stand-alone instance, or cluster and make http-requests.
asadmin get -m *instancename*.network.*listener*.thread-pool.*
Looks like you are monitoring DAS, since you are using asadmin get -m server.network.my-listener.thread-pool.*.
I deployed a simple war to DAS and made a bunch of http requests. I see the corethreads-count and maxthreads-count have last sample time as -1. And the remaining statistics have actual last sample times.
asadmin get -m "server.network.http-listener-1.thread-pool.*"
server.network.http-listener-1.thread-pool.corethreads-count = 0
server.network.http-listener-1.thread-pool.corethreads-description = Core number of threads in the thread pool
server.network.http-listener-1.thread-pool.corethreads-lastsampletime = -1
server.network.http-listener-1.thread-pool.corethreads-name = CoreThreads
server.network.http-listener-1.thread-pool.corethreads-starttime = 1320764890444
server.network.http-listener-1.thread-pool.corethreads-unit = count
server.network.http-listener-1.thread-pool.currentthreadcount-count = 5
server.network.http-listener-1.thread-pool.currentthreadcount-description = Provides the number of request processing threads currently in the listener thread pool
server.network.http-listener-1.thread-pool.currentthreadcount-lastsampletime = 1320765351708
server.network.http-listener-1.thread-pool.currentthreadcount-name = CurrentThreadCount
server.network.http-listener-1.thread-pool.currentthreadcount-starttime = 1320764890445
server.network.http-listener-1.thread-pool.currentthreadcount-unit = count
server.network.http-listener-1.thread-pool.currentthreadsbusy-count = 0
server.network.http-listener-1.thread-pool.currentthreadsbusy-description = Provides the number of request processing threads currently in use in the listener thread pool serving requests
server.network.http-listener-1.thread-pool.currentthreadsbusy-lastsampletime = 1320765772814
server.network.http-listener-1.thread-pool.currentthreadsbusy-name = CurrentThreadsBusy
server.network.http-listener-1.thread-pool.currentthreadsbusy-starttime = 1320764890445
server.network.http-listener-1.thread-pool.currentthreadsbusy-unit = count
server.network.http-listener-1.thread-pool.dotted-name = server.network.http-listener-1.thread-pool
server.network.http-listener-1.thread-pool.maxthreads-count = 0
server.network.http-listener-1.thread-pool.maxthreads-description = Maximum number of threads allowed in the thread pool
server.network.http-listener-1.thread-pool.maxthreads-lastsampletime = -1
server.network.http-listener-1.thread-pool.maxthreads-name = MaxThreads
server.network.http-listener-1.thread-pool.maxthreads-starttime = 1320764890443
server.network.http-listener-1.thread-pool.maxthreads-unit = count
server.network.http-listener-1.thread-pool.totalexecutedtasks-count = 31
server.network.http-listener-1.thread-pool.totalexecutedtasks-description = Provides the total number of tasks, which were executed by the thread pool
server.network.http-listener-1.thread-pool.totalexecutedtasks-lastsampletime = 1320765772814
server.network.http-listener-1.thread-pool.totalexecutedtasks-name = TotalExecutedTasksCount
server.network.http-listener-1.thread-pool.totalexecutedtasks-starttime = 1320764890444
server.network.http-listener-1.thread-pool.totalexecutedtasks-unit = count
Command get executed successfully.
To instantly enable monitoring without restart use enable-monitoring command
enable-monitoring
enable-monitoring --modules jvm=LOW
enable-monitoring --modules thread-pool=HIGH
enable-monitoring --modules http-service=HIGH
enable-monitoring --modules jdbc-connection-pool=HIGH
The trick is that thread-pool and http-service modules must have high level to get monitoring info.
For more info refer https://docs.oracle.com/cd/E26576_01/doc.312/e24928/monitoring.htm#GSADG00558

Start a service from another computer

I have a project in which we would like to do the following :
Install a service that perform several tasks. this would be put on Computer A and B
Another computer C serves as a witness;
At start, only A is running because the work it performs cannot be duplicated;
Should A fail, then B must start. C should be the one that verify is one is running or not;
Sholud A return back up after a fail, then B still runs and A is on stand-by;
Should B then fail, C start A services,
And So On.
Is it possible, if so how ? Both A and B have a SQL server 2008 on them but this part is taken care of for us.
Thanks a lot.
EDIT : I tried stopping a service (that I know is running) and it dosn't seem to work :
Dim path As ManagementPath = New ManagementPath
path.Server = System.Environment.MachineName
path.NamespacePath = "root\CIMV2"
path.RelativePath = "Win32_service.Name='" + strServiceName + "'"
Dim service As ManagementObject = New ManagementObject(path)
Dim temp As ManagementBaseObject = service.InvokeMethod("StopService", Nothing, Nothing)
In this case, strServiceName is "CommunicationInterface" which is a service I recently add and started manually.
I am running under windows 7.
Just set the services to not start automatically and then have the C computer start them as needed using the WMI class Win32_Service. You can also use this class to query if the services are running or not.
Look at the StartService and StopService methods as well as the State property.
Here's some sample code: Service Management in VB.NET
You should look into Windows Server 2008 Failover Clusters. From that page:
A failover cluster is a group of
independent computers that work
together to increase the availability
of applications and services. The
clustered servers (called nodes) are
connected by physical cables and by
software. If one of the cluster nodes
fails, another node begins to provide
service (a process known as failover).
Users experience a minimum of
disruptions in service.

WebDAV & Exchange 2003 - works in debug, fails without

So I have a very weird problem.
I am writing some code in VB.Net under .NET 2.0 which interfaces with MS Exchange 2003. Because of the Exchange 2003 "requirement" I am forced to write this code using WEBDAV.
The code itself is replicating, to some degree, a schedule management process. It's creating Appointments on the Exchange Server in response to inputs from the user and managing it's data internally in a SQL Server database.
The problem situation is this: A new person is assigned to be in charge of a meeting. The requirement says the program should generate a meeting cancellation request to the person removed from the meeting (if such a person existed) and a meeting request sent to the new person.
In the case of there being an existing person, what appears to happen is this:
The meeting cancellation request
gets sent
Exchange barfs and returns status code 500 (internal server error) during the set of
requests which send the meeting request to the new person.
However! While debugging this particular scenario, it works just fine for me, if I step through the code in the Visual Studio debugger. Left to it's own devices, it fails every time.
Just for yuk's sake, I added a Thread.Sleep(500) to the part after sending the cancellation request, and Exchange doesn't barf anymore...
So, my question!
If adding a Thread.Sleep to the code causes this error to go away, a race condition is implied, no? But, my code is running under a web application and is a totally single threaded process, from start to finish. The web requests I am sending are all in synchronous mode so this shouldn't be a problem.
What would I do next to try and track down the issue?
Try and divine if the race condition itself is in the .Net 2.0 BCL networking code?
Try and do some debugging on the Exchange server itself?
Ignore it, be glad the Thread.Sleep masks the problem and keep on going?
Any further suggestions would be wonderful.
In response to comment, I can post the failing function:
Private Shared Sub UpdateMeeting(ByVal folder As String, ByVal meetingId As String, ByVal oldAssignedId As String, ByVal newAssignedTo As String, ByVal transaction As DbTransaction)
If String.IsNullOrEmpty(meetingId) Then
Throw New Exception("Outlook ID for that date and time is empty.")
End If
Dim x As New Collections.Generic.List(Of String)
If oldAssignedId <> newAssignedTo AndAlso Not String.IsNullOrEmpty(oldAssignedId) Then
'send cancellation to old person
Dim lGetCounselorEmail1 As String = GetCounselorEmail(oldAssignedId, transaction)
Common.Exchange.SendCancellation(meetingId, New String() {lGetCounselorEmail1})
' Something very weird here. Running this code through the debugger works fine. Running without causes exchange to return 500 - Internal Server Error.
Threading.Thread.Sleep(500)
End If
x.Add(folder)
If Not String.IsNullOrEmpty(newAssignedTo) Then x.Add(GetCounselorEmail(newAssignedTo, transaction))
x.RemoveAll(AddressOf String.IsNullOrEmpty)
If x.Count > 0 Then
If Not Common.Exchange.UpdateMeetingAttendees(meetingId, x.ToArray()) Then
Throw New Exception("Failure during update of calendar")
End If
End If
End Sub
...but a lot of the implementation details are hidden here, as I wrote a set of classes to interface with Exchange WebDAV.
Ended up sticking with the Sleep and calling it a day.
My 'belief' is that I was erroneous in thinking that a WebRequest/WebResponse combo sent to Exchange through WebDav was an atomic operation.

Finding the Uptime of a server programatically

Does anyone know of a way to programatically find the uptime of a server running Windows 2000? We have a service running on the machine written in VB.NET, that reports back to our server via a webservice.
Another way is to use the performance counters from .NET e.g.
Dim pc As PerformanceCounter = New PerformanceCounter("System", "System Up Time")
pc.NextValue() ' This returns zero for a reason I don't know
' This call to NextValue gets the correct value
Dim ts As TimeSpan = TimeSpan.FromSeconds(pc.NextValue())
So basically, the PerformanceCounter class will return the number of seconds the system has been up and from there you can do what you want.
If you have SNMP enabled, you can query the following OID: 1.3.6.1.2.1.1.3.0. This will give you the system uptime. It is defined as "The time (in hundredths of a second) since the network management portion of the system was last re-initialized."