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. DATE fields in mysql database.

DATE fields in mysql database.

Scheduled Pinned Locked Moved Support
10 Posts 4 Posters 34.4k 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.
  • P
    P
    prutser
    wrote on last edited by
    #1

    Hello again,

    I need to make a php page that shows the uptime of various services monitored by NETXMS.
    I found most of the data I need, but have a problem with 'DATES' that are stored in the database. Could you please tell me how I can extract the date and time from date and time fields (eg: alarms.creation_time, alarms.change_time, idata_xx.idata_timestamp etc)?
    Also, the idata_xx tables. What is the number the xx refers to?

    Thank you very much in advance!
    Peter.

    1 Reply Last reply
    0
    • V
      V
      Victor Kirhenshtein
      wrote on last edited by
      #2

      Hello!

      All times in NetXMS database stored as UNIX timestamp - number of seconds passes since January 1, 1970 UTC. You can use MySQL function FROM_UNIXTIME() to convert them to other formats.
      For idata_xx tables, xx is a node object ID - so each node have it's own idata table.

      Best regards,
      Victor

      1 Reply Last reply
      0
      • A
        A
        Alex Kirhenshtein
        wrote on last edited by
        #3

        Hello.

        Date is stored as unix timestamp (number of seconds since 1/1/1970), in php you can convert it to human readable form using date() function.

        idata_xx tables contains per-node history data for each DCI (e.g. cpu usage values for retention period), where "xx" is "id" from table "nodes".

        p.s. please keep in mind that server keeps operational data in memory and flushing changes in a background, so information in database can be sometimes out of sync or outdated (only while server is running - everything is flushed on shutdown, of course) - especially under heavy load.
        p.p.s. you can make some assumptions about out of sync delay by looking at Server.AverageDBWriterQueueSizeAverage DCI.

        1 Reply Last reply
        0
        • P
          P
          prutser
          wrote on last edited by
          #4

          Thank you very much for the info.

          I still have a question though. Does netxms also keep a history of "NETWORK SERVICES" data? I can find the DCI data in the IDATA_xx tables, but not the network services data?

          If this is not the case, this means I need to get the status of ports via a DCI (Eg Peoplesoft JOLT listener on port 9000). I could us the ServiceCheck.Custom(x).
          What do I give as a parameter x?

          EG: I need to check port 9000 of node 12. How can I define a DCI for this?
          ServiceCheck.Custom(localhost, 9000) -> returns status 2
          ServiceCheck.Custom(9000) -> returns status 2

          Thanxx in advance!

          1 Reply Last reply
          0
          • V
            V
            Victor Kirhenshtein
            wrote on last edited by
            #5

            Hello!

            Correct syntax is ServiceCheck(ip_addr,port). Note that you need to specify IP address, it will not resolve hostname. So ServiceCheck(127.0.0.1,9000) should work. Btw, I will add hostname resolution in the next release.

            Also, you can create DCI for status of "network service" object, and then access it's collected data as for any other DCI. To do this, create new DCI with origin "Internal", select ChildStatus() parameter, and as the argument anter name or id of network service object.

            Best regards,
            Victor

            1 Reply Last reply
            0
            • P
              P
              prutser
              wrote on last edited by
              #6

              Thank you very much for your information!

              I don't seem to get the localhost part working, but am still trying. Apparently, I always get status 2 back instead of status 0. In case I don't use the (127.0.0.1,9000) but by a remote host, it works... It think it has not to do with the Peoplesoft JOLT listener because also ServiceCheck.Custom(127.0.0.1,21) on FTP-host returns dci-value 2.

              1 Reply Last reply
              0
              • V
                V
                Victor Kirhenshtein
                wrote on last edited by
                #7

                Just tested on my machine - 127.0.0.1 works fine, so it seems like a bug or misconfiguration. Could you please send me agent's configuration from the host where you define DCI with ServiceCheck.Custom(127.0.0.1,xx) and output of netstat -an from this host?

                Best regards,
                Victor

                1 Reply Last reply
                0
                • P
                  P
                  prutser
                  wrote on last edited by
                  #8

                  Thank you very much for your help (especially the netstat typ). I'm sure now it has nothing to do with Netxms. Apparently the host is only listening on his own IP-adress, and not on address 127.0.0.1. This explains why only remote connections are accepted.
                  As this problem is on all tested hosts (Win XP and 2003 Adv Server), I think the problem is bound to Microsoft OS's...

                  If I have the solution, I'll post it here... Thanxx again for your help!!

                  Ps: the more I'm busy playing around with netxms, the more I love it!

                  1 Reply Last reply
                  0
                  • A
                    A
                    Anth0ny
                    wrote on last edited by
                    #9

                    Request author's comment:

                    how i can create a standalone Service object?
                    for example for monitoring SSH daemon availability at host 10.0.0.1 without creating Server object and DCI "ServiceCheck.SSH".

                    path: Console root -> All Services -> Create -> Service...

                    Need more information about rights of filling for all "Create Network Service" fields.

                    Please.

                    1 Reply Last reply
                    0
                    • V
                      V
                      Victor Kirhenshtein
                      wrote on last edited by
                      #10

                      You can create network service only under node object - because network service is just a process on a host, listening on TCP port. So, if you wish to monitor SSH on host 10.0.0.1, you create node object fro 10.0.0.1 and create SSH service object under it.

                      I don't actually understand question about rights - you can use the same rights assignment as for any other object.

                      Best regards,
                      Victor

                      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