Roll-Calling hosts to identify problems.

  • Moderator

    I had a need for getting a list of computers that could possibly be having problems with the FOG Client. @Joe-Schmitt gave me an idea on how to do it conceptually, and I was able to build some things that did exactly what he suggested.

    1. Create a samba share on the fog server.
    • Install samba and samba-client, start and enable the smb service.

    • Create a share folder that everyone has access to:
      mkdir /readwrite$
      chmod 777 /readwrite$

    • Configure samba:
      Configuration file is: /etc/samba/smb.conf
      Here’s the configuration I wrote:

    map to guest = Bad user
    guest account = nobody
    security = user
    passdb backend = tdbsam
    unix charset = utf-8
    dos charset = cp932
    path = /readwrite$
    read only = no
    # The below line defines what IP ranges are allowed. They are space delimited.
    # For instance, if you wanted local loopback address, the 10.0.0. range,
    # and the 192.168.1 range, and a specifc public IP of,
    # It would be this:
    # hosts allow = 10.0.0. 192.168.1.
    hosts allow = 10.2.
    create mode = 0777
    directory mode = 0777
    writable = yes
    public = yes
    1. Generate a file per hostname registered with your fog server in the shared directory. We do this easily with the following BASH script:

    Note: There’s a nodeBB bug that is currently affecting how scripts are displayed. Be aware that after double left brackets [[ and before double right brackets ]] there should be a space.

    #----- MySQL Credentials -----#
    #Here, we just source the fogsettings file because creds are in there.
    source /opt/fog/.fogsettings
    #----- Begin Program -----#
    selectHostname="SELECT hostName FROM hosts"
    if [[ $snmysqlhost != "" ]]; then
            options="$options -h$snmysqlhost"
    if [[ $snmysqluser != "" ]]; then
            options="$options -u$snmysqluser"
    if [[ $snmysqlpass != "" ]]; then
            options="$options -p$snmysqlpass"
    options="$options -D fog -e"
    mysql $options "$selectHostname" | while read hostName; do
        if [[ "$hostName" != "" ]]; then
            echo "$hostName" > /readwrite$/$hostName

    After running this script, here’s what I see in my /readwrite$ directory below. There should be a file per registered host, here’s a clipped sample of my output:

    [root@mb-fog ~]# ls /readwrite\$/
    r0006502230WLMB  r0105508030WDMB  r0129008514WDMB  r0150508359WDMB  r0206510494WDMB  r0212510525WDMB  R0219502510WLMB  r0224004875WDMB  R0225508043WDMB  R0232510478WDMB
    r0009508526WDMB  r0106008038wdmb  r0129008524WDMB  r0150508360WDMB  R0206510511WDMB  r0213005683WLMB  r0219502542WLMB  r0224004876WDMB  R0225508056WDMB  R0232510479WDMB
    [root@mb-fog ~]#

    Next, we use Windows to create a batch script designed for FOG Snapins, to run on each host, and each host delete it’s file in this share. Create this as a .bat file and create a snapin for it on the fog server, associate it with all hosts, and run it on all hosts.

    set "folder=\\\readwrite$"
    pushd "%folder%" && (
        for /d %%i in (%computername%) do del "%%i" /Q 

    When deployed via FOG Snapins to all hosts in the environment, you are left with files that are the hostnames of all hosts that have not run yet. it may take hours or even weeks depending on your environment for this test to completely finish accurately. hostnames that remain can be assumed to be offline, having network issues, windows issues, or fog client issues.

    You can compile all these leftover hostnames into a single file as often as you like with the following BASH script:

    #path to files.
    #where you want it to go:
    rm -f $output
    for f in $FILES
        if [[ "$f" != "$output" ]]; then
            echo ${f##*/} >> $output

Log in to reply





Looks like your connection to FOG Project was lost, please wait while we try to reconnect.