1metadata :name => "resource", 2 :description => "Information about Puppet managed resources", 3 :author => "R.I.Pienaar <rip@devco.net>", 4 :license => "ASL 2.0", 5 :version => "1.1", 6 :url => "http://puppetlabs.com/", 7 :timeout => 1 8 9usage <<-EOU 10This data resource can be used to act based the management state 11of a resource various properties related to resources of the most 12recent Puppet Catalog run. 13 14To act on machines managing /srv/www: 15 16 -S "resource('file[/srv/www]').managed = true" 17 18Or machines that had failed resources in their most recent run: 19 20 -S "resource().failed_resources > 0" 21 22Or ones that were particularly slow at applying their catalogs: 23 24 -S "resource().total_time > 360" 25EOU 26 27dataquery :description => "Puppet Managed Resources" do 28 input :query, 29 :prompt => "Resource Name", 30 :description => "Valid resource name", 31 :type => :string, 32 :validation => :puppet_resource, 33 :optional => true, 34 :maxlength => 120 35 36 output :managed, 37 :description => "Is the resource managed", 38 :display_as => "Managed", 39 :default => false 40 41 output :out_of_sync_resources, 42 :description => "Resources that were not in desired state", 43 :display_as => "Out of Sync Resources", 44 :default => -1 45 46 output :failed_resources, 47 :description => "Resources that failed to apply", 48 :display_as => "Failed Resources", 49 :default => -1 50 51 output :corrected_resources, 52 :description => "Resources that were correctively changed", 53 :display_as => "Corrected Resources", 54 :default => -1 55 56 output :changed_resources, 57 :description => "Resources that were changed", 58 :display_as => "Changed Resources", 59 :default => -1 60 61 output :total_resources, 62 :description => "Total resources managed on a node", 63 :display_as => "Total Resources", 64 :default => 0 65 66 output :total_time, 67 :description => "Total time taken to retrieve and process the catalog", 68 :display_as => "Total Time", 69 :default => 0 70 71 output :config_retrieval_time, 72 :description => "Time taken to retrieve the catalog from the master", 73 :display_as => "Config Retrieval Time", 74 :default => -1 75 76 output :lastrun, 77 :description => "When the Agent last applied a catalog in local time", 78 :display_as => "Last Run", 79 :default => 0 80 81 output :since_lastrun, 82 :description => "How long ago did the Agent last apply a catalog in local time", 83 :display_as => "Since Last Run", 84 :default => "Unknown" 85 86 output :config_version, 87 :description => "Puppet config version for the previously applied catalog", 88 :display_as => "Config Version", 89 :default => nil 90end 91