Forum Discussion

Kiyoshi_Egawa's avatar
10 months ago
Solved

SAP HANA Connection Error

Here are logs of SAP HANA test script. I set properties as hana.user,hana.pass and hana.dbnames. I want to set port number clearly but I cloud not find such property. In the logs the part of port number is “1692041235”. It should be 443. I may need to handle “hana.${instanceName.trim()}.url” in script.

How can I collect this problem ?

[2023-08-03 17:12:47.998 JST] [MSG] [INFO] [PollNow-38-2::testscript:Test:datasource:embed:XXXXXX.hana.prod-jp10.hanacloud.ondemand.com:1692041235] [PollNowScriptExecutor.execute:90] Start to execute the poll now test script, CONTEXT=host=XXXXXX.hana.prod-jp10.hanacloud.ondemand.com, timeout=50, type=embed, argument=, scriptName=
[2023-08-03 17:12:48.079 JST] [MSG] [INFO] [collector-discover-thread-4-38::discover:adtask:16910503330560001:ad_port:Port-] [DiscoveryTask.run:443] DiscoveryTask start, CONTEXT=taskId=16910503330560001, duplicateId=98-Port-, status=EXECUTING
[2023-08-03 17:12:48.167 JST] [MSG] [INFO] [PollNow-38-2::testscript:Test:datasource:embed:XXXXXX.hana.prod-jp10.hanacloud.ondemand.com:1692041235] [TestScriptPollNow._handle:156] Finish poll now test script, CONTEXT=result={"output":"H00.AllStartValue=6.0\r\n","responseTime":169,"module":"datasource","exitCode":0,"stderr":""}

  • Hello @Kiyoshi Egawa 

    On our document here:

    https://www.logicmonitor.com/support/sap-hana-monitoring

    We do actually call out that you can use the hana.port property to set the specific port you need to monitor these devices.  This port is used in the PropertySource addCategory_SAP_HANA.  It uses the port to craft the URL used by the DataSources to connect to your device.

    As stated in that article, you can even list multiple ports there, but it will default to 39013.

    The number you see in that log is likely something unrelated to a port, as that value is much higher than the highest TCP port which is 65535. 

    As always, if you are still running into issues while working through this document, I would definitely suggest opening up a support ticket so we can take a look!

5 Replies

  • Hello @Kiyoshi Egawa 

    On our document here:

    https://www.logicmonitor.com/support/sap-hana-monitoring

    We do actually call out that you can use the hana.port property to set the specific port you need to monitor these devices.  This port is used in the PropertySource addCategory_SAP_HANA.  It uses the port to craft the URL used by the DataSources to connect to your device.

    As stated in that article, you can even list multiple ports there, but it will default to 39013.

    The number you see in that log is likely something unrelated to a port, as that value is much higher than the highest TCP port which is 65535. 

    As always, if you are still running into issues while working through this document, I would definitely suggest opening up a support ticket so we can take a look!

  • Hey @Kiyoshi Egawa 

    The collectors proxy config should not be taken into account here.  The LogicModules should be pulling the properties directly from the device. 

    If you have set the properties as expected and they are not working we would want to see what exactly is going on within your environment to truly understand.  

    I would recommend you submit a support ticket, this can be done through the LogicMonitor support center:

    https://www.logicmonitor.com/support 

    You can also do this through your portal using the “Submit a Support Ticket” or “Chat with an Engineer” options depending on your contract.

    Support Options
  • I set properties as hana.port,hana.dbnames,hana.user,hana.pass and hana.dbnames.url. I wonder if Collector config proxy settings are effective for HANA connection. How can I use JDBC parameters as proxyHostname, proxyPort and proxyHttp ?

  • I set proxy properties to hana.dbnames.url as "HANA.DBNAMES.URL": "jdbc:sap://XXXXXXXXXX.hana.prod-jp10.hanacloud.ondemand.com:443/?proxyHostname=XXXXXXXXXX&proxyPort=8080&proxyHttp=true".

    SAP_HANA_Connections script test makes error like as “EXCEPTION=java.io.IOException: winproxy return status=0x80041010 errmsg=無効なクラスです”.

    How can I resolve proxy issue ?

    ------------

      </entry>, script={"scriptgroovy":"/*******************************************************************************\n *  ? 2007-2022 - LogicMonitor, Inc. All rights reserved.\n ******************************************************************************/\ndef modLoader = new GroovyShell(getBinding()).parse(com.logicmonitor.mod.Snippets.getLoader())\ndef emit = modLoader.load(\"lm.emit\", \"0\")\ndef lmSql = modLoader.load(\"lm.sql\", \"0\")\ndef lmDebug = modLoader.load(\"lm.debug\", \"0\")\nString dbnames = hostProps.get(\"hana.dbnames\") ?: hostProps.get(\"auto.hana.dbnames\") ?: \"\"\nBoolean debug = false\nBoolean connectionFailed = false\n\ndef connectionQuery = \"\"\"\nSELECT Top 10 CLIENT_HOST ,\n  USER_NAME \n  FROM (\nSELECT CLIENT_HOST ,\n  USER_NAME ,\n  COUNT(*) AS CONNECTION_COUNT,\n  SUM(FETCHED_RECORD_COUNT) AS FETCHED_RECORD_COUNT,\n  SUM(AFFECTED_RECORD_COUNT) as AFFECTED_RECORD_COUNT,\n  SUM(SENT_MESSAGE_SIZE)AS SENT_MESSAGE_SIZE,\n  SUM(SENT_MESSAGE_COUNT)AS SENT_MESSAGE_COUNT,\n  SUM(RECEIVED_MESSAGE_SIZE) AS RECEIVED_MESSAGE_SIZE,\n  SUM(RECEIVED_MESSAGE_COUNT) AS RECEIVED_MESSAGE_COUNT \nFROM SYS.M_CONNECTIONS\nWHERE SECONDS_BETWEEN(COALESCE(END_TIME, CURRENT_TIMESTAMP), CURRENT_TIMESTAMP) <= 900\nAND CREATED_BY = 'Session'\nGROUP BY Client_Host,\n         Client_IP,\n         USER_NAME \n)\nORDER BY CONNECTION_COUNT DESC\"\"\"\n\nif (dbnames)\n{\n    dbnames.toString().tokenize(\",\").each { instanceName ->\n        lmDebug.LMDebugPrint(\"\\tInstance Name ${instanceName}\", debug)\n        String url = hostProps.get(\"hana.${instanceName.trim()}.url\") ?: hostProps.get(\"auto.hana.${instanceName.trim()}.url\")\n        //if manually set username then over-ride the hostprops username\n        String username = hostProps.get(\"hana.${instanceName.trim()}.url\") ?: hostProps.get(\"hana.user\") ?: \"\"\n        String password = hostProps.get(\"hana.${instanceName.trim()}.pass\") ?: hostProps.get(\"hana.pass\") ?: \"\"\n        def conn = lmSql.attemptConnection(username, password, url)\n        if (conn.status == \"success\")\n        {\n            def connectionData = lmSql.runQuery(connectionQuery, conn.connection)\n            lmDebug.LMDebugPrint(\"\\tConnection Data ${connectionData}\", debug)\n            if (connectionData.status == \"success\")\n            {\n                connectionData.data.each\n                { connUser ->\n                    emit.instance(\"${instanceName}||${connUser.CLIENT_HOST}||${connUser.USER_NAME}\",\"${instanceName} - ${connUser.CLIENT_HOST} - ${connUser.USER_NAME}\",[\"HOST\":connUser.CLIENT_HOST, \"USER_NAME\":connUser.USER_NAME, \"DBNAME\":instanceName])\n                }\n                conn.connection.close()\n            }\n        }\n        else\n        {\n            connectionFailed = true\n            lmDebug.LMDebugPrint(\"Failed to connect to ${url}\", debug)\n        }\n    }\n    if (connectionFailed)\n    {\n        println(\"Failed to connect to database.\")\n        return 1\n    }\n}\n\nelse\n{\n    println \"No database names defined in auto.hana.dbnames device property.\"\n    return 1\n}\nreturn 0","linuxscript":"","linuxcmdline":"","windowscmdline":"","windowsscript":"","type":"embed"}, module=autodiscovery
    [2023-08-07 16:04:43.100 JST] [MSG] [INFO] [PollNow-38-2::testscript:Test:autodiscovery:embed:XXXXXXXXXX.hana.prod-jp10.hanacloud.ondemand.com:1691979504] [PollNowScriptExecutor.execute:90] Start to execute the poll now test script, CONTEXT=host=XXXXXXXXXX.hana.prod-jp10.hanacloud.ondemand.com, timeout=50, type=embed, argument=, scriptName=
    [2023-08-07 16:04:43.204 JST] [MSG] [ERROR] [PollNow-38-2::testscript:Test:autodiscovery:embed:XXXXXXXXXX.hana.prod-jp10.hanacloud.ondemand.com:1691979504] [PollNowTask.run:69] Fail to handle the poll now request feed, CONTEXT=type=4, feed={
      "module": "autodiscovery",
      "extra": {
        "sourceName": "SAP_HANA_Connections",
        "collector": "ad_script"
      },
      "host": {
        "hostname": "XXXXXXXXXX.hana.prod-jp10.hanacloud.ondemand.com",
        "dsis": [{
          "wildvalue2": "",
          "name": "SAP_HANA_Connections",
          "datasourceid": 0,
          "wildvalue": "",
          "id": 0,
          "wildalias": "",
          "properties": {}
        }],
        "adlist": [],
        "hostid": 98,
        "properties": {
          "SYSTEM.CATEGORIES": "HANA_Cloud",
          "AUTO.LM.LAST_CHECK_TIME": "Mon Aug 07 03:00:41 JST 2023",
          "SYSTEM.HOSTSTATUS": "normal",
          "SYSTEM.COLLECTORVERSION": "34200",
          "SYSTEM.DB.ORACLE": "",
          "AUTO.NETWORK.NAMES": "XXXXXXXXXX.hana.prod-jp10.hanacloud.ondemand.com,XXXXXXXXXX.hana.prod-jp10.hanacloud.ondemand.com",
          "HANA.DBNAMES.URL": "jdbc:sap://XXXXXXXXXX.hana.prod-jp10.hanacloud.ondemand.com:443/?proxyHostname=XXXXXXXXXX&proxyPort=8080&proxyHttp=true",
          "HANA.DBNAMES": "H00",
          "SYSTEM.PREFCOLLECTORDESC": "WIN2016TEST1",
          "SYSTEM.DEVICEGROUPID": "15,14,115",
          "SYSTEM.DEVICEID": "98",
          "SYSTEM.EC2.REGION": "",
          "SYSTEM.COLLECTORID": "3",
          "SYSTEM.DISPLAYNAME": "Takabayashi_test",
          "HANA.USER": "LM_USER",
          "SYSTEM.NETSCANINFO": "",
          "SYSTEM.RESOURCECREATEDON": "1690876762",
          "SYSTEM.GROUPS": "Minimal Monitoring,Devices by Type/Misc,G1NEXT_Customizing",
          "SYSTEM.DB.MSSQL": "",
          "SYSTEM.WORKGROUP": "",
          "SYSTEM.CREDENTIAL.ID": "",
          "SYSTEM.SYSINFO": "",
          "SYSTEM.TOTALPHYSICALMEMORY": "",
          "SYSTEM.MODEL": "",
          "SYSTEM.EC2.RESOURCEID": "",
          "SYSTEM.DEVICETYPE": "0",
          "SYSTEM.HOSTNAME": "XXXXXXXXXX.hana.prod-jp10.hanacloud.ondemand.com",
          "SYSTEM.COLLECTORPLATFORM": "windows",
          "SYSTEM.ENABLENETFLOW": "false",
          "SYSTEM.VERSION": "",
          "NETAPP.SSL": "true",
          "SYSTEM.SYSOID": "",
          "SYSTEM.DEVICE.PROVIDER": "Regular",
          "SYSTEM.SYSNAME": "",
          "SYSTEM.DESCRIPTION": "",
          "AUTO.LM.AGE": "5.4175810185",
          "SYSTEM.PREFCOLLECTORID": "3",
          "SYSTEM.SYSTEMTYPE": "",
          "SYSTEM.COLLECTOR": "false",
          "AUTO.NETWORK.RESOLVES": "true",
          "SYSTEM.VENDOR": "",
          "SYSTEM.SYSIPS": "",
          "HANA.PORT": "443",
          "SYSTEM.DB.DB2": "",
          "SYSTEM.DB.MYSQL": "",
          "SYSTEM.COLLECTORDESC": "WIN2016TEST1",
          "SYSTEM.DOMAIN": "",
          "SYSTEM.STATICGROUPS": "G1NEXT_Customizing",
          "SYSTEM.CPU": "",
          "SYSTEM.IPS": "XXX.XXX.XXX.XXX,XXX.XXX.XXX.XXX",
          "SYSTEM.VIRTUALIZATION": "",
          "HANA.PASS": "****",
          "SYSTEM.MEMORY": ""
        }
      },
      "script": {
        "scriptgroovy": "/*******************************************************************************\n *  ? 2007-2022 - LogicMonitor, Inc. All rights reserved.\n ******************************************************************************/\ndef modLoader = new GroovyShell(getBinding()).parse(com.logicmonitor.mod.Snippets.getLoader())\ndef emit = modLoader.load(\"lm.emit\", \"0\")\ndef lmSql = modLoader.load(\"lm.sql\", \"0\")\ndef lmDebug = modLoader.load(\"lm.debug\", \"0\")\nString dbnames = hostProps.get(\"hana.dbnames\") ?: hostProps.get(\"auto.hana.dbnames\") ?: \"\"\nBoolean debug = false\nBoolean connectionFailed = false\n\ndef connectionQuery = \"\"\"\nSELECT Top 10 CLIENT_HOST ,\n  USER_NAME \n  FROM (\nSELECT CLIENT_HOST ,\n  USER_NAME ,\n  COUNT(*) AS CONNECTION_COUNT,\n  SUM(FETCHED_RECORD_COUNT) AS FETCHED_RECORD_COUNT,\n  SUM(AFFECTED_RECORD_COUNT) as AFFECTED_RECORD_COUNT,\n  SUM(SENT_MESSAGE_SIZE)AS SENT_MESSAGE_SIZE,\n  SUM(SENT_MESSAGE_COUNT)AS SENT_MESSAGE_COUNT,\n  SUM(RECEIVED_MESSAGE_SIZE) AS RECEIVED_MESSAGE_SIZE,\n  SUM(RECEIVED_MESSAGE_COUNT) AS RECEIVED_MESSAGE_COUNT \nFROM SYS.M_CONNECTIONS\nWHERE SECONDS_BETWEEN(COALESCE(END_TIME, CURRENT_TIMESTAMP), CURRENT_TIMESTAMP) <= 900\nAND CREATED_BY = 'Session'\nGROUP BY Client_Host,\n         Client_IP,\n         USER_NAME \n)\nORDER BY CONNECTION_COUNT DESC\"\"\"\n\nif (dbnames)\n{\n    dbnames.toString().tokenize(\",\").each { instanceName ->\n        lmDebug.LMDebugPrint(\"\\tInstance Name ${instanceName}\", debug)\n        String url = hostProps.get(\"hana.${instanceName.trim()}.url\") ?: hostProps.get(\"auto.hana.${instanceName.trim()}.url\")\n        //if manually set username then over-ride the hostprops username\n        String username = hostProps.get(\"hana.${instanceName.trim()}.url\") ?: hostProps.get(\"hana.user\") ?: \"\"\n        String password = hostProps.get(\"hana.${instanceName.trim()}.pass\") ?: hostProps.get(\"hana.pass\") ?: \"\"\n        def conn = lmSql.attemptConnection(username, password, url)\n        if (conn.status == \"success\")\n        {\n            def connectionData = lmSql.runQuery(connectionQuery, conn.connection)\n            lmDebug.LMDebugPrint(\"\\tConnection Data ${connectionData}\", debug)\n            if (connectionData.status == \"success\")\n            {\n                connectionData.data.each\n                { connUser ->\n                    emit.instance(\"${instanceName}||${connUser.CLIENT_HOST}||${connUser.USER_NAME}\",\"${instanceName} - ${connUser.CLIENT_HOST} - ${connUser.USER_NAME}\",[\"HOST\":connUser.CLIENT_HOST, \"USER_NAME\":connUser.USER_NAME, \"DBNAME\":instanceName])\n                }\n                conn.connection.close()\n            }\n        }\n        else\n        {\n            connectionFailed = true\n            lmDebug.LMDebugPrint(\"Failed to connect to ${url}\", debug)\n        }\n    }\n    if (connectionFailed)\n    {\n        println(\"Failed to connect to database.\")\n        return 1\n    }\n}\n\nelse\n{\n    println \"No database names defined in auto.hana.dbnames device property.\"\n    return 1\n}\nreturn 0",
        "linuxscript": "",
        "linuxcmdline": "",
        "windowscmdline": "",
        "windowsscript": "",
        "type": "embed"
      }
    }, EXCEPTION=The script returned non-zero exit code - 1

    ------------ output -------------

    Failed to connect to database.


    status=8, errCode=-1, message=The script returned non-zero exit code - 1

    ------------ output -------------

    Failed to connect to database.


        at com.santaba.agent.handlers.pollnow.testScript.ScriptOutput._mustBeZero(ScriptOutput.java:66)
        at com.santaba.agent.handlers.pollnow.testScript.ScriptOutput._verifyExitCode(ScriptOutput.java:52)
        at com.santaba.agent.handlers.pollnow.testScript.ScriptOutput.toJSON(ScriptOutput.java:37)
        at com.santaba.agent.handlers.pollnow.TestScriptPollNow._handle(TestScriptPollNow.java:153)
        at com.santaba.agent.handlers.pollnow.PollNowTask.run(PollNowTask.java:64)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:829)

    [2023-08-07 16:04:43.204 JST] [MSG] [INFO] [PollNow-38-2::testscript:Test:autodiscovery:embed:XXXXXXXXXX.hana.prod-jp10.hanacloud.ondemand.com:1691979504] [PollNowManager.report:90] Try to report the poll now result, CONTEXT=id=1691979504, status=5, message=The script returned non-zero exit code - 1

    ------------ output -------------

    Failed to connect to database.

    , diagnose=, items={}, timestamp=1691391883202
    [2023-08-07 16:04:44.039 JST] [MSG] [WARN] [collector-discover-thread-4-2::discover:adtask:16913918379540010:ad_wmi:Windows DNS Server-] [WinProxyStub.wmiQuery2:751] WinProxyStub.wmiquery, CONTEXT=Failed (host=127.0.0.1, Username=, Password=****, query=SELECT * FROM win32_perfrawdata_dns_dns, type=1) [0x80041010]: 無効なクラスです

    [2023-08-07 16:04:44.039 JST] [MSG] [ERROR] [collector-discover-thread-4-2::discover:adtask:16913918379540010:ad_wmi:Windows DNS Server-] [WMIDiscoveryTask._run:173] WMIDiscoveryTask._run, CONTEXT=hostname=127.0.0.1, EXCEPTION=java.io.IOException: winproxy return status=0x80041010 errmsg=無効なクラスです

  • The proxy settings is as following.


    Set actual dbname into the property:hana.<dbname>.url
    Set proxy into jdbc string:
    jdbc:sap://<host name>:<port>/?proxyHostname=<proxy host>&proxyPort=<proxy port>&proxyHttp=TRUE

    Thanks

    Kiyoshi