• Recent
  • Unsolved
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
  • Recent
  • Unsolved
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login

Retrieving host inventory information directly from FOG Database

Scheduled Pinned Locked Moved Solved
FOG Problems
host inventory database
4
20
6.7k
Loading More Posts
  • 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.
  • T
    ToxicFlyman
    last edited by Aug 18, 2015, 3:16 PM

    I’'m trying to write a script that will update my computer inventory based on fogs database information. The problem is that the hostname/mac address and inventory information are stored in separate tables. I can’t seem to find a way to tie them together because all of the ids in them are different in each table. I have tried sifting through the php code that fog uses to find out how it identifies and joins that information together(like for making tasks or displaying all host info on the webpage). Does anyone know how I could query the database and get the info for both tables to match together to I can group hosts with their inventory information?

    1 Reply Last reply Reply Quote 0
    • W
      Wayne Workman
      last edited by Aug 18, 2015, 3:22 PM

      @ToxicFlyman

      It’s a relational database model. their are IDs as PKs and FKs but are not enforced by the DB, but are guaranteed by the FOG front end I believe. Simple inner joins or outer joins will give you what you want. What version of FOG are you using?

      Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!
      Daily Clean Installation Results:
      https://fogtesting.fogproject.us/
      FOG Reporting:
      https://fog-external-reporting-results.fogproject.us/

      T 1 Reply Last reply Aug 18, 2015, 3:39 PM Reply Quote 1
      • T
        Tom Elliott
        last edited by Aug 18, 2015, 3:26 PM

        The <tablerelationHostID> to hosts table hostID fields are the primary linkers if that helps out at all.

        Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

        Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

        Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

        T 1 Reply Last reply Aug 18, 2015, 3:49 PM Reply Quote 1
        • T
          ToxicFlyman
          last edited by Aug 18, 2015, 3:36 PM

          This post is deleted!
          1 Reply Last reply Reply Quote 0
          • T
            ToxicFlyman @Wayne Workman
            last edited by Aug 18, 2015, 3:39 PM

            @Wayne-Workman We are currently running fog version 1.2.0

            W 1 Reply Last reply Aug 18, 2015, 3:43 PM Reply Quote 0
            • W
              Wayne Workman @ToxicFlyman
              last edited by Aug 18, 2015, 3:43 PM

              @ToxicFlyman

              Do you have tables called “hosts” and “hostMac” ? what are the exact table names in FOG 1.2.0 ? (sorry don’t have 1.2.0 anywhere to test on).

              What are the exact field names in those two tables? Are these the only tables you want info from or are there others?

              Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!
              Daily Clean Installation Results:
              https://fogtesting.fogproject.us/
              FOG Reporting:
              https://fog-external-reporting-results.fogproject.us/

              1 Reply Last reply Reply Quote 1
              • T
                ToxicFlyman
                last edited by Aug 18, 2015, 3:47 PM

                @Wayne-Workman The hostMAC table fields are hmID, hmHostID, hm MAC, hmDesc. The hosts table fields are hostID, hostName, hostDesc, hostIP, hostImage, hostBuilding, hostCreateDate, hostLastDeploy, hostCreateBy, hostMAC, hostUseAD, hostADDomain, hostADOU, hostADUser, hostADPass, hostProductKey, hostPrinterLevel, hostKernalArgs, hostKernel, hostDevice

                1 Reply Last reply Reply Quote 0
                • T
                  ToxicFlyman @Tom Elliott
                  last edited by Aug 18, 2015, 3:49 PM

                  @Tom-Elliott We are running fog 1.2.0. Does that version have that field connecting them?

                  1 Reply Last reply Reply Quote 0
                  • T
                    Tom Elliott
                    last edited by Aug 18, 2015, 3:53 PM

                    what do you mean?

                    Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

                    Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                    Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                    T 1 Reply Last reply Aug 18, 2015, 3:57 PM Reply Quote 0
                    • T
                      Tom Elliott
                      last edited by Aug 18, 2015, 3:53 PM

                      Any table that has a relation to the host table will be setup that way.

                      Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

                      Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                      Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                      1 Reply Last reply Reply Quote 0
                      • T
                        ToxicFlyman @Tom Elliott
                        last edited by ToxicFlyman Aug 18, 2015, 9:58 AM Aug 18, 2015, 3:57 PM

                        @Tom-Elliott On my hosts table I don’t see a <tablerelationHostID>(or any other table). I am looking the at DB through phpMyAdmin if that helps at all. I can see a hostID field that is labeled as a primary key but I can’t see it being linked anywhere. How can I see the relations betwee them?

                        1 Reply Last reply Reply Quote 0
                        • J
                          Junkhacker Developer
                          last edited by Aug 18, 2015, 3:59 PM

                          have you considered just customizing the inventory report built in to fog?

                          signature:
                          Junkhacker
                          We are here to help you. If you are unresponsive to our questions, don't expect us to be responsive to yours.

                          1 Reply Last reply Reply Quote 1
                          • T
                            Tom Elliott
                            last edited by Aug 18, 2015, 4:02 PM

                            I don’t know what you mean.

                            Look

                            <tablerelation>HostID is not a literal thing. The <tablerelation> will be different between tables. Inventory table, in particular, I believe is just iHostID. On the Hosts table it’s hostID. Does that help.

                            Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

                            Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                            Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                            W T 2 Replies Last reply Aug 18, 2015, 4:03 PM Reply Quote 0
                            • W
                              Wayne Workman @Tom Elliott
                              last edited by Aug 18, 2015, 4:03 PM

                              @Tom-Elliott In addition to that, it also helps your understanding a whole lot if you look at the data in those fields, too.

                              Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!
                              Daily Clean Installation Results:
                              https://fogtesting.fogproject.us/
                              FOG Reporting:
                              https://fog-external-reporting-results.fogproject.us/

                              1 Reply Last reply Reply Quote 0
                              • T
                                ToxicFlyman @Tom Elliott
                                last edited by ToxicFlyman Aug 18, 2015, 12:00 PM Aug 18, 2015, 5:57 PM

                                @Tom-Elliott Alright. That makes sense. I understand that those fields are relating them together. I’m still not seeing how they’re tied together in my console though. When I look in the hosts table and check hostID: 80(for example). IhostID in inventory doesn’t match up with(or just isn’t there) the hostID(or mac address tied to the hostID). Are those fields normally suppose to be the same if they are related? When I’ve made a few relational databases in access and the fields had the same values between tables to keep things in order. Hopefully all of that made sense.

                                1 Reply Last reply Reply Quote 0
                                • T
                                  Tom Elliott
                                  last edited by Aug 18, 2015, 6:00 PM

                                  The way a relational database is supposed to work is to LIMIT the amount of replicatoin.

                                  So rather than multiple tables linking with duplicated data, they link through an ID of the originating table.

                                  For example.

                                  You’re ID Number in the world is: 14000 (lets just say).

                                  Everybody who wanted to find who you are would not be given a duplicate of yourself. They’d be simply given an ID to relate to your information.

                                  Does that make sense?

                                  In either case, fi the iHostID field did not have a relevant matching dataset, menaing an iHostID record of 80 did not exist for the relevant host, I’d say it’s pretty safe to guess that an inventory has not been recieved or has bene removed previously.

                                  Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

                                  Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                                  Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                                  T 1 Reply Last reply Aug 18, 2015, 6:26 PM Reply Quote 1
                                  • T
                                    ToxicFlyman @Tom Elliott
                                    last edited by Aug 18, 2015, 6:26 PM

                                    @Tom-Elliott Okay. I think I’ve figured out the problem. Some hosts had entries in the inventory but some did not. Some inventory entry’s had a corresponding host entry and some did not. That’s what was so confusing. Apparently when we first created our fog server we had some problems and had to export our DB and import it into a new fog install. The problem was when we started again we registered a lot of pcs again and fog left some of the unused inventory and host entries in the database. I’m not sure if that makes sense of if you’ve seen that before but we know what to do now. The hostID and IhostID fields were linked together in the end(except for the unused entries). Thank you for all the help.

                                    W 1 Reply Last reply Aug 18, 2015, 6:58 PM Reply Quote 0
                                    • W
                                      Wayne Workman @ToxicFlyman
                                      last edited by Aug 18, 2015, 6:58 PM

                                      @ToxicFlyman So you have it figured out?

                                      Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!
                                      Daily Clean Installation Results:
                                      https://fogtesting.fogproject.us/
                                      FOG Reporting:
                                      https://fog-external-reporting-results.fogproject.us/

                                      T 1 Reply Last reply Aug 19, 2015, 5:02 PM Reply Quote 0
                                      • T
                                        Tom Elliott
                                        last edited by Aug 18, 2015, 9:48 PM

                                        For future reference, as well, whenever the system does an upload or download task, it performs an inventory tasking.

                                        Just trying to help. So while the import may have “forgotten” about other hosts in the past, performing a simple tasking would correct this for you automagically.

                                        Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

                                        Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                                        Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                                        1 Reply Last reply Reply Quote 0
                                        • T
                                          ToxicFlyman @Wayne Workman
                                          last edited by Aug 19, 2015, 5:02 PM

                                          @Wayne-Workman I did end up figuring it out. It turns out that our data had left over data from a previous export/import. So that’s why not all of our entries in the both tables had corresponding entry’s while some did.

                                          1 Reply Last reply Reply Quote 0
                                          • 1 / 1
                                          1 / 1
                                          • First post
                                            8/20
                                            Last post

                                          171

                                          Online

                                          12.0k

                                          Users

                                          17.3k

                                          Topics

                                          155.2k

                                          Posts
                                          Copyright © 2012-2024 FOG Project