StephenOTT / Camunda-Monitoring

Monitor anything you can query in a Camunda BPM engine. Monitor KPIs, metrics, and any business performance
28 stars 10 forks source link

error starting Camunda-Monitoring #14

Open fernandoscruz opened 3 years ago

fernandoscruz commented 3 years ago

I am making a mistake when going up the camunda monitoring.

Can someone help me?

My conf default.yml: spring.datasource: url: jdbc:mysql://mysql:3306/process-engine driver-class-name: com.mysql.cj.jdbc.Driver username: camunda password: "xxxxxx"

Log erro:

2021-05-24 18:30:08.714 ERROR 9 --- [ main] org.camunda.bpm.engine.context : ENGINE-16004 Exception while closing command context: historyLevel mismatch: configuration says HistoryLevelFull(name=full, id=3) and database says HistoryLevelNone(name=none, id=0)

2021-05-24 18:30:08.716 WARN 9 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'camundaMonitoringMetrics': BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'scriptedObject.camundaMonitoringMetrics': Unsatisfied dependency expressed through field 'processEngine'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'processEngineFactoryBean': FactoryBean threw exception on object creation; nested exception is org.camunda.bpm.engine.ProcessEngineException: historyLevel mismatch: configuration says HistoryLevelFull(name=full, id=3) and database says HistoryLevelNone(name=none, id=0)

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.

2021-05-24 18:30:08.804 ERROR 9 --- [ main] o.s.boot.SpringApplication : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'camundaMonitoringMetrics': BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'scriptedObject.camundaMonitoringMetrics': Unsatisfied dependency expressed through field 'processEngine'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'processEngineFactoryBean': FactoryBean threw exception on object creation; nested exception is org.camunda.bpm.engine.ProcessEngineException: historyLevel mismatch: configuration says HistoryLevelFull(name=full, id=3) and database says HistoryLevelNone(name=none, id=0)

Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'scriptedObject.camundaMonitoringMetrics': Unsatisfied dependency expressed through field 'processEngine'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'processEngineFactoryBean': FactoryBean threw exception on object creation; nested exception is org.camunda.bpm.engine.ProcessEngineException: historyLevel mismatch: configuration says HistoryLevelFull(name=full, id=3) and database says HistoryLevelNone(name=none, id=0)

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'processEngineFactoryBean': FactoryBean threw exception on object creation; nested exception is org.camunda.bpm.engine.ProcessEngineException: historyLevel mismatch: configuration says HistoryLevelFull(name=full, id=3) and database says HistoryLevelNone(name=none, id=0)

StephenOTT commented 3 years ago

2021-05-24 18:30:08.714 ERROR 9 --- [ main] org.camunda.bpm.engine.context : ENGINE-16004 Exception while closing command context: historyLevel mismatch: configuration says HistoryLevelFull(name=full, id=3) and database says HistoryLevelNone(name=none, id=0)

Based on the error above you need to set your default.xml to have the same history level as your db. The DB config says history level is 0.

see: https://docs.camunda.org/manual/latest/user-guide/spring-boot-integration/configuration/#camunda-engine-properties

config: camunda.bpm.history-level

fernandoscruz commented 3 years ago

I'm sorry for the inconvenience, but it's still unclear where I should fix it.

What should I include in the default.xml file?

Thank you very much

@StephenOTT

fernandoscruz commented 3 years ago

@StephenOTT

I believe I have found a bug.

When including "TRACE_LEVEL_FILE = 0; DB_CLOSE_ON_EXIT = FALSE" in the URL configuration, unknown database error:

ERROR 9 --- [main] org.camunda.bpm.engine.cfg: ENGINE-12012 Exception on accessing the database connection: Unknown database 'camunda_mysql_azul; TRACE_LEVEL_FILE = 0; DB_CLOSE_ON_EXIT = FALSE'

When removing "TRACE_LEVEL_FILE = 0; DB_CLOSE_ON_EXIT = FALSE" from the configuration, historylevel error:

configuration says HistoryLevelFull (name = full, id = 3) and database says HistoryLevelNone (name = none, id = 0)

My complete setup is:

spring.datasource: url: jdbc: mysql: //camundamys-01-xxxx.dev.mysql.xxxxxx.com: 3306 / camunda_mysql_azul; TRACE_LEVEL_FILE = 0; DB_CLOSE_ON_EXIT = FALSE driver-class-name: com.mysql.cj.jdbc.Driver username: u_prometheus password: Xxxxxxx

Thanks

StephenOTT commented 3 years ago

Did you set your default.yml to have the property: camunda.bpm.history-leve: NONE?

are you familiar with Java and/or springboot?

fernandoscruz commented 3 years ago

Hi @StephenOTT

I don't have much affinity for Java and / or springboot.

I'll explain my plan to you.

I currently have a camunda in production and I would like to export metrics to prometheus, and I discovered your project.

I use a similar project to connect to gitlab and export metrics, I imagine your project has the same goal.

So, I used your project to start a new application that connects to the existing camunda database.

I'll post all the settings in the dockerfile and default.yml, in case you can help me.

Thank you very much.

fernandoscruz commented 3 years ago

My Dockerfile

FROM camunda/camunda-bpm-platform:run-latest

COPY ./Camunda-Monitoring.jar /camunda/configuration/userlib/Camunda-Monitoring.jar
COPY ./metrics /metrics
COPY ./camunda-monitoring-beans.xml /camunda/configuration/camunda-monitoring-beans.xml
COPY ./default.yml /camunda/configuration/default.yml

EXPOSE 8080

My default.yml

spring.datasource:
  url: jdbc:mysql://192.168.1.6:3306/process-engine
  driver-class-name: com.mysql.cj.jdbc.Driver
  username: camunda
  password: "123456"

  task:
    scheduling:
      pool:
        size: 3

management:
  endpoints:
    web:
      exposure:
        include: prometheus
  metrics:
    enable:
      jvm: false
      hikaricp: false
      process: false
      logback: false
      tomcat: false
      system: false
      jdbc: false
      http: false

camunda:
  bpm:
    #    metrics:
    #      monitoringBeansXml: file:/camunda/configuration/camunda-monitoring-beans.xml
    history-level: NONE
    job-execution:
      enabled: false

Error:

2021-05-27 13:11:27.855 ERROR 10 --- [ main] org.camunda.bpm.engine.context : ENGINE-16004 Exception while closing command context: An exception occurred in the persistence layer. Please check the server logs for a detailed message and the entire exception stack trace.

### Error flushing statements. Cause: org.apache.ibatis.executor.BatchExecutorException: org.camunda.bpm.engine.impl.persistence.entity.JobEntity.updateEverLivingJob (batch index #2) failed. 1 prior sub executor(s) completed successfully, but will be rolled back. Cause: java.sql.BatchUpdateException: Unknown column 'FAILED_ACT_ID_' in 'field list'

java.sql.SQLSyntaxErrorException: Unknown column 'FAILED_ACT_ID_' in 'field list