Ask Your Question
0

distinguish between manual run and timed daemon runs (pe-puppet agent)

asked 2017-03-10 00:53:57 -0500

FranzCC gravatar image

updated 2017-03-10 00:54:40 -0500

Hi, how can i distiguish between time based runs by the agent, and manual run either via puppet agent -t or mco ?
Using the PE-Console i also cannot distiguish between runs !
On every run the agent changes these files:

/opt/puppetlabs/puppet/cache/state/resources.txt
/opt/puppetlabs/puppet/cache/state/transactionstore.yaml
/opt/puppetlabs/puppet/cache/state/classes.txt
/opt/puppetlabs/puppet/cache/state/state.yaml
/opt/puppetlabs/puppet/cache/state/last_run_report.yaml
/opt/puppetlabs/puppet/cache/state/last_run_summary.yaml
/opt/puppetlabs/puppet/cache/client_data/catalog
/opt/puppetlabs/puppet/cache/client_data/catalog/client.domain.com.json

I checked these files but didn't see any difference in the way i started the agent run.

There are some security considertations to which has driven me to raise that particular question.

If not, it should be no problem to write a state file where the timer writes the time until next run in epoch format ?

Checking the file /opt/puppetlabs/puppet/lib/ruby/vendorruby/puppet/scheduler/job.rb it seems to be quite easy to write @lastrun to the puppet cache file which would solve my problem immediately.

Rgds. Franz

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2017-03-10 07:20:40 -0500

FranzCC gravatar image

updated 2017-03-13 06:40:38 -0500

It would be great to have such a feature due to security considerations !!!
Right now i developed a workaround which collects runs of a whole day (via api) and finds out server agent runs via an algo
which only takes diffs into account that exaclty matches the runinterval.
Then i do a little math to estimate the next run.
Sideeffect is, that i can, using negative match, distinguish manual runs which i then diff against logged in users.
Unfortuntely i cannot query MCO for mco runs, but i'm sure some features will be implemented in the future.
Counting on it !

Output of my solution: (Forgot)

Next Run will be: 2017-03-13T12:38:46+0100
End Run will be: 2017-03-13T12:39:02+0100
Agent raw run time: 16 seconds

Rgds. Franz

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2017-03-10 00:53:57 -0500

Seen: 20 times

Last updated: Mar 13