• J
    jmatesanz

    Hello,

    The problem I found is when you connect with a MSSQL data base and there is not connection with it. Then you cannot disable all the data sources and you cannot import a json configuration of data sources. When there is connection with the data base the behaivour is correct.

    I´m working whit Mango v3.6.4.

    The configuration of mi data source is an SQL data source :
    {
    "dataSources":[
    {
    "xid":"DS_SQL_KINEO_status",
    "name":"SQL_status",
    "enabled":true,
    "type":"SQL",
    "alarmLevels":{
    "POLL_ABORTED":"URGENT",
    "STATEMENT_EXCEPTION":"URGENT",
    "DATA_SOURCE_EXCEPTION":"URGENT"
    },
    "purgeType":"YEARS",
    "updatePeriods":1,
    "updatePeriodType":"MINUTES",
    "connectionUrl":"jdbc:sqlserver://10.120.50.24:1433;databaseName=master;",
    "driverClassname":"com.microsoft.sqlserver.jdbc.SQLServerDriver",
    "password":"password",
    "rowBasedQuery":false,
    "selectStatement":"",
    "useMangoDatabase":false,
    "username":"username",
    "quantize":false,
    "useCron":false,
    "editPermission":"",
    "purgeOverride":false,
    "purgePeriod":1
    }
    ],
    "dataPoints":[
    ]
    }
    The driver I use is in this link: https://docs.microsoft.com/en-us/sql/connect/jdbc/download-microsoft-jdbc-driver-for-sql-server?view=sql-server-ver15
    I´m using mssql-jdbc-8.4.1.jre8.jar

    I paste part of the ma.log:

    INFO 2020-10-19T00:05:00,022 (com.serotonin.m2m2.rt.maint.work.BackupWorkItem.execute:101) - Starting backup WorkItem.
    INFO 2020-10-19T00:05:00,022 (com.serotonin.m2m2.rt.maint.work.DatabaseBackupWorkItem.execute:108) - Starting database backup WorkItem.
    INFO 2020-10-19T00:05:00,025 (com.serotonin.m2m2.rt.maint.work.DatabaseBackupWorkItem.createLogOutputStream:224) - Writing backup log to /opt/mango/logs/com.serotonin.m2m2.rt.maint.work.DatabaseBackupWorkItem.log
    INFO 2020-10-19T00:05:11,623 (com.serotonin.m2m2.rt.maint.work.BackupWorkItem.execute:181) - Finished backup WorkItem.
    INFO 2020-10-19T00:24:02,086 (com.serotonin.m2m2.sql.SqlDataSourceRT.initialize:512) - Error while initializing data source
    com.microsoft.sqlserver.jdbc.SQLServerException: No se pudo realizar la conexi�n TCP/IP al host 10.120.50.24, puerto 1433. Error: "connect timed out. Verifique las propiedades de conexi�n, compruebe que hay una instancia de SQL Server ejecut�ndose en el host y aceptando las conexiones TCP/IP en el puerto y compruebe que no hay ning�n firewall bloqueando las conexiones TCP en el puerto.".
    at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:234) ~[mssql-jdbc-8.4.1.jre8.jar:?]
    at com.microsoft.sqlserver.jdbc.SQLServerException.ConvertConnectExceptionToSQLServerException(SQLServerException.java:285) ~[mssql-jdbc-8.4.1.jre8.jar:?]
    at com.microsoft.sqlserver.jdbc.SocketFinder.findSocket(IOBuffer.java:2462) ~[mssql-jdbc-8.4.1.jre8.jar:?]
    at com.microsoft.sqlserver.jdbc.TDSChannel.open(IOBuffer.java:668) ~[mssql-jdbc-8.4.1.jre8.jar:?]
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:2695) ~[mssql-jdbc-8.4.1.jre8.jar:?]
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:2362) ~[mssql-jdbc-8.4.1.jre8.jar:?]
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:2213) ~[mssql-jdbc-8.4.1.jre8.jar:?]
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:1276) ~[mssql-jdbc-8.4.1.jre8.jar:?]
    at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:861) ~[mssql-jdbc-8.4.1.jre8.jar:?]
    at java.sql.DriverManager.getConnection(DriverManager.java:677) ~[java.sql:?]
    at java.sql.DriverManager.getConnection(DriverManager.java:228) ~[java.sql:?]
    at com.serotonin.m2m2.sql.SqlDataSourceRT.initialize(SqlDataSourceRT.java:501) ~[?:?]
    at com.serotonin.m2m2.sql.SqlDataSourceRT.manageConnection(SqlDataSourceRT.java:280) ~[?:?]
    at com.serotonin.m2m2.sql.SqlDataSourceRT.doPoll(SqlDataSourceRT.java:297) ~[?:?]
    at com.serotonin.m2m2.rt.dataSource.PollingDataSource.doPollNoSync(PollingDataSource.java:228) ~[mango-3.6.4.jar:?]
    at com.serotonin.m2m2.rt.dataSource.PollingDataSource.scheduleTimeoutImpl(PollingDataSource.java:183) ~[mango-3.6.4.jar:?]
    at com.serotonin.m2m2.rt.dataSource.PollingDataSource$1.scheduleTimeout(PollingDataSource.java:85) ~[mango-3.6.4.jar:?]
    at com.serotonin.m2m2.util.timeout.TimeoutTask.run(TimeoutTask.java:59) ~[mango-3.6.4.jar:?]
    at com.serotonin.timer.Task.runTask(Task.java:179) ~[mango-3.6.4.jar:?]
    at com.serotonin.timer.TaskWrapper.run(TaskWrapper.java:23) ~[mango-3.6.4.jar:?]
    at com.serotonin.timer.OrderedThreadPoolExecutor$OrderedTaskCollection.run(OrderedThreadPoolExecutor.java:336) ~[mango-3.6.4.jar:?]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[?:?]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[?:?]
    at java.lang.Thread.run(Thread.java:834) [?:?]
    WARN 2020-10-19T00:32:01,135 (com.serotonin.m2m2.rt.dataSource.PollingDataSource.incrementUnsuccessfulPolls:150) - Data Source SQL_KINEO_status aborted 3154 polls since it started.
    INFO 2020-10-19T01:05:17,052 (com.serotonin.m2m2.sql.SqlDataSourceRT.initialize:512) - Error while initializing data source
    com.microsoft.sqlserver.jdbc.SQLServerException: No se pudo realizar la conexi�n TCP/IP al host 10.120.50.24, puerto 1433. Error: "connect timed out. Verifique las propiedades de conexi�n, compruebe que hay una instancia de SQL Server ejecut�ndose en el host y aceptando las conexiones TCP/IP en el puerto y compruebe que no hay ning�n firewall bloqueando las conexiones TCP en el puerto.".
    at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:234) ~[mssql-jdbc-8.4.1.jre8.jar:?]
    at com.microsoft.sqlserver.jdbc.SQLServerException.ConvertConnectExceptionToSQLServerException(SQLServerException.java:285) ~[mssql-jdbc-8.4.1.jre8.jar:?]
    at com.microsoft.sqlserver.jdbc.SocketFinder.findSocket(IOBuffer.java:2462) ~[mssql-jdbc-8.4.1.jre8.jar:?]
    at com.microsoft.sqlserver.jdbc.TDSChannel.open(IOBuffer.java:668) ~[mssql-jdbc-8.4.1.jre8.jar:?]
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:2695) ~[mssql-jdbc-8.4.1.jre8.jar:?]
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:2362) ~[mssql-jdbc-8.4.1.jre8.jar:?]
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:2213) ~[mssql-jdbc-8.4.1.jre8.jar:?]
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:1276) ~[mssql-jdbc-8.4.1.jre8.jar:?]
    at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:861) ~[mssql-jdbc-8.4.1.jre8.jar:?]
    at java.sql.DriverManager.getConnection(DriverManager.java:677) ~[java.sql:?]
    at java.sql.DriverManager.getConnection(DriverManager.java:228) ~[java.sql:?]
    at com.serotonin.m2m2.sql.SqlDataSourceRT.initialize(SqlDataSourceRT.java:501) ~[?:?]
    at com.serotonin.m2m2.sql.SqlDataSourceRT.manageConnection(SqlDataSourceRT.java:280) ~[?:?]
    at com.serotonin.m2m2.sql.SqlDataSourceRT.doPoll(SqlDataSourceRT.java:297) ~[?:?]
    at com.serotonin.m2m2.rt.dataSource.PollingDataSource.doPollNoSync(PollingDataSource.java:228) ~[mango-3.6.4.jar:?]
    at com.serotonin.m2m2.rt.dataSource.PollingDataSource.scheduleTimeoutImpl(PollingDataSource.java:183) ~[mango-3.6.4.jar:?]
    at com.serotonin.m2m2.rt.dataSource.PollingDataSource$1.scheduleTimeout(PollingDataSource.java:85) ~[mango-3.6.4.jar:?]
    at com.serotonin.m2m2.util.timeout.TimeoutTask.run(TimeoutTask.java:59) ~[mango-3.6.4.jar:?]
    at com.serotonin.timer.Task.runTask(Task.java:179) ~[mango-3.6.4.jar:?]
    at com.serotonin.timer.TaskWrapper.run(TaskWrapper.java:23) ~[mango-3.6.4.jar:?]
    at com.serotonin.timer.OrderedThreadPoolExecutor$OrderedTaskCollection.run(OrderedThreadPoolExecutor.java:336) ~[mango-3.6.4.jar:?]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[?:?]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[?:?]
    at java.lang.Thread.run(Thread.java:834) [?:?]

    Thanks in advance!!

    posted in Mango feedback read more
  • J
    jmatesanz

    Hello, Thanks for your replies, I tried @Ralf suggestion and I think is all right. Thanks!

    posted in How-To read more
  • J
    jmatesanz

    Hello everyone,

    I want to known the connectivity of the devices connected to Mango, for example if one device is connected by http retrieve ,SNMP or Modbus data source.

    I explain how I am doing this:

    I configure a virtual data source call "status" and I add numeric value data points to trace connectivity of each device. Then in the event handler I set status set point to zero when a communication expection is active (for example, data source exception or data retrieval failure), then when the exception is inactive I set the status to one.

    This solution is all right but when I start Mango only for the first time I don´t know the connectivity of the devices and I have to put with a Script this status to one , then wait to set the real status of the devices if there is a exception communication. Or if a add a data source to Mango I manually set this status to one.

    But there is a trouble in some cases. For example If there is no communication with the device and I restart Mango and meanwhile in the restart proccess the device start to communicate. When the startup process is finish the exception communication is not active and then the status is zero and mistmach with the real communication status.

    I think I can fix this running the script that set all the status point to one in the start-up system event but I don´t know if this is the best solution.

    After this extensive explanation... My question is: There is another way to know the connected devices to Mango or I am doing good this way?

    Comments or suggestions are welcome.

    Thanks!

    posted in How-To read more