How to debug a Gravitee API gateway plugin - api

I'm attempting to write a prototype plugin for the Gravitee API gateway. I'd like to be able to use an interactive debugger to allow visibility into the API Gateway JVM. In order to do this, I need to introduce an "-agentlib" command line option onto the java command which runs the gateway. I tried setting the INSTALL4J_ADD_VM_PARAMS in the atom script, but that only seems to get applied to the Launcher JVM, and not to the actual Gateway JVM. I looked through the Gateway config files, but I don't see an obvious way of doing this.

Related

Tracking method for QGIS Plugin Usage

I have a QGIS3 python plugin that I would like to track its users' usage. Is it possible to add a http request to the headers? How can I do it?
The biggest obstacle is that an http request package should be installed (like requests). This easy to do in the osgeo4w shell for a particular installation of QGIS, but it can't be done from within a plugin (as far as I can tell).
However, there's nothing to stop you from inserting requests.post(path,headers,data) into your plugin script files.

build jmeter-parellarel-request-master

I need to write a scenario where we make several calls to an API in parallel with JMeter. The solution is based on OAuth, where a token is extracted and passed along with every call made to the API. This works fine, however, JMeter has no built-in option to make multiple parallel calls. I could divide them into separate thread groups, but this would not be desired.
Thread group
oauth calls to get token
extract token
api call /getCustomerActions
api call /getCustomerBlabla1..
api call /getCustomerBlabla2..
I've found the following custom sampler by Franz See:
https://github.com/franz-see/jmeter-parellarel-request
As I'm not big on development/compiling, my question would be how do I compile this package and use in in JMeter?
Download and install Apache Maven.
Download latest jmeter-parallel-request release
Unpack downloaded sources and switch to that folder
Invoke maven package command from that folder
Copy file from target/jmeter-parallel-request-xx.jar to JMeter's lib/ext folder
Restart JMeter to pick the plugin up
You can also check out How to Load Test AJAX/XHR Enabled Sites With JMeter guide for alternative solutions.
this plugin seems to work, but using it as a seperate thread group, all extracted values or tokens from other (main) threads are not captured.. too bad

Worklight Analytics, Native Java API, no messages in dashboard

Worklight 6.2.0
Native Worklight App on Samsung Galaxy S4, Android 4.4.2
WLAnalytics.enable();
WLAnalytics.log("some text", new org.json.JSONOBject() );
WLAnalytics.send();
// and also go on to successfully call an adapter
Analytics Dasboard shows the app version and adapter activity. Log Search does not show any application log messages and the dropdown for selecting applications shows "All Applications" only, no sign of my app.
Have I missed some initialisation step? Any other ideas?
** edited to add **
It has been suggested that we should use the method:
WLAnalytics.log("some text");
In our 6.2.0.00 CLI environment there is no such Java method.
The answer is that there a further initialisation requirement that seems to be necessary when working with a pure Native application, these are typically build using the Worklight CLI tooling.
This is the initialisation, note the call to Logger.setContext()
WLAnalytics.enable();
Logger.setContext(this);
Then this works
WLAnalytics.log("My test message2", new org.json.JSONObject());
It's worth noting that the call to WLAnalytics.send() is not necessary in normal running as typically the analytic data is buffered and sent as a piggy-back on adapter calls. However while testing a call to send() does help.
Further, if running in an environment where the Analytics WAR is on a separate machine from the Worklight Server WAR there are additional latencies. Hence testing all of this needs care.
For now, I suggest that you just use the WLAnalytics.log(String) method. There are some clear inconsistencies that need to be dealt with whether it be through documentation or code fixes.
The WL.Logger APIs were originally created to send log data to a custom adapter, which is why they take a dictionary/object for extra metadata. The data sent to the custom adapter could be read as a valid JSON object to run operations on the adapter.
The WL.Analytics APIs mimicked the WL.Logger APIs for the same purpose: parsing the JSON on a worklight adapter. The Operational analytics server came as a convenience to intercept and display some of these logs, but not all of them are being captured as you have learned.
Your questions are all valid though, as none of this is described in the documentation. In future releases, we may make use of the extra JSON object passed into the API in the Operational analytics console, but for right now they only serve their original purpose of sending the analytics to a custom adapter.

Capture web driver network traffic across all browsers

I want to capture all the network calls from Web Driver in Java. I am not doing any UI testing, just testing JS execution and, requests and responses of some network calls.
I tried using Browser Mob as is suggested in most forums, but I need it to work across all browsers. It worked flawlessly with Firefox, but I was facing some issues with the others. Safari driver doesn't event support a Proxy capability.
I don't want to use Fiddler as it involves some manual steps around invoking and storing the calls. Whereas, Browser Mob being an in-code proxy can be integrated in a more smoother fashion.
I also tried using the RC-like package included in Selenium standalone server package. But, I have some HTTPS calls and some nested iframes in cross domains. I am particularly interested in some cross domain POST call and it doesn't work out that well. Also, people keep saying it's not recommended to use that package.
So, I had a solution where we can use a standalone proxy server running on a machine. Using host entries, we'll point Web Driver to hit the proxy instead of the actual server. The proxy will record all the incoming calls and route them to the actual server host. Later, I can make a request to the proxy which will return me all the calls it intercepted. I am not sure whether it's still called a proxy or a router.
I came across TCPmon, but it's no longer being supported. Does anyone know some similar tools that could run on Unix systems or any alternate solutions?
We modified the Fiddler rules script to include a new exec action. If you use their native script editor, it also provide auto complete features and we were comfortably able to get around it. The syntax is similar to that of JavaScript.
The Fiddler package comes with a ExecActions.exe which can be used to pass console arguments to a running Fiddler instance using the command prompt.
The code we wrote processed all the sessions captured by Fiddler and wrote it to a file in a custom JSON format and later used GSON to deserialize it.
Please let me know, if you want further details.

Does Nagios have an API that can control targets?

In Zabbix, there is a well documented (although in Draft status) API for instantiating targets and controlling them. Does such an API exist in Nagios?
The need for this is a cloud-based implementation. I would like to be able to scale monitoring targets dynamically so that on Monday it would be monitoring 10 targets and Tuesday it would be monitoring 15 and down to 8 on Wednesday.
The best way I can figure to do this is to control targets in a programmatic fashion since auto-discovery will probably fail as the nodes are not in the same subnet. Any ideas on how to do this with Nagios?
Nagios does not natively have this ability. I have gotten around this in the past by adding scripts to contact the nagios server and register on first boot and then using nagios to destroy servers either automatically or via user command. These are custom scripts though.
I have also passed through this problem and yes Nagios does not have any kind of Command Line API but I have discovered that NagiosQL has this feature. http://www.nagiosql.org/
There are many advantages for using such a tool but I will not touch this here...
Regarding the command line API, NagiosQL can manage multiple domains through web interface or command line api. Im my opinion this is very useful.