FOG 2.0 request: Advanced host naming
-
Allow more flexibility in host naming more than static text + number increment.
For example we have a host naming convention like this
SSSTXXXXXXX
Where
SSS = Storage location (3 characters that match computer site OU)
T = Workstation type (D == Desktop, P==Portable/Laptop, T==Tablet)
XXXXXXX = Computer asset tag/serial numberSomewhere I had a hack for FOG 0.32 that allowed me to create this naming structure (but that was circa 2007). I tried to apply the same logic to FOG 1.0 and failed.
As an interim solution I can set the hostname in the unattend.xml file using postinstall scripts, but then I loose out on many of the functions of FOG 1.x. One being that the machine names remain the mac address not the actual asset tag, because FOG is not aware that I’m setting the host name outside of FOG.
Ideally I’d like to be able to set the hostname dynamically (programatically) through the registration process and not have to key the proper name into the system. I will still need to be able to edit the host name in the registration process if we build systems at site A but have the target computers delivered to sales office B.
-
For clarity here the fragment of my fog post install script that was never put into production because of loosing functionality in fog.
# need to find a way to get storage location set it manually for now sitecode="NYC"; chassis=`dmidecode -s chassis-type`; chassis="${chassis%"${chassis##*[![:space:]]}"}"; chassis="${chassis%,,}"; # Convert string to lower if [ "$chassis" = "laptop" ] then chtype="P"; elif [ "$chassis" = "tablet" ] then chtype="T"; else chtype="D"; fi serialno=`dmidecode -s chassis-serial-number`; serialno="${serialno%"${serialno##*[![:space:]]}"}"; # Remove trailing whitespace # get the serial no from the baseboard if bios doesn't give it up if [ "$serialno" = "" ] then serialno=`dmidecode -s baseboard-serial-number`; serialno="${serialno%"${serialno##*[![:space:]]}"}"; fi LEN=$(echo ${#serialno}); if [ $LEN -gt 11 ] then # get the right most characters of the serial number (usually the most # unique characters) serialno=${serialno:(-11)}; fi compname="$sitecode$chtype$serialno"; echo Setting computer name to: $compname; sed -i -e "s#<ComputerName>\([^<][^<]*\)</ComputerName>#<ComputerName>$compname</ComputerName>#gi" /ntfs/Windows/System32/sysprep/Unattend.xml
-
Here are the examples on how to hack the old version of fog to produce a dynamic client host name (I can’t seem to find the actual instructions from long ago, but the code may spark an idea.)
http://www.ehu.eus/fogenehu/doc/old/html/hosts_8inventory_8include_8php_source.html
http://www.ehu.eus/fogenehu/doc/html/HostManagementPage_8class_8php_source.html -
I really like the idea - but it’s hard to write code that will accomidate for everyone’s naming convention.
The convention my organization uses is vastly different from yours.
Mine is:
rAAAAABBBBBCCDD
where r is… meaningless
A is the room number, including leading zeros
B is the last five digits of the asset tag.
C is the type of computer- WD = Windows Desktop
- WL = Windows Laptop
- AD = Apple Desktop
- AL = Apple Laptop
- LD = Linux Desktop
- LL = Linux Laptop
- CD = Chrome/Chromium Desktop
- CL = Chrome/Chromium Laptop
DD is the building abbreviation.
It’s impossible to write logic for that - because it’s not based on hardware. It’s based on stickers that get pealed off all the time, based on room numbers which equipment magically floats to and from all the time…
This post is turning into a rant lol. </endRant>
-
Well I guess I need to amend the request to only support machine based automated naming convention.
The old 0.29 hack method allowed me to enter system variable names in the auto naming edit box to allow me to construct the machine calculated name. You can see the allowed variable names in the one link I posted.
-
@george1421 said:
Here are the examples on how to hack the old version of fog to produce a dynamic client host name (I can’t seem to find the actual instructions from long ago, but the code may spark an idea.)
http://www.ehu.eus/fogenehu/doc/old/html/hosts_8inventory_8include_8php_source.html
http://www.ehu.eus/fogenehu/doc/html/HostManagementPage_8class_8php_source.htmlI am the developer of this fork of FOG 0.30 (fogenehu). This version is actually in production environment and works fine . We don’t assign dynamic names to the machines, we synchronize the machines with our own inventory database. In this way the name of the computers have our convention. I would wish to add this feature in FOG 2.0, import computers from a database.
-
First of all I have to say, well done!! This fix worked so well back in the day.
The thought was if the machine name is machine calculable as in our case, why not allow it in 2.0? I can do this today with my script (which I don’t use because I loose FOG functionality). But if the registration process would prepopulate that field based on a formula then all would be right with the world.
Truthfully what we do today is a bit manual but it works. We key in the site OU, D, P, T, or what ever then use a barcode scanner to read the asset tag from the back/bottom of the dells. It does work, but it also the posibility for error and does make extra work.
I understand what you are staying about just importing from a database, but then we have to collect the machine information key/scan it into a database, export and then upload info FOG. This seems like too much work for something that can be done is milliseconds on a computer, and not leave room for the IT tech to make a mistake.
-
@george1421 said:
First of all I have to say, well done!! This fix worked so well back in the day.
The thought was if the machine name is machine calculable as in our case, why not allow it in 2.0? I can do this today with my script (which I don’t use because I loose FOG functionality). But if the registration process would prepopulate that field based on a formula then all would be right with the world.
Truthfully what we do today is a bit manual but it works. We key in the site OU, D, P, T, or what ever then use a barcode scanner to read the asset tag from the back/bottom of the dells. It does work, but it also the posibility for error and does make extra work.
I understand what you are staying about just importing from a database, but then we have to collect the machine information key/scan it into a database, export and then upload info FOG. This seems like too much work for something that can be done is milliseconds on a computer, and not leave room for the IT tech to make a mistake.
For us is not hard work. The providers (DELL or HP) do this work, the administrators only setup the IP and their location, then the technicians can synchronize the computer data. The idea is if you have all data in a database, why not import them from FOG?
-
Reading this topic title made me think of something.
Could it be possible to auto set name from selected group as default name if name is set to empty.For exemple, we add a computer to group named “Laptop” and it end name “Laptop01”.
If “Laptop03” exist, automatically named “Laptop04”.Maybe a page with “personalised fast registration” options and a new line on PXE menu could be what we need.
We could select what would be asked and what should be set automaticaly.
Default image, default naming, default group, default storage.We name our computer “RoomNumber-ComputerNumber”. (Ex : 007-01 or Lavoisier-01)
Best automaticaly naming would be “Location/Storage-GroupName-Number”. -
What was so great about the hack that ended up into the fork of FOG was you had these macro variable you could use to construct your computer name.
PrimaryUser Other Tag #1 Other Tag #2 System Manufacturer System Product System Version System Serial Number System Type BIOS Vendor BIOS Version BIOS Date Motherboard Manufacturer Motherboard Product Name Motherboard Version Motherboard Serial Number Motherboard Asset Tag CPU Manufacturer CPU Version CPU Normal Speed CPU Max Speed Memory Hard Disk Model Hard Disk Firmware Hard Disk Serial Number Chassis Manufacturer Chassis Version Chassis Serial Chassis Asset
These macro variables could be combined with literals and the * to give you a unique machine calculable name. For example in the FOG_QUICKREG_SYS_NAME you could enter something like this. (the syntax is not exact but you’ll get the point)
FOG_QUICKREG_SYS_NAME = “USNYC”{System Type}{System Serial Number}-*
The auto name would be something like USNYCDesktopXXXXXXXXX-01
At the time this function was added to the fog fork there wasn’t storage nodes/groups/locations but I would be great (still wishing here) to add those macro names too.
@jmeyer Your naming would be possible too, just put your room number into the other tag #1 or 2 field. While the devs are not geeked about this feature, I am.
-
@george1421 Room number (or room name) is most of time in group. That was my point. If you ask group before name (I know it’s stupid), you will be able to find out name I need using concatenation of the group name and a split on other computer in group taking the max of “name” less “group”.
New Host Name = Group Name + (max (Group Name removed from the list of other computer in group))
I don’t know if you understand me… lol
Something like this if name is “create” during registration.
Other way is just rename every host in group during registration base on registration date. Oldest get the lowest number.I think we both like geeking ! lol