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

    Creating group from file?

    Scheduled Pinned Locked Moved
    FOG Problems
    4
    8
    2.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.
    • A
      aname
      last edited by

      I’m looking to add 170 hosts that are already registered in fog to a group for snap-in deployment, but really don’t want to click through hundreds of entries to select the ones I need. Is there a way to import from a csv or the like? I asked in the IRC and searched here in the forums and don’t seem to see anything.

      1 Reply Last reply Reply Quote 0
      • S
        Sebastian Roth Moderator
        last edited by

        @aname While I totally understand your need for something to automate this task I don’t think we are going to add a group settings CSV import. I think in your case it’s better to come up with a simple but effective MySQL script to do just that. How would you generate that CSV file? Please tell us and we should be able to come up with some kind of converter to make it a MySQL script doing the job for you.

        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
        • A
          aname
          last edited by

          I say CSV, it’s more like return-separated - a hostname per line, like so:

          host1
          host2
          host3
          host4
          host5

          I’m not sure I have access to the SQL side of things, but I can ask one of the more senior admins. This isn’t being ‘generated’ by anything - I walked around desk by desk to find all the PCs in a certain physical location that doesn’t correspond to an existing logical group.

          1 Reply Last reply Reply Quote 0
          • S
            Sebastian Roth Moderator
            last edited by

            @aname Ok, so we need a bit more info. Which version of FOG do you have on that server (see in the blue cloud on the web gui)? Do you have SSH or direct access to that machine so you can run commands on the shell?

            There is a command line interface to the MySQL DB. Using this you should be able to add those hosts to a group. Start with creating that group in the web gui and noting down the ID (which you see in the URL bar of your browser when editing that group).

            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

            A 1 Reply Last reply Reply Quote 0
            • A
              aname @Sebastian Roth
              last edited by

              Thanks for responding. It turned out we actually already had such a script, and I was able to add the hosts to the group. I’m sure others might find your script useful if you still want to post it, though!

              @Sebastian-Roth said in Creating group from file?:

              There is a command line interface to the MySQL DB. Using this you should be able to add those hosts to a group. Start with creating that group in the web gui and noting down the ID (which you see in the URL bar of your browser when editing that group).

              Knowing this set me in the right direction, I was able to add these hosts with a short perl script, thanks.

              1 Reply Last reply Reply Quote 0
              • Wayne WorkmanW
                Wayne Workman
                last edited by

                I would probably put together a simple php script to do the changes you want. In my opinion, php is far more friendly with SQL than BASH is.

                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
                • Tom ElliottT
                  Tom Elliott
                  last edited by

                  Maybe this will help:
                  https://forums.fogproject.org/topic/10175/assign-multiple-host-to-a-group/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! 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
                  • Tom ElliottT
                    Tom Elliott
                    last edited by

                    Of course first you need to create the group itself.

                    From a php script this could be done with:

                    <?php
                    require('/var/www/fog/commons/base.inc.php');
                    FOGCore::getClass(
                        'Group'
                    )->set('name', 'SomeNameToNameThisGroup')
                    ->addHost(array(1,2,3,4,5,6))
                    ->save();
                    

                    Of course change the array(1,2,3,4,5,6) with the list of ID’s you need to associate to the group.

                    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
                    • 1 / 1
                    • First post
                      Last post

                    181

                    Online

                    12.0k

                    Users

                    17.3k

                    Topics

                    155.2k

                    Posts
                    Copyright © 2012-2024 FOG Project