Hi,
I resolve my problem.
I found the same question without response, so this is my solution.
if you have a better say me.
@brian.brazil  : to debug my pattern I add 2 log 

   - one to log the matchname : logger.log(Level.FINE
   ,"matchName:"+matchName);
   - one other to log  the pattern : logger.log(Level.FINE, "-----> 
   pattern:" + rule.pattern.toString())

with this to logs I can check and test  my pattern with the real data.

to export the datasource information from *catalina * :
- pattern: 'Catalina<type=DataSource, class=javax.sql.DataSource, 
name="(.*)"><>(maxIdle|minIdle|maxWait|active|size|idle|createdCount|initialSize|reconnectedCount|maxAge|maxActive|releasedIdleCount|releasedCount):'
  name: tomcat_dataSource_$2
  labels:
    datasource_name: "$1"
  help: Tomcat datasource $2
  type: GAUGE

to export the datasource information from *tomcat.jdbc * :  
- pattern: 'tomcat.jdbc<name=\"(.*)\", type=ConnectionPool, 
class=org.apache.tomcat.jdbc.pool.DataSource><>(MaxIdle|MinIdle|MaxWait|Active|Size|Idle|CreatedCount|InitialSize|ReconnectedCount|MaxAge|MaxActive|ReleasedIdleCount|ReleasedCount):'
  name: tomcat_jdbc_$2
  labels:
    datasource_name: "$1"
  help: Tomcat jdbc $2
  type: GAUGE

Pascal
Le mardi 26 janvier 2021 à 09:54:53 UTC+1, Pascal BEN -BTWIN VILLAGE LILLE- 
a écrit :

> Hi,
>
> I want to export datasource metric, I try many pattern without success
>
> This the list of patterns than I try :
> # pattern: 'Catalina<type=DataSource, 
> name="(\w+-\w+)"><>(maxIdle|minIdle|maxWait|active|size|idle|createCount|initialSize|reconnectedCount|maxAge|maxActive|releasedIdleCount|releaseCount):'
>  
> # JMX Bean: Catalina:type=DataSource, context=[context 
> name],host=[hostname],class=javax.sql.DataSource,name="[JNDI name]" # 
> Catalina:type=DataSource,class=javax.sql.DataSource,name="jdbc/fwk" #- 
> pattern: 'Catalina<type=DataSource, context="javax.sql.DataSource", 
> host="(\w+)"><>(maxIdle|minIdle|maxWait|active|size|idle|createCount|initialSize|reconnectedCount|maxAge|maxActive|releasedIdleCount|releaseCount):'
>  
> # pattern: 
> 'Catalina<type=DataSource,class=javax.sql.DataSource,host=([-a-zA-Z0-9+&@#/%?=~_|!:.,;]*[-a-zA-Z0-9+&@#/%=~_|]),name="(\w+),context=(\w+)"><>(maxIdle|minIdle|maxWait|active|size|idle|createCount|initialSize|reconnectedCount|maxAge|maxActive|releasedIdleCount|releaseCount):'
>  
> # pattern: 'Catalina<type=DataSource, 
> context=(.*),host=(.*),class=javax.sql.DataSource,name="(.*)"><>(maxIdle|minIdle|maxWait|active|size|idle|createCount|initialSize|reconnectedCount|maxAge|maxActive|releasedIdleCount|releaseCount):'
>  
> - pattern: 
> 'Catalina<type=DataSource,class=javax.sql.DataSource,name="(.*)"><>(maxIdle|minIdle|maxWait|active|size|idle|createCount|initialSize|reconnectedCount|maxAge|maxActive|releasedIdleCount|releaseCount):'
>  
> name: tomcat_dataSource_$2 labels: name=: $1 help: Tomcat datasource $1 
> type: GAUGE 
>
> and an example of the ObjectName  read on Jconsole :  
> Catalina:type=DataSource,class=javax.sql.DataSource,name="jdbc/fwk"
>
> Somebody can help me ?  
>
> thank's,
> Pascal
>

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/5ff1426d-7b45-413d-bb7f-cac9b4572dfan%40googlegroups.com.

Reply via email to