https://www.puppet.com/community logo
Join Slack
Powered by
# puppet
  • k

    Ken

    03/16/2023, 3:02 PM
    What's the simplest way of determining if you have any inactive/offline puppet clients?
  • k

    Ken

    03/16/2023, 3:03 PM
    I've been querying the heck out of puppetdb and got nothing. There must be a fact, like 'last checkin' or something...right?
  • v

    vchepkov

    03/16/2023, 3:05 PM
    I do this
    Copy code
    old_timestamp=$(date -u -d '-7 days' -Isec)
    /opt/puppetlabs/bin/puppet-query "nodes[certname]{catalog_timestamp < \"$old_timestamp\"}" | jq -r '.[].certname'
    đź‘€ 1
  • d

    David Sandilands

    03/16/2023, 3:06 PM
    also just for awareness https://voxpupuli.org/docs/pql_queries/ is handy in general
    👍 1
    ❤️ 2
  • k

    Ken

    03/16/2023, 3:18 PM
    Thanks - so I've installed the cli tools and jq, but I'm getting an error:
    Copy code
    old_timestamp=$(date -u -d '-7 days' -Isec)
    /opt/puppetlabs/bin/puppet-query "nodes[certname]{catalog_timestamp < \"$old_timestamp\"}" | jq -r '.[].certname'
  • k

    Ken

    03/16/2023, 3:18 PM
    FATAL: Last PuppetDB API response code.
  • v

    vchepkov

    03/16/2023, 3:19 PM
    does puppet query work to begin with?
  • v

    vchepkov

    03/16/2023, 3:19 PM
    does puppet query work to begin with?
  • v

    vchepkov

    03/16/2023, 3:19 PM
    puppet query "nodes{}"
  • k

    Ken

    03/16/2023, 3:20 PM
    nope, same thing.
  • k

    Ken

    03/16/2023, 3:20 PM
    guess my cli tools is broke
  • v

    vchepkov

    03/16/2023, 3:20 PM
    yep
  • k

    Ken

    03/16/2023, 3:27 PM
    aight, I think I found the problem. Looks like I need to mkdir /etc/puppetlabs/client-tools/, then create a puppetdb.conf with this in it -
    Copy code
    {
      "puppetdb": {
        "server_urls": "https://<PUPPETDB_HOST>:8081",
        "cacert": "/etc/puppetlabs/puppet/ssl/certs/ca.pem",
        "cert": "/etc/puppetlabs/puppet/ssl/certs/<WORKSTATION_HOST>.pem",
        "key": "/etc/puppetlabs/puppet/ssl/private_keys/<WORKSTATION_HOST>.pem"
      }
    }
  • k

    Ken

    03/16/2023, 3:30 PM
    YUS! It worked! LOL
  • k

    Ken

    03/16/2023, 3:34 PM
    Well, puppet query works now, but I still cannot see that I do indeed have a puppet client that has been powered down for a couple of days. The puppetdb dashboard on 8080 still shows 3 active nodes, zero inactive, and my query also is not returning anything that I can use that will let tell me when a client is down. I must be missing something.
  • k

    Ken

    03/16/2023, 3:34 PM
    and yes, I changed my variable - ld_timestamp=$(date -u -d '-7 days' -Isec)
    Copy code
    ld_timestamp=$(date -u -d '-1 days' -Isec)
  • v

    vchepkov

    03/16/2023, 3:35 PM
    that means you get data from those nodes that you think are 'inactive'
  • v

    vchepkov

    03/16/2023, 3:35 PM
    check output of
    Copy code
    puppet query "nodes{}"
  • v

    vchepkov

    03/16/2023, 3:36 PM
    it should show various timestamps
  • k

    Ken

    03/16/2023, 3:36 PM
    roger, that gives me my puppet server, and two clients (pupcli_one, pupcli_two)
  • k

    Ken

    03/16/2023, 3:37 PM
    yea, both clients have timestamps from yesterday.
  • k

    Ken

    03/16/2023, 3:38 PM
    be great if I could find any that have been down for, say, over two hours. Think I'll fiddle with that now.
  • s

    Slackbot

    03/16/2023, 3:45 PM
    This message was deleted.
    s
    k
    • 3
    • 5
  • s

    Slackbot

    03/16/2023, 3:54 PM
    This message was deleted.
    c
    y
    +4
    • 7
    • 51
  • c

    Corporate Gadfly

    03/16/2023, 3:58 PM
    [SOLVED]: CI started failing with following
    pdk
    error while running tests. Any ideas?
    Copy code
    [2023-03-16T15:39:30.859Z] + /opt/puppetlabs/pdk/bin/pdk test unit --format=junit:report.xml --format=text:stdout --puppet-version 7
    [2023-03-16T15:39:31.110Z] pdk (WARN): This module is compatible with an older version of PDK. Run `pdk update` to update it to your version of PDK.
    [2023-03-16T15:39:31.110Z] pdk (INFO): Using Ruby 2.7.7
    [2023-03-16T15:39:31.110Z] pdk (INFO): Using Puppet 7.23.0
    [2023-03-16T15:39:39.138Z] pdk (ERROR): The spec_clean rake task failed with the following error(s):
    [2023-03-16T15:39:39.138Z] 
    [2023-03-16T15:39:39.138Z] rake aborted!
    [2023-03-16T15:39:39.138Z] LoadError: cannot load such file -- puppet_blacksmith/rake_tasks
    [2023-03-16T15:39:39.138Z] /data/jenkins/workspace/puppet_control_qa/site/profiles/Rakefile:7:in `require'
    [2023-03-16T15:39:39.138Z] /data/jenkins/workspace/puppet_control_qa/site/profiles/Rakefile:7:in `<top (required)>'
    [2023-03-16T15:39:39.138Z] /opt/puppetlabs/pdk/share/cache/ruby/2.7.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
    [2023-03-16T15:39:39.138Z] (See full trace by running task with --trace)
    [2023-03-16T15:39:39.138Z] 
    [2023-03-16T15:39:39.138Z] pdk (FATAL): Failed to clean up after running unit tests
  • l

    Lumiere

    03/16/2023, 4:45 PM
    For puppetdb, is a list of strings or converting the list to a comma separated string better for storage (number of facts/string lengths etc)
  • s

    Slackbot

    03/16/2023, 4:47 PM
    This message was deleted.
    nodding 1
    n
    y
    i
    • 4
    • 10
  • r

    rmeden

    03/16/2023, 9:21 PM
    Thank you @vchepkov @natemccurdy... the push to answer the questions led me to figure things out! It turns out the schedule tag in a virtual resource wasn't actually a metaparameter, but a normal parameter. I must have made a typo when I was originally trying to use it. I have decoded (and documented) the spaghetti code left by a predecessor. Basically, hiera sets an array, a proftpd class picks it up and passes to to a passwd class (in a different module, only used by the proftpd class!), which realizes the virtual resource. I suspect metaparameters are never really enforced by defined resources, but by the code that implements them. In this case, all it did was pass the schedule parameter on to the augeas resource which did follow the schedule tag, but all the cpu intensive work done before is frequently not used. I will be rewriting this to be more efficient when I migrate it to a new puppet master. Thanks again!
  • r

    rmeden

    03/16/2023, 9:23 PM
    [SOLVED] @natemccurdy actually, not a class but a resource. Right now passwords for a ftp user are autogenerated via the schedule metaparameter, but that seems to only effect the actual modification of the passwd file. A lot of time is spent generating the random password that won't be used because the schedule isn't triggered. Trying to improve the performance of a class that I'm not totally up to speed on (person who created it, is long gone)
  • d

    David Sandilands

    03/16/2023, 11:36 PM
    Puppet Content and Tooling Releases Supported modules puppetlabs-chocolatey v7.0.1 The chocolatey module is a package provider allowing for the use of Chocolatey in package resources. Chocolatey is the largest online registry of Windows packages. Key features/changes: Fixed • Resolved issues with sensitive parameters being exposed in debugging logs. Full changelog Feedback https://github.com/puppetlabs/puppetlabs-chocolatey/issues puppetlabs-apt v9.0.2 The apt module Provides an interface for managing APT (Advanced Package Tool) source, key, and definitions with Puppet. APT is a package manager available on Debian, Ubuntu, and several other operating systems Key features/changes Fixed • Allowed for package names to contain dots when marking removed global scoping of variables apt::pin default changed from empty string to undef Full changelog Feedback https://github.com/puppetlabs/puppetlabs-apt/issues Development tools puppet-editor-services v1.3.1 A ruby based implementation of a Language Server and Debug Server for the Puppet Language. This tool can then be used within editors to validate and debug Puppet code. Key features/changes Fixed • Resolved depenpency issues by using a realpath • Fix NoMethodError in puppet_strings_helper.rb Full changelog Feedback https://github.com/puppetlabs/puppet-editor-services/issues
1...328329330...428Latest