Graphite server shows blank kafka metrics while using collectd JMX and java plugin - apache-kafka

I am using collectd JMX and java plugin to gather kafka metrics and write to graphite server. When I run the command to see kafka metrics from the node it shows the data but when I use collectd plugin blank metrics are exported. Any idea if I am missing some configuration. Below is the sample code snipped

try this,
<Plugin java>
JVMARG "-Djava.class.path=/usr/share/collectd/java/collectd-api.jar‌​:/usr/share/collectd‌​/java/generic-jmx.ja‌​r"
LoadPlugin "org.collectd.java.GenericJMX"
<Plugin "GenericJMX">
<MBean "kafka-all-messages">
ObjectName "kafka.server:type=BrokerTopicMetrics,name=MessagesInPerSec"
<Value>
Type "counter"
Table false
Attribute "Count"
</Value>
</MBean>
<Connection>
ServiceURL"service:jmx:rmi:///jndi/rmi://localhost:2999/jmxr‌​mi"
Host "localhost"
Collect "kafka-all-messages"
</Connection>
</Plugin>
</Plugin>

Related

DB2 driver settings in Websphere Liberty

I have application running in Websphere Liberty and uses DB2 in Z/oS. I have set the db2 driver proerties in DB2JCCConfiguration.properties .How can make sure that the server has picked up properties I have set .I am not sure how to verify the trace to see if the properties are applied to server
To configure a datasource (for any backend DB) with Liberty, you can add configuration like this to your server.xml:
<featureManager>
<feature>jdbc-4.2</feature>
</featureManager>
<library id="driver-library">
<fileset dir="/path/to/driver/dir" includes="*.jar"/>
</library>
<dataSource id="DefaultDataSource" jndiName="jdbc/myDB">
<jdbcDriver libraryRef="driver-library"/>
<properties.db2.jcc serverName="example.db.hostname.com" portNumber="50000"
databaseName="myDB"
user="exampleUser"
password="examplePassword"
currentSchema="xyz"
fullyMaterializeInputStreams="true"/>
</dataSource>
To test if your configuration is correct and that your Liberty server can connect to your DB2 database, add the following configuration:
<featureManager>
<feature>appSecurity-3.0</feature>
<feature>restConnector-2.0</feature>
<feature>jdbc-4.2</feature>
</featureManager>
<!-- Any security mechanism can be used, <quickStartSecurity> is the simplest -->
<quickStartSecurity userName="admin" userPassword="admin"/>
And then go to: https://localhost:9443/ibm/api/validation/dataSource/DefaultDataSource
(this assumes your <dataSource> id is DefaultDataSource)
For more info, see this cheat sheet: https://aguibert.github.io/openliberty-cheat-sheet/#_ibm_db2

How to enable failover for a postgresql jdbc data source

I have a data source defined in a Liberty application server for postgresql
<dataSource jdbcDriverRef="PostgreSQLDriver" ...>
<properties password="..." user="admin" serverName="server" portNumber="2020" databaseName="dbname" ssl="false"
</dataSource>
I see that I can enable failover on a jdbc connection by specifying a url like:
jdbc:postgresql://host1:port,host2:port,host3:port/dbname
Is there any way that this failover url can be provided to a application server datasource?
Yes, you can specify any key/value pair on the <properties> element and Liberty will supply it to the vendor data source class. In this case, the property would be URL="jdbc:postgresql://host1:port,host2:port,host3:port/dbname"
Also, note that in more recent versions of Liberty, there is a properties.postgresql which is specific to Postgres and better documents the available settings for it.
Here is an example,
<dataSource jdbcDriverRef="PostgreSQLDriver" ...>
<properties.postgresql password="..." user="admin" URL="jdbc:postgresql://host1:port,host2:port,host3:port/dbname" ssl="false"
</dataSource>

Hazelcast Kubernetes plugin is not defined

I`m trying to create an OrientDB (version 3.0.10) cluster using Kubernetes. OrientDB uses Hazelcast (version 3.10.4) in its distributed mode that is why I hat to set up KubernetesHazelcast plugin. I used this repository as an example.
I have created all the necessary configuration files, I have defined hazelcast Kubernetes dependency (version 1.3.1) in build.sbt file for my project and this dependency appeared in the classpath
However, the logs on each pod show this error message:
com.orientechnologies.orient.server.distributed.ODistributedStartupException: Error on starting distributed plugin
Caused by: com.hazelcast.config.properties.ValidationException: There is no discovery strategy factory to create 'DiscoveryStrategyConfig{properties={service-dns=orientdbservice2.default.svc.cluster.local, service-dns-timeout=10}, className='com.hazelcast.kubernetes.HazelcastKubernetesDiscoveryStrategy', discoveryStrategyFactory=null}' Is it a typo in a strategy classname? Perhaps you forgot to include implementation on a classpath?
So it looks like the Hazelcast Kubernetes dependency is set up in a worng way. How can this error be fixed?
Here is my config hazelcast.xml file:
<properties>
<property name="hazelcast.discovery.enabled">true</property>
</properties>
<network>
<join>
<multicast enabled="false"/>
<tcp-ip enabled="false" />
<discovery-strategies>
<discovery-strategy enabled="true"
class="com.hazelcast.kubernetes.HazelcastKubernetesDiscoveryStrategy">
<properties>
<property name="service-dns">orientdbservice2.default.svc.cluster.local</property>
<property name="service-dns-timeout">10</property>
</properties>
</discovery-strategy>
</discovery-strategies>
</join>
</network>
For the cluster creation, I use StatefulSet with OrientDB image and mount all the config files as config maps. I am pretty sure that the problem is not in my config files as with multicast instead of the dns strategy everything works fine. Also, there are no network problems in the Kubernetes cluster itself.
First of all, OrientDB version should be updated to the latest - 3.0.10 with embedded newest Hazelcast version. Also, I have mounted hazelcast-kubernetes.jar dependency file directly into /orientdb/lib folder and it started to work properly. HazelcastKubernetes plugin is discovered and nodes join the cluster:
INFO [172.17.0.3]:5701 [orientdb-test-cluster-1] [3.10.4] Kubernetes Discovery activated resolver: DnsEndpointResolver [DiscoveryService]
INFO [172.17.0.3]:5701 [orientdb-test-cluster-1] [3.10.4] Activating Discovery SPI Joiner [Node]
INFO [172.17.0.3]:5701 [orientdb-test-cluster-1] [3.10.4] Starting 2 partition threads and 3 generic threads (1 dedicated for priority tasks) [OperationExecutorImpl]
Members {size:3, ver:3} [
Member [172.17.0.3]:5701 - hash
Member [172.17.0.4]:5701 - hash
Member [172.17.0.8]:5701 - hash
]

Issue enabling jpa and jdbc in Websphere Liberty

I am following these exercises for learning Liberty.
I am having an issue in he Lab 3 - Module 2.2 Liberty and JPA (DB2) .
After setting all the JDBC and Data Source details, i restart the server and i do not see the two lines that mention the dataSource and jdbd driver.
[AUDIT] J2CA8004I : The dataSource DB2Connection is avilable as jdbc/DB2Connection.
[AUDIT] J2CA8000I : The jdbcDriver my JDBCDriver is available.
How can i know if the jpa and jdb features ae correctly set?
This is the server.xml
<!-- Enable features -->
<featureManager onError="WARN">
<feature>jsp-2.2</feature>
<feature>jpa-2.0</feature>
<feature>jdbc-4.0</feature>
</featureManager>
<!-- To access this server from a remote client add a host attribute to the following element, e.g. host="*" -->
<httpEndpoint id="defaultHttpEndpoint"
httpPort="9080"
httpsPort="9443" />
<jdbcDriver id="myJDBCDriver">
<library name="DB2Lib">
<fileset dir="C:\wlp\db2jdbc" includes="db2jcc4.jar, db2jcc_license_cu.jar"></fileset>
</library>
</jdbcDriver>
<dataSource jndiName="jdbc/DB2Connection" id="DB2Connection"
jdbcDriverRef="myJDBCDriver">
<properties.db2.jcc databaseName="SAMPLE" serverName="igacloud" password="{xor}FhgeOz1tPj08" user="db2admin"></properties.db2.jcc>
</dataSource>
Unlike Classic WebSphere, which has a "test connection" capability in its admin console (datasource panel), there is no equivalent means with WebSphere Liberty yet. Have you tried testing the connection with a simple "Hello World" JPA application?
The CWWKF0012I message is simply confirming what features have been enabled - some features depend on other features and automatically enables them, which is why you see more features than defined in your server.xml.

JBoss EAP 6 configure single server for remote debugging in domain mode

I have Domain controller, one Host controller and one server running in the same machine.
I'm using IDEA to connect to the remote server for debugging but it's not stopping on break points even though it's running the code (i've verified with system outs).
I've enabled HOST_CONTROLLER_JAVA_OPTS and PROCESS_CONTROLLER_JAVA_OPTS for remote debugging in $JBOSS_HOME/bin/domain.conf:
# Sample JPDA settings for remote socket debuging.
PROCESS_CONTROLLER_JAVA_OPTS="$PROCESS_CONTROLLER_JAVA_OPTS -Xrunjdwp:transport=dt_socket,address=8788,server=y,suspend=n"
HOST_CONTROLLER_JAVA_OPTS="$HOST_CONTROLLER_JAVA_OPTS -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"
When i start JBoss server i can see from netstat that it's properly listening to ports 8787 and 8788. If i list the processes running in the system i can see one for Domain controller, one for Host controller and one for the server (server1). Domain and Host controllers have the debug options specified in their launch properties but they're missing for server1.
I've been looking at the various XML, .conf and .sh files for a while now but i can't figure out how i could specify server1 to use the remote debugging options. Is there a way to remotely debug a single server in domain mode?
JHollanti maybe you are missing some compiler flags (like "lines,vars,source") to allow remote debugging.
For example, is you are using Ant you need to add this lines to your javac:
<!-- Javac lines, vars, source compiler flags -->
<javac srcdir="..." destdir="..." classpathref="..." debug="true" debuglevel="lines,vars,source" />
Then in your execution script you jave to add:
<!-- debug configurations: modify the port you want-->
<jvmarg value="-Xdebug"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=4060"/>
On the other hand, if you are using Maven same flags can be added in the , like this:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<!-- Necessary in order for the debug levels to be considered-->
<debug>true</debug>
<debugLevel>lines,vars,source</debugLevel>
</configuration>
</plugin>
</plugins>
</build>
In case of using Jetty, same as before... you need to have the following variable:
export MAVEN_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=n"
On the other hand, what you can check is setting the suspend flag in yes, it is "suspend=y". This won't start your app unless you connect a debugger.
Here you can check specific info about jboss:
http://webdev.apl.jhu.edu/~jcs/ejava-javaee/coursedocs/605-784-site/docs/content/html/devenv-jboss-setup.html#enable-jboss-debug
Hope to help
Hey I don't have a solution to this however I was able to set the port for server one along with host and process controllers as well.
How I did it : I added the "-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n" to the JVM arguments on the jboss admin console.
Steps:
1) Login to admin console of jboss => localhost:9990/console
2) go to servers => select server 1 in the table.
3) Then add the debug string into JVM arguments text box.
Once you restart your server you'll see now the server one is listening on this port.
However problem came when I tried to run my eclipse in debug mode. Though on the sever I could see the connection was established through netstat however eclipse is not able to communicate to server 1 and it times out.
Important thing to be noticed is I'm able to run eclipse in debug mode if I do what you did in domain.conf file and use those ports; however then the control never comes to my breakpoint in eclipse.
You can enable remote debugging by adding jvm-options in $JBOSS_HOME$\domain\configuration\hosts.xml
Add the following configuration under <servers> -> <server> -> <jvm>
<jvm-options>
<option value="-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"/>
</jvm-options>
your server configuration in hosts.xml should look something similar to this
<servers>
<server name="Server1" group="Group1" auto-start="true">
<jvm name="Server1_JVM" debug-enabled="false">
<heap size="2048m" max-size="4096m"/>
<jvm-options>
<option value="-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"/>
</jvm-options>
</jvm>
<socket-bindings socket-binding-group="full-ha-sockets" port-offset="100"/>
</server>
</servers>
Hope this helps!