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

    Auto assign snapin?

    Scheduled Pinned Locked Moved
    General
    2
    3
    1.3k
    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.
    • D
      Dameek
      last edited by

      Is it possible to have a snapin automagically assigned to a host?

      1 Reply Last reply Reply Quote 0
      • A
        afmrick
        last edited by

        Not from FOG that I’ve found.
        You can write a little shell script to update the mysql database automatically if you’d like. Here’s an extremely lame script off the top of my head that would associate every snapin with every host in the FOG database:
        [CODE]#!/bin/bash

        Store all host IDs

        HOST_IDs=$(/usr/bin/mysql -u root -Dfog --batch --skip-column-names
        -e “SELECT hostID FROM hosts;”)

        Store all Snapin IDs

        SNAPIN_IDs=$(/usr/bin/mysql -u root -Dfog --batch --skip-column-names
        -e “SELECT sID FROM snapins;”)

        Clear out any existing associations

        /usr/bin/mysql -u root -Dfog --batch --skip-column-names
        -e “TRUNCATE TABLE snapinAssoc;”

        Add every snapin to every host

        for HOST in $HOST_IDs
        do
        for SNAPIN in $SNAPIN_IDs
        do
        /usr/bin/mysql -u root -Dfog --batch --skip-column-names
        -e “INSERT INTO snapinAssoc (saHostID, saSnapinID) VALUES($HOST, $SNAPIN);”
        done
        done[/CODE]

        1 Reply Last reply Reply Quote 0
        • D
          Dameek
          last edited by

          Thanks for that!!! I’ll try it out!

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post

          210

          Online

          12.0k

          Users

          17.3k

          Topics

          155.2k

          Posts
          Copyright © 2012-2024 FOG Project