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

    Solved Clear snapin history? Automatically?

    FOG Problems
    4
    6
    489
    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

      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
      • S
        Szeraax @cml last edited by

        @cml Better mark this as solved. Loved it!

        1 Reply Last reply Reply Quote 0
        • S
          Szeraax @Tom Elliott last edited by Szeraax

          @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
          • Tom Elliott
            Tom Elliott last edited by

            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 Reply Quote 0
            • Wayne Workman
              Wayne Workman last edited by

              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
              • cml
                cml Moderator last edited by

                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 Reply Quote 4
                • 1 / 1
                • First post
                  Last post

                60
                Online

                10.4k
                Users

                16.4k
                Topics

                150.7k
                Posts

                Copyright © 2012-2023 FOG Project