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

    Showing Last Check-in Time

    Scheduled Pinned Locked Moved
    General Problems
    3
    9
    964
    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

      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.

      Tom ElliottT 1 Reply Last reply Reply Quote 0
      • Tom ElliottT
        Tom Elliott @FlareImp
        last edited by

        @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

        Tom ElliottT F 2 Replies Last reply Reply Quote 0
        • Tom ElliottT
          Tom Elliott @Tom Elliott
          last edited by

          @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

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

            F 1 Reply Last reply Reply Quote 0
            • F
              FlareImp @FlareImp
              last edited by

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

              Tom ElliottT 1 Reply Last reply Reply Quote 0
              • Tom ElliottT
                Tom Elliott @FlareImp
                last edited by

                @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 Reply Quote 0
                • F
                  FlareImp @Tom Elliott
                  last edited by

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

                  Tom ElliottT S 2 Replies Last reply Reply Quote 0
                  • Tom ElliottT
                    Tom Elliott @FlareImp
                    last edited by

                    @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

                      @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
                      • First post
                        Last post

                      211

                      Online

                      12.0k

                      Users

                      17.3k

                      Topics

                      155.2k

                      Posts
                      Copyright © 2012-2024 FOG Project