Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Flatly)
  • No Skin
Collapse
Brand Logo

NetXMS Forum

  1. Home
  2. Support
  3. nxshell - Database failure on eventlog query

nxshell - Database failure on eventlog query

Scheduled Pinned Locked Moved Support
12 Posts 2 Posters 53.7k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Z
    Z
    zshnet
    wrote on last edited by
    #1

    Hi all,

    I figured this belongs in a different topic. I am trying to query the event log, and am instead getting a Databaase Failure error of the following:

    Traceback (most recent call last):
      File "nxshell_eventcounter.py", line 8, in <module>
        eventLog.query(logFilter)
    	at org.netxms.client.NXCSession.waitForRCC(NXCSession.java:1536)
    	at org.netxms.client.log.Log.query(Log.java:121)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.lang.reflect.Method.invoke(Method.java:498)
    
    org.netxms.client.NXCException: org.netxms.client.NXCException: Database failure
    

    Any thoughts? I'm worried the Columfilter is being set incorrectly. My eventual goal is to use a column filter to query events only of a certain severity, but I figured I would start easy. My code is reproduced below:

    eventLog = session.openServerLog("EventLog")
    
    columnFilter = ColumnFilter(ColumnFilter.EQUALS,8153)
    logFilter = LogFilter()
    logFilter.setColumnFilter("Source",columnFilter)
    
    eventLog.query(logFilter)
    
    table = eventLog.retrieveData(0,2)
    

    Thanks,
    Zach

    1 Reply Last reply
    0
    • Z
      Z
      Tatjana Dubrovica
      wrote on last edited by
      #2

      Check your server log on debug level 4. There should be something like: "LOG QUERY: %s"

      1 Reply Last reply
      0
      • Z
        Z
        zshnet
        wrote on last edited by
        #3

        I looked at it once but I can't seem to remember where the log file should be located on Linux. Any suggestions as to where I could look?

        Thanks,
        Zach

        1 Reply Last reply
        0
        • Z
          Z
          Tatjana Dubrovica
          wrote on last edited by
          #4

          Check "LogFile" parameter in server config(NETXMSHOME/etc/netxmsd.conf or /etc/netxmsd.conf). If it is not defined try to check something like /var/log/netxmsd.

          1 Reply Last reply
          0
          • Z
            Z
            Tatjana Dubrovica
            wrote on last edited by
            #5

            Optimal log level for debugging problems is 6.

            1 Reply Last reply
            0
            • Z
              Z
              zshnet
              wrote on last edited by
              #6

              Good to know. We're currently running really hard on Debug levels, I think. The only relevant line I could find in any of the five (netxmsd.0/1/2/3/4) logfiles was this:
              [20-Jun-2016 12:31:54.204] [DEBUG] [CLSN-4] User [email protected] authenticated (language=en clientInfo="nxjclient/2.0.3 (Linux 3.19.0-58-generic; libnxcl 2.0.3)")

              Our debug level is currently at 6. We have a million of these messages:
              [20-Jun-2016 12:31:54.245] [DEBUG] [CLSN-4] Sending message CMD_OBJECT

              which is making it a bit hard to read through the logs. Searching for "database" "nxc" or similar terms got me nothing. Any guesses? Should I try to dig into the postgresql logs?

              Thanks,
              Zach

              1 Reply Last reply
              0
              • Z
                Z
                zshnet
                wrote on last edited by
                #7

                That was it! I looked in the postgresql log:

                2016-06-20 12:37:31 EDT ERROR:  column "source" does not exist at character 159
                2016-06-20 12:37:31 EDT STATEMENT:  SELECT event_id,event_timestamp,event_source,dci_id,event_code,event_severity,event_message,user_tag,root_event_id FROM event_log WHERE event_id<=934558 AND (Source BETWEEN 0 AND 8153) LIMIT 1000

                I guess the column isn't named Source? I'll have to look in the postgresql database to see what's there, unless you have a better idea of the column name.

                Thanks,
                Zach

                1 Reply Last reply
                0
                • Z
                  Z
                  Tatjana Dubrovica
                  wrote on last edited by
                  #8

                  The name is "event_source". UI is hiding column real names. You should use names that are defined in database.

                  1 Reply Last reply
                  0
                  • Z
                    Z
                    zshnet
                    wrote on last edited by
                    #9

                    One last question, I hope! It appears to not be filtering anything. Running the following code, I get five events, 10, 11, 12, 13, 109. The filter should have spat out 27628, right? If I pull the columnfilter from the logfilter, I get that the filter is still in place, but I don't seem to get any filtering. Any guesses?

                    eventLog = session.openServerLog("EventLog")
                    
                    columnFilter = ColumnFilter(ColumnFilter.EQUALS,27628)
                    columnFilter.setNumericValue(27628)
                    logFilter = LogFilter()
                    logFilter.setColumnFilter("event_id",columnFilter)
                    #print(columnFilter.getNumericValue())
                    #print(columnFilter.getOperation())
                    fill = logFilter.getColumnFilter("event_id")
                    print(fill.getNumericValue())
                    eventLog.query(logFilter)
                    
                    table = eventLog.retrieveData(0,5)
                    for j in range(table.getRowCount()):
                        #for i in range(table.getColumnCount()):
                        print(table.getColumnDisplayName(0))
                        print(table.getCellValue(j,0))
                    

                    output is:
                    27628 [output of fill.getNumericValue()]
                    event_id
                    10
                    event_id
                    11
                    event_id
                    12
                    event_id
                    13
                    event_id
                    109

                    1 Reply Last reply
                    0
                    • Z
                      Z
                      zshnet
                      wrote on last edited by
                      #10

                      For some quick information, I chose this event because it was not filtering on event_severity, so I gave ID a try, and it seems to similarly not work. I have pasted the event below, so that you can see it exists.

                      27628 19.05.2016 11:56:32 Karmaloop-R1 0 SYS_NODE_CRITICAL Critical Node status changed to CRITICAL 0

                      1 Reply Last reply
                      0
                      • Z
                        Z
                        Tatjana Dubrovica
                        wrote on last edited by
                        #11

                        I found problem. It's bad class declaration. You want function "public ColumnFilter(int type, long value)" to be used, but both values are counted like long and class is created like: "public ColumnFilter(long rangeFrom, long rangeTo)". So your values were counted like a range. Type should be change to Enum type. I have created bug on it: https://dev.raden.solutions/issues/1245.
                        Temporary solution:
                        import java.lang.Integer
                        eventLog = session.openServerLog("EventLog")

                        columnFilter = ColumnFilter(java.lang.Integer(ColumnFilter.EQUALS),363)
                        logFilter = LogFilter()
                        logFilter.setColumnFilter("event_id",columnFilter)
                        ...

                        1 Reply Last reply
                        0
                        • Z
                          Z
                          zshnet
                          wrote on last edited by
                          #12

                          Hey, thanks! That works perfectly. Thanks again for all your work + help!

                          Have a good one,
                          Zach

                          1 Reply Last reply
                          0

                          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                          With your input, this post could be even better 💗

                          Register Login
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          Powered by NodeBB Contributors
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Users
                          • Groups