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

problem with hostname.php when i migrate 1.3.4 => 1.3.5.

Scheduled Pinned Locked Moved Solved
FOG Problems
4
35
7.4k
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.
  • J
    jc35
    last edited by Mar 21, 2017, 3:17 PM

    Server
    • FOG Version: 1.3.5
    • OS: debiaqn 8
    Client
    • Service Version:
    • OS:
    Description

    Hello,
    To get some informtation hostname,active directory,… with this command :
    hostinfo = wget -q -O - "http://${web}service/hostname.php?mac=$mac" 2>/dev/null
    It’s works fine in 1.3.4.
    In 1.3.5, I have #!ng
    How to get information in 1.3.5 ?

    G 1 Reply Last reply Mar 22, 2017, 12:54 AM Reply Quote 0
    • W
      Wayne Workman
      last edited by Wayne Workman Mar 21, 2017, 5:44 PM Mar 21, 2017, 11:41 PM

      The query looks wrong. This works for me on 1.3.5:
      http://10.0.0.2/fog/service/hostname.php?mac=00:26:2d:b4:d9:25

      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/

      J 1 Reply Last reply Mar 22, 2017, 7:15 AM Reply Quote 0
      • G
        george1421 Moderator @jc35
        last edited by Mar 22, 2017, 12:54 AM

        @jc35 What are you trying to accomplish here?

        What is the end goal, because there may be a different way to do this?

        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!

        J 1 Reply Last reply Mar 22, 2017, 7:11 AM Reply Quote 0
        • J
          jc35 @george1421
          last edited by Mar 22, 2017, 7:11 AM

          Hello,
          @george1421
          I want to get hostname and active directory information.

          1 Reply Last reply Reply Quote 0
          • J
            jc35 @Wayne Workman
            last edited by Mar 22, 2017, 7:15 AM

            Hello,

            @Wayne-Workman said in problem with hostname.php when i migrate 1.3.4 => 1.3.5.:

            The query looks wrong. This works for me on 1.3.5:
            http://10.0.0.2/fog/service/hostname.php?mac=00:26:2d:b4:d9:25

            it doesn’t work for but it work in 1.2.0,1.3.4.
            I try

            echo wget -q -O - "http://10.0.0.2/fog/service/hostname.php?mac=xx:xx:xx:xx:xx:xx" 2>/dev/null

            J 1 Reply Last reply Mar 22, 2017, 7:30 AM Reply Quote 0
            • J
              jc35 @jc35
              last edited by Mar 22, 2017, 7:30 AM

              @jc35 I don’t understand what happen, because I test on a test server (1.3.5) and it’s work.

              1 Reply Last reply Reply Quote 0
              • J
                jc35
                last edited by Mar 22, 2017, 10:31 AM

                I try with :
                wget -q -O /tmp/hinfo.txt “http://${web}service/hostinfo.php?mac=$mac”
                . /tmp/hinfo.txt

                The content of /tmp/hinfo.txt is “Cannot view from browser”.

                G 1 Reply Last reply Mar 22, 2017, 10:48 AM Reply Quote 0
                • G
                  george1421 Moderator @jc35
                  last edited by george1421 Mar 22, 2017, 4:48 AM Mar 22, 2017, 10:48 AM

                  @jc35 The hostinfo.php is setup so that postinstall scripts can pick up details about the current deployment. This script outputs the data in a form that can be easily used by a bash shell.

                  That is why I asked what are you trying to accomplish.

                  Yes you can not view that data with a browser, that is a security attempt to only allow certain devices (FOS Engine) to access the data. But there is a hack to get around that 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!

                  J 1 Reply Last reply Mar 22, 2017, 1:47 PM Reply Quote 0
                  • J
                    jc35 @george1421
                    last edited by Mar 22, 2017, 1:47 PM

                    @george1421 said in problem with hostname.php when i migrate 1.3.4 => 1.3.5.:

                    The hostinfo.php is setup so that postinstall scripts can pick up details about the current deployment. This script outputs the data in a form that can be easily used by a bash shell.
                    That is why I asked what are you trying to accomplish.
                    Yes you can not view that data with a browser, that is a security attempt to only allow certain devices (FOS Engine) to access the data. But there is a hack to get around that too.

                    I want get some host information as hostname, adou, for modify the sysprep file in postinstall.
                    I read to get this information with hostinfo.php, but i don’t understand how to use it.

                    W 1 Reply Last reply Mar 22, 2017, 2:16 PM Reply Quote 0
                    • W
                      Wayne Workman @jc35
                      last edited by Wayne Workman Mar 22, 2017, 8:16 AM Mar 22, 2017, 2:16 PM

                      @jc35 Can you use curl instead? The stuff you’re getting is pure text anyways, not html.

                      curl http://10.0.0.2/fog/service/hostname.php?mac=xx:xx:xx:xx:xx:xx
                      

                      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 Mar 22, 2017, 2:19 PM Reply Quote 0
                      • T
                        Tom Elliott @Wayne Workman
                        last edited by Mar 22, 2017, 2:19 PM

                        @Wayne-Workman need to add argument -A ""

                        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
                        • W
                          Wayne Workman
                          last edited by Wayne Workman Mar 22, 2017, 8:23 AM Mar 22, 2017, 2:23 PM

                          @jc35 This works fine for me (pictured below). Are you changing the IP address in the command to your own FOG server’s IP?

                          0_1490192608886_Screenshot from 2017-03-22 09-22-50.png

                          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/

                          J 1 Reply Last reply Mar 22, 2017, 2:33 PM Reply Quote 0
                          • J
                            jc35 @Wayne Workman
                            last edited by Mar 22, 2017, 2:33 PM

                            @Wayne-Workman
                            On my test server on local base is work fine on local base,. When I try to use our base on another server I have same problem, I think the is a problem with our database on other database, i don’t understand why.
                            Can I do a schema updater ?

                            G 1 Reply Last reply Mar 22, 2017, 3:20 PM Reply Quote 0
                            • G
                              george1421 Moderator @jc35
                              last edited by george1421 Mar 22, 2017, 7:49 PM Mar 22, 2017, 3:20 PM

                              @jc35 Now that I’m aware of what you are trying to do, then this post will give you the background: https://forums.fogproject.org/topic/6463/expose-fog-host-and-image-properties-to-post-install-scripts/10

                              In your fog post install script you need to add this code

                                . /usr/share/fog/lib/funcs.sh;
                                wget -q -U '' -O /tmp/hinfo.txt "http://<fog_server_IP>/fog/service/hostinfo.php?mac=$mac"
                                . /tmp/hinfo.txt
                                rm -f /tmp/hinfo.txt
                              

                              Once you stat the hinfo.txt file ( . /tmp/hinfo.txt) the following variables will be added to your postinstall bash shell.

                              $hostname == name of the host (should overwrite existing $hostname)
                              $hostdesc == Description of host
                              $imageosid == Operating System ID (should be the same as $osid)
                              $imagepath == The root path of the image(should also be the image name)
                              $hostusead == 1 or 0 to add host to AD
                              $hostaddomain == host domain name
                              $hostadou == host target ou
                              $hostproductkey == host product key
                              $primaryuser == Value from Primary User field
                              $othertag == Value from OtherTag field
                              $othertag1 == Value from OtherTag1 field
                              $location == Location Name from location plugin
                              $sysman == System Manufacturer from smbios
                              $sysproduct == System Product Name from smbios (from full registration)
                              $sysserial == System Serial Number from smbios (from full registration)
                              $mbman == Motherboard Manufacturer from smbios (from full registration)
                              $mbserial == Motherboard Serial Number from smbios (from full registration)
                              $mbasset == Motherboard Asset tag from smbios (from full registration)
                              $mbproductname == Motherboard Product Name from smbios (from full registration)
                              $caseman == Case Manufacturer from smbios (from full registration)
                              $caseserial == Case Serial Number from smbios (from full registration)
                              $caseasset == Case Asset tag from smbios (from full registration)
                              

                              From there once you have these bash variables you can use them in your post install script. This document shows you what could be done with a post install script: https://forums.fogproject.org/topic/7740/the-magical-mystical-fog-post-download-script

                              more precisely you can use the variables with sed to replace settings in your unattend.xml file. Such as changing the computer name to what was collected from the hostinfo.php page.

                              sed -i -e "s#<ComputerName>\([^<][^<]*\)</ComputerName>#<ComputerName>$hostname</ComputerName>#gi" $unatendfile 
                              

                              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!

                              J 1 Reply Last reply Mar 22, 2017, 4:09 PM Reply Quote 1
                              • J
                                jc35 @george1421
                                last edited by george1421 Mar 22, 2017, 7:49 PM Mar 22, 2017, 4:09 PM

                                @george1421 said in problem with hostname.php when i migrate 1.3.4 => 1.3.5.:

                                @jc35 Now that I’m aware of what you are trying to do, then this post will give you the background: https://forums.fogproject.org/topic/6463/expose-fog-host-and-image-properties-to-post-install-scripts/10

                                In your fog post install script you need to add this code

                                  . /usr/share/fog/lib/funcs.sh;
                                  wget -q -U '' -O /tmp/hinfo.txt "http://<fog_server_IP>/fog/service/hostinfo.php?mac=$mac"
                                  . /tmp/hinfo.txt
                                  rm -f /tmp/hinfo.txt
                                

                                Once you stat the hinfo.txt file ( . /tmp/hinfo.txt) the following variables will be added to your postinstall bash shell.

                                $hostname == name of the host (should overwrite existing $hostname)
                                $hostdesc == Description of host
                                $imageosid == Operating System ID (should be the same as $osid)
                                $imagepath == The root path of the image(should also be the image name)
                                $hostusead == 1 or 0 to add host to AD
                                $hostaddomain == host domain name
                                $hostadou == host target ou
                                $hostproductkey == host product key
                                $primaryuser == Value from Primary User field
                                $othertag == Value from OtherTag field
                                $othertag1 == Value from OtherTag1 field
                                $location == Location Name from location plugin
                                $sysman == System Manufacturer from smbios
                                $sysproduct == System Product Name from smbios (from full registration)
                                $sysserial == System Serial Number from smbios (from full registration)
                                $mbman == Motherboard Manufacturer from smbios (from full registration)
                                $mbserial == Motherboard Serial Number from smbios (from full registration)
                                $mbasset == Motherboard Asset tag from smbios (from full registration)
                                $mbproductname == Motherboard Product Name from smbios (from full registration)
                                $caseman == Case Manufacturer from smbios (from full registration)
                                $caseserial == Case Serial Number from smbios (from full registration)
                                $caseasset == Case Asset tag from smbios (from full registration)
                                

                                From there once you have these bash variables you can use them in your post install script. This document shows you what could be done with a post install script: https://forums.fogproject.org/topic/7740/the-magical-mystical-fog-post-download-script

                                more precisely you can use the variables with sed to replace settings in your unattend.xml file. Such as changing the computer name to what was collected from the hostinfo.php page.

                                sed -i -e "s#<ComputerName>\([^<][^<]*\)</ComputerName>#<ComputerName>$hostname</ComputerName>#gi" $unatendfile 
                                

                                I have try this, it doesn’t work.
                                I think the problem is database.
                                We return to 1.3.4.
                                Thanks you very much for your answer, we try to go to 1.3.5 later.

                                G 1 Reply Last reply Mar 22, 2017, 4:12 PM Reply Quote 0
                                • G
                                  george1421 Moderator @jc35
                                  last edited by Mar 22, 2017, 4:12 PM

                                  @jc35 This function is also in 1.3.x, not specific to 1.3.5.

                                  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!

                                  G J 2 Replies Last reply Mar 22, 2017, 4:27 PM Reply Quote 0
                                  • G
                                    george1421 Moderator @george1421
                                    last edited by Mar 22, 2017, 4:27 PM

                                    @george1421 I sent you a DM (look at the little talk bubble at the top of the fog tool tray). It explains what has to be done.

                                    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!

                                    J 1 Reply Last reply Mar 22, 2017, 5:11 PM Reply Quote 0
                                    • J
                                      jc35 @george1421
                                      last edited by Mar 22, 2017, 5:04 PM

                                      @george1421
                                      We have return to 1.3.4 and it’s works. We try to duplicate database and with the dev server we try to connect with 1.3.5 to connect to find what’s th problem with database and fog 1.3.5.
                                      our dev server is on 1.3.5

                                      sorry for very bad english.
                                      Thanks for your answer.

                                      1 Reply Last reply Reply Quote 0
                                      • J
                                        jc35 @george1421
                                        last edited by Mar 22, 2017, 5:11 PM

                                        @george1421
                                        Okay, I’ll look at that.

                                        1 Reply Last reply Reply Quote 0
                                        • T
                                          Tom Elliott
                                          last edited by Mar 23, 2017, 2:57 AM

                                          I really believe you just need to change the wget command to read as:
                                          hostinfo=$(wget -U '' -qO --post-data="mac=$mac" - "http://${web}service/hostname.php 2>/dev/null)
                                          You could also try:
                                          hostinfo=$(curl -A '' -fkq --data "mac=$mac" "http://${web}service/hostname.php" 2>/dev/null)

                                          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

                                          J 1 Reply Last reply Apr 5, 2017, 8:00 AM Reply Quote 0
                                          • 1
                                          • 2
                                          • 1 / 2
                                          1 / 2
                                          • First post
                                            4/35
                                            Last post

                                          147

                                          Online

                                          12.0k

                                          Users

                                          17.3k

                                          Topics

                                          155.2k

                                          Posts
                                          Copyright © 2012-2024 FOG Project