Since I reformatted my fog server and did a complete new install from Fog 0.32 --> 0.33 --> 1.0.0 --> 1.0.1–>1.1.0, I have lost my client list. 😞 I originally hoped the client would re-register themselves but that function was lost in 0.29 and it makes sense why. The HOST has no idea what image to point to. Considering there may be 2 possible images for the same Make\Model of machine.
So I wanted to make this easier on myself.
Here is what I came up with… I have a shortcut to a network shared batch file so I can make some changes on the fly with our users that can’t do things for themselves. This batch file is in windows All Users\Startup folder. (Dirty I know but works). SO if I want my staff to look at a webpage as soon as they log in I can force that. 🙂
[B]Windows Batch file:[/B]
[CODE]start <fogserverip>/fog/management/index.php?node=host&sub=add[/CODE]
[B]Install arpscan to fog server[/B]
[CODE]sudo apt-get install arp
[/CODE]
[B]Edit /var/www/fog/lib/pages/[/B][B]HostManagementPage.class.php[/B] to include just below print “\n\t\t\t<h2>”._(‘Add new host definition’).‘</h2>’;
[CODE] //----------------------------------------------------------------------------------------
//Register this host Button (wolfbane8653)
//Must install arp first (sudo apt-get install arp) before enabling this button
?>
<script>
function fillinfo()
{
//get this hosts info
<?php
$ipaddr = $_SERVER[‘REMOTE_ADDR’];
$chk = exec('/usr/sbin/arp -a '.$ipaddr,$output);
$data = explode(" “,$output[0]);
$name = explode(”.",$data[0]);
$hostname = $name[0];
$macaddr = $data[3];
?>
//export php info into javascript
var hostname = “<?php echo $hostname ?>”;
var macaddr = “<?php echo $macaddr ?>”;
//output to textboxes
document.getElementsByName(“host”)[0].value=hostname;
document.getElementsByName(“mac”)[0].value=macaddr;
}
</script>
<button onclick=“fillinfo()”>Register THIS HOST</button>
<?php
//end button
//----------------------------------------------------------------------------------------[/CODE]
With this edit I now can click on this new button and it inputs my current computer name and mac address in the correct fields. Is there anyway this can be incorporated as a hook/plugin/option?
[COLOR=#ff0000]Warning this only works on LAN.[/COLOR]