Can't add "all" hosts under one group



  • I would like to add all my hosts under one group to make resetting encryption data easier.

    I’m running SVN 6321 and wanted to know if this has been addressed before updating to newest version.



  • @Hanz This script does what you want.

    # This script adds all fog hosts to the below specified group name.
    # the group name is case sensitive.
    
    groupName=My-caseSensitive-Test-group-Name
    
    fogsettings=/opt/fog/.fogsettings
    snmysqluser="$(grep 'snmysqluser=' $fogsettings | cut -d \' -f2 )"
    snmysqlpass="$(grep 'snmysqlpass=' $fogsettings | cut -d \' -f2 )"
    snmysqlhost="$(grep 'snmysqlhost=' $fogsettings | cut -d \' -f2 )"
    
    
    if [[ $snmysqlhost != "" ]]; then
            hostIDs=$(mysql -s -h$snmysqlhost -u$snmysqluser -p$snmysqlpass -D fog -e "Select hostID from hosts")
            groupID=$(mysql -s -h$snmysqlhost -u$snmysqluser -p$snmysqlpass -D fog -e "Select groupID from groups where groupName = '$groupName'")
            for i in ${hostIDs[@]}; do
                    mysql -s -h$snmysqlhost -u$snmysqluser -p$snmysqlpass -D fog -e "insert into groupMembers (gmHostID,gmGroupID) values (${i},$groupID)"
            done
    elif [[ $snmysqlpass != "" ]]; then
            hostIDs=$(mysql -s -u$snmysqluser -p$snmysqlpass -D fog -e "Select hostID from hosts")
            groupID=$(mysql -s -u$snmysqluser -p$snmysqlpass -D fog -e "Select groupID from groups where groupName = '$groupName'")
            for i in ${hostIDs[@]}; do
                    mysql -s -u$snmysqluser -p$snmysqlpass -D fog -e "insert into groupMembers (gmHostID,gmGroupID) values (${i},$groupID)"
            done
    else
            hostIDs=$(mysql -s -D fog -e "Select hostID from hosts")
            groupID=$(mysql -s -D fog -e "Select groupID from groups where groupName = '$groupName'")
            for i in ${hostIDs[@]}; do
                    mysql -s -D fog -e "insert into groupMembers (gmHostID,gmGroupID) values (${i},$groupID)"
            done
    fi
    


  • @Wayne-Workman I could do this with phpMyAdmin right ? I dunno why I didn’t think of that. Anyways I’ll go that route, but leave this just so the devs know this is going on, at least on 6321.

    Also running php 7.0 from remi



  • @Hanz Ok then… I don’t know what is causing it then. Stand by - I’ve about got a script done that does what you want.



  • @Wayne-Workman I’ve got /etc/php.ini , /etc/php.ini.rpmnew, /usr/share/doc/php-common/php.ini-production, and /usr/share/doc/php-common/php.ini-development.

    I changed the first one and double checked the line to make sure it was saved.



  • @Hanz Sure you got the right file? Double check for typos? It should work… :-\



  • @Wayne-Workman sry didn’t see that error before when looking…changed it to 2500 and rebooted server…still getting same error.

    [Mon Feb 22 08:39:23.847739 2016] [:error] [pid 5050] [client 10.72.2.46:60053] PHP Warning: Unknown: Input variables exceeded 1000. To increase the limit change max_input_vars in php.ini. in Unknown on line 0, referer: http://10.72.3.50/fog/management/index.php?node=group&sub=membership&id=63
    


  • @Hanz ok can you try what the error suggests?

    Here’s a command to find that file:

    find / | grep /php.ini



  • @Wayne-Workman here is the apache error log from the instance.

    [Mon Feb 22 08:39:23.847739 2016] [:error] [pid 5050] [client 10.72.2.46:60053] PHP Warning: Unknown: Input variables exceeded 1000. To increase the limit change max_input_vars in php.ini. in Unknown on line 0, referer: http://10.72.3.50/fog/management/index.php?node=group&sub=membership&id=63
    


  • @Hanz I can probably make a SQL statement that will do the group add for you in the mean time, but we do need to get this figured out. Can you check the apache error logs and mysql error logs?



  • @Wayne-Workman random five works fine



  • @Hanz can you add a random 5 to the group successfully?



  • @Tom-Elliott any suggestions ? 8G Ram I5 proc. is what I have now. Any settings for this ?


  • Senior Developer

    @Hanz There is, but it varies depending on the server.



  • @Tom-Elliott still on 6321, created group “Whole” and tried to add all 1600+ hosts to that group, but after it says the group updated successfully, there are no members in group “Whole”…Is there a limit to the amount that can be added at once ?


  • Senior Developer

    I don’t understand.



  • In r6303 this works fine for me. How are you trying to do it exactly?


 

486
Online

41.8k
Users

12.3k
Topics

116.0k
Posts