what is the puppet agent status on the machine?

Bob Yoplait picture Bob Yoplait · Mar 30, 2015 · Viewed 71k times · Source

I know about

puppet agent --disable "my message"  --verbose

but I would like to know at some point on a given machine, what is its puppet agent status. I don't see how to do it from

man puppet-agent

Is there an command that would tell me if the agent is enabled or disabled ?

Thank you.

-

------------------- EDIT

CentOS release 6.6 (Final)

bash-4.1$ puppet --version
3.7.4
bash-4.1$ file /usr/bin/puppet 
/usr/bin/puppet: a /usr/bin/ruby script text executable

------------------- EDIT2

Whether it is enabled or disabled, I always get this:

[root@p1al25 ~]# cat `sudo puppet agent --configprint agent_catalog_run_lockfile`
cat: /var/lib/puppet/state/agent_catalog_run.lock: No such file or directory
[root@p1al25 ~]# puppet agent --disable "my message"
[root@p1al25 ~]# cat `sudo puppet agent --configprint agent_catalog_run_lockfile`
cat: /var/lib/puppet/state/agent_catalog_run.lock: No such file or directory
[root@p1al25 ~]# service puppet status
puppet (pid  4387) is running...

------------------- EDIT3

This one worked, thanks daxlerod

[root@p1al25 ~]# service puppet status
puppet (pid  4387) is running...
[root@p1al25 ~]# puppet agent --disable "my message" --verbose
Notice: Disabling Puppet.
[root@p1al25 ~]# cat `puppet agent --configprint agent_disabled_lockfile` 
{"disabled_message":"reason not specified"}

Answer

daxlerod picture daxlerod · Mar 31, 2015

A one-liner to get the current status is:

cat `puppet agent --configprint agent_disabled_lockfile`

Generally, this must be run as root, so I use:

sudo cat `sudo puppet agent --configprint agent_disabled_lockfile`

There are a number of possible results.

  • cat: \path\to\lock: No such file or directory Puppet is not disabled.
  • Any other text means that puppet is disabled, and the text is the reason provided when puppet was disabled by puppet agent --disable 'reason'