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

Clear snapin history? Automatically?

Scheduled Pinned Locked Moved Solved
FOG Problems
4
6
849
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.
  • S
    Szeraax
    last edited by Mar 19, 2018, 4:31 AM

    I’ve decided to use Snapins as a sort of declarative state configuration (similar to DSC). As a result, my group of computers is scheduled to run all snapins every hour and is starting to make the snapin history page a bit largish. Is the best way to clear that via the database? Or have I missed something that can be done to clear it? Especially automatically would be cool. I’m assuming that I’ll need to make myself a script for cron to run though.

    If curious, my configuration does stuff like pulling the Primary User from FOG and making sure that that is the ONLY admin besides the 2 local admin accounts on each computer (adding/removing as needed). Also pulls bitlocker recovery information from the machine if its not already stored in FOG (or will enable bitlocker automatically if not presently enabled when I solve that debacle). You may be thinking, WTF??? And I agree with you. This deployment is interesting and they don’t have domain admin control. Not even GPO control. The office is part of a MUCH larger org, and fog has turned out to be best administrator solution.

    1 Reply Last reply Reply Quote 0
    • C
      cml Moderator
      last edited by Mar 19, 2018, 11:34 AM

      The only way I could find to clear it was through the database.

      You could use the event scheduler to automatically clear the table.

      Here’s what I came up with to remove completed tasks older than a month.

      USE fog;
      CREATE EVENT clear_snapinTasks
      ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 MONTH
      DO
      DELETE FROM fog.snapinTasks WHERE stCompleteDate < DATE_SUB(NOW(), INTERVAL 1 MONTH);
      
      S 1 Reply Last reply Mar 21, 2018, 5:23 AM Reply Quote 4
      • W
        Wayne Workman
        last edited by Mar 19, 2018, 1:09 PM

        A cron job could also run the last line of SQL that @cml posted on a schedule.

        Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!
        Daily Clean Installation Results:
        https://fogtesting.fogproject.us/
        FOG Reporting:
        https://fog-external-reporting-results.fogproject.us/

        1 Reply Last reply Reply Quote 0
        • T
          Tom Elliott
          last edited by Mar 20, 2018, 7:46 AM

          I think this could be handled with either method, though I think the DB procedure method is probably the least interfering. It wouldn’t rely on another service from Linux to be enabled and running at least.

          Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

          Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

          Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

          S 1 Reply Last reply Mar 20, 2018, 8:45 AM Reply Quote 0
          • S
            Szeraax @Tom Elliott
            last edited by Szeraax Mar 20, 2018, 2:45 AM Mar 20, 2018, 8:45 AM

            @tom-elliott Thanks for the thoughts. And especially thank you for cml for the code, and Wayne for ALWAYS being amazing on the forums.

            I’m just happy that I solved my other problem on my own (the post about running 64bit powershell snapins so I can use modules and such). Gettin better all the time. Actually, Tom, it may be worth making a 64bit powershell snapin template. Guess that may have to be my own PR to put in.

            1 Reply Last reply Reply Quote 1
            • S
              Szeraax @cml
              last edited by Mar 21, 2018, 5:23 AM

              @cml Better mark this as solved. Loved it!

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

              165

              Online

              12.0k

              Users

              17.3k

              Topics

              155.2k

              Posts
              Copyright © 2012-2024 FOG Project