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

Showing Last Check-in Time

Scheduled Pinned Locked Moved
General Problems
3
9
948
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.
  • F
    FlareImp
    last edited by May 17, 2023, 4:06 PM

    Is there a way to show when a client last communicated (checked in) with the fog server? I’d like to compile a list of all my clients showing their check-in times and see if any clients are no longer communicating.

    T 1 Reply Last reply May 17, 2023, 7:54 PM Reply Quote 0
    • T
      Tom Elliott @FlareImp
      last edited by May 17, 2023, 7:54 PM

      @FlareImp While I don’t have a simple answer to approach, we do track the last time the security token was updated. Which I believe is set at 15-30 minute increments.

      You could write a hook to expose that on the UI. Right now there isn’t a component that updates the last checkin time in the database though, so not quite sure if this will fit the needs.

      I will try to mock up what a sample of the hook might look like that you could at least glean that last status time.

      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

      T F 2 Replies Last reply May 18, 2023, 2:29 PM Reply Quote 0
      • T
        Tom Elliott @Tom Elliott
        last edited by May 18, 2023, 2:29 PM

        @Tom-Elliott This is completely untested and I’m sorry for that, but should give a potential way forward:

        <?php
        /**
         * Displays the sec token time on hosts.
         *
         * PHP version 5
         *
         * @category HostSecTime
         * @package  FOGProject
         * @author   Tom Elliott <tommygunsster@gmail.com>
         * @license  http://opensource.org/licenses/gpl-3.0 GPLv3
         * @link     https://fogproject.org
         */
        /**
         * Displays the sec token time on hosts.
         *
         * @category HostSecTime
         * @package  FOGProject
         * @author   Tom Elliott <tommygunsster@gmail.com>
         * @license  http://opensource.org/licenses/gpl-3.0 GPLv3
         * @link     https://fogproject.org
         */
        class HostSecTime extends Hook
        {
            /**
             * The name of this hook.
             *
             * @var string
             */
            public $name = 'HostSecTime';
            /**
             * The description of this hook.
             *
             * @var string
             */
            public $description = 'Adds the host security time to the Host Lists';
            /**
             * Is this hook active?
             *
             * @var bool
             */
            public $active = true;
            /**
             * Iniatializes object.
             *
             * @return void
             */
            public function __construct()
            {
                parent::__construct();
                self::$HookManager
                    ->register(
                        'HOST_DATA',
                        array(
                            $this,
                            'hostData'
                        )
                    )
                    ->register(
                        'HOST_HEADER_DATA',
                        array(
                            $this,
                            'hostTableHeader'
                        )
                    );
            }
            /**
             * The data to alter.
             *
             * @param mixed $arguments The items to alter.
             *
             * @return void
             */
            public function hostData($arguments)
            {
                global $node;
                if ($node != 'host') {
                    return;
                }
                $arguments['templates'][] = '${host_sec_time}';
                $arguments['attributes'][] = array('class' => 'c');
                foreach ((array)$arguments['data'] as $i => &$data) {
                    $arguments['data'][$i]['host_sec_time'] = $data['host_sec_time'];
                    unset($data);
                }
            }
            /**
             * The table header to alter
             *
             * @param mixed $arguments The items to alter.
             *
             * @return void
             */
            public function hostTableHeader($arguments)
            {
                global $node;
                if ($node != 'host') {
                    return;
                }
                $arguments['headerData'][] = _('Security Token Expires Time');
            }
        }
        

        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

        1 Reply Last reply Reply Quote 1
        • F
          FlareImp @Tom Elliott
          last edited by May 19, 2023, 1:37 PM

          @Tom-Elliott Awesome, thank you very much! I’ll start playing around with this.

          F 1 Reply Last reply May 22, 2023, 12:24 PM Reply Quote 0
          • F
            FlareImp @FlareImp
            last edited by May 22, 2023, 12:24 PM

            I gave your script a try and it crashes with web UI when set from active=false to active=true.

            T 1 Reply Last reply May 22, 2023, 1:58 PM Reply Quote 0
            • T
              Tom Elliott @FlareImp
              last edited by May 22, 2023, 1:58 PM

              @FlareImp What’s the error log show?

              It’s likely a call that I overlooked.

              I just gave a quick baseline, not a tested instance as it’s been a while since I built a hook, and I don’t have my normal environment since years now.

              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

              F 1 Reply Last reply May 22, 2023, 3:12 PM Reply Quote 0
              • F
                FlareImp @Tom Elliott
                last edited by May 22, 2023, 3:12 PM

                @Tom-Elliott dumb question but where would I find the log file for hooks?

                T S 2 Replies Last reply May 22, 2023, 4:16 PM Reply Quote 0
                • T
                  Tom Elliott @FlareImp
                  last edited by May 22, 2023, 4:16 PM

                  @FlareImp It wouldn’t be the hook specifically, but the general php/http logs.

                  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

                  1 Reply Last reply Reply Quote 0
                  • S
                    Sebastian Roth Moderator @FlareImp
                    last edited by May 24, 2023, 5:22 AM

                    @FlareImp said in Showing Last Check-in Time:

                    dumb question but where would I find the log file for hooks?

                    See my signature.

                    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

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

                    150

                    Online

                    12.0k

                    Users

                    17.3k

                    Topics

                    155.2k

                    Posts
                    Copyright © 2012-2024 FOG Project