Re: [Puppet Users] PuppetDB resources are not available

2016-05-31 Thread Harish Kothuri
Hi Wyatt,

I now have a custom fact using powershell commands to get the installed 
software's for windows machines.

*PS Command:-* 
Get-ItemProperty 
HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | 
where{$_.DisplayName -and $_.displayname -notmatch 'Update'} | 
Select-Object DisplayName, DisplayVersion | ForEach-Object {Write-Host 
$_.DisplayName"="$_.DisplayVersion}

*Output:-*
ActiveState ActiveTcl 8.4.20.0 = 8.4.20.0
Microsoft .NET Framework 4 Client Profile = 4.0.30319
Microsoft .NET Framework 4 Extended = 4.0.30319
Notepad++ = 6.9.1
Microsoft .NET Framework 4 Extended = 4.0.30319
Puppet = 3.8.7
Microsoft Visual C++ 2012 Redistributable (x86) - 11.0.61030 = 11.0.61030.0
Microsoft .NET Framework 4 Client Profile = 4.0.30319
MSXML 4.0 SP2 Parser and SDK = 4.20.9818.0
Microsoft Visual C++ 2008 Redistributable - x86 9.0.30729.17 = 9.0.30729
VC9.0 SP0 Debug CRT DLLs = 1.0.0
Microsoft Visual C++ 2012 x86 Additional Runtime - 11.0.61030 = 11.0.61030
Microsoft Visual C++ 2012 x86 Minimum Runtime - 11.0.61030 = 11.0.61030
Microsoft Visual C++ 2010  x86 Redistributable - 10.0.40219 = 10.0.40219
ActivePerl 5.16.3 Build 1603 = 5.16.1603

Thanks,
Harish

On Thursday, May 19, 2016 at 1:11:17 AM UTC+5:30, Wyatt Alt wrote:
>
> Harish,
>
> The reason for that is the resources returned by puppet resource come from 
> the RAL, rather than PuppetDB. If you were to declare puppet resources with 
> the content included in your paste, then they would show up in PuppetDB. 
>
> PuppetDB will only include version information on package resources if the 
> package is managed by puppet and the version is specified in the resource 
> declaration. The most straightforward way to get information on all 
> packages installed (e.g not managed by Puppet) into PuppetDB is to create a 
> custom fact. I saw a module posted to the forge to do this the other day: 
> https://forge.puppet.com/rmueller/pkg_inventory
>
> Looks like it currently supports only redhat but if you're on something 
> else you should be able to get an idea of how to adapt it based on the fact 
> defined here: 
> https://github.com/roman-mueller/rmueller-pkg_inventory/blob/master/lib/facter/pkg_inventory.rb
>  
> .
>
> Given the fact you could get the data by querying 
> localhost:8080/v4/facts/packages, assuming the name of the fact is 
> "packages".
>
> Hope that helps.
>
> Wyatt
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/b2d8ef64-438f-46da-8385-390378591198%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] PuppetDB resources are not available

2016-05-18 Thread Wyatt Alt
Harish,

The reason for that is the resources returned by puppet resource come from
the RAL, rather than PuppetDB. If you were to declare puppet resources with
the content included in your paste, then they would show up in PuppetDB.

PuppetDB will only include version information on package resources if the
package is managed by puppet and the version is specified in the resource
declaration. The most straightforward way to get information on all
packages installed (e.g not managed by Puppet) into PuppetDB is to create a
custom fact. I saw a module posted to the forge to do this the other day:
https://forge.puppet.com/rmueller/pkg_inventory

Looks like it currently supports only redhat but if you're on something
else you should be able to get an idea of how to adapt it based on the fact
defined here:
https://github.com/roman-mueller/rmueller-pkg_inventory/blob/master/lib/facter/pkg_inventory.rb
.

Given the fact you could get the data by querying
localhost:8080/v4/facts/packages, assuming the name of the fact is
"packages".

Hope that helps.

Wyatt

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CAJDiH3FrcyX9-BV9jSOocbi3V_4NAfBg9zNJsCTz5F%2BBSrD7rw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] PuppetDB resources are not available

2016-05-18 Thread Harish Kothuri
Hi Wyatt,

Thanks for your quick reply !

I do get some response for /v3/resources/Package , but it does not contain 
any information about software's installed on node and it's versions. 

My data of interest is similar to following ( I got this from node when i 
issue *"puppet resource package"*) . Please help.

package { 'Notepad++':
  ensure => '6.9.1',
}
package { 'Puppet':
  ensure => '3.8.7',
}
package { 'Realtek Ethernet Controller Driver':
  ensure => '7.87.529.2014',
}

Thanks

On Thursday, May 19, 2016 at 12:16:13 AM UTC+5:30, Wyatt Alt wrote:
>
> Hey Harish,
>
> Your issue could be that trailing backslash. PuppetDB is likely 
> interpretting it as a query for all resources with type "" (i.e empty 
> string).
>
> You should be able to get all package resources with 
> /v3/resources/Package, and you can restrict that to a given node with
>
> curl -X GET http://:8080/v3/resources/Package -d 
> 'query=["=","certname","example.com"]'
>
> Wyatt
>
>
>
> On 05/18/2016 11:08 AM, Harish Kothuri wrote:
>
> Hi Ken, 
>
> Thanks for your reply.
>
> I got the resource and catalog endpoints working after changing the 
> confdir ownership with " sudo chown -R puppet:puppet `sudo puppet config 
> print confdir`".
>
> Now, i just need to get the resource list for all machines or for a 
> specific machine. I can't seem to find the resource/package list from " 
> http://sdin-swt-ctf-01:8080/v3/resources/; 
>
> Plz help.
>
> Thanks
>
> On Wednesday, May 18, 2016 at 6:47:17 PM UTC+5:30, Ken Barber wrote: 
>>
>> So at a high level  
>>
>> The resources are populated from successful Puppet runs that submit 
>> their catalogs to PuppetDB. So step 1, run puppet agent -t or 
>> whatever, if you aren't seeing something like this in your 
>> puppetdb.log: 
>>
>> 2016-05-18 14:12:28,855 INFO  [command-proc-3055] [p.p.command] 
>> [898d1f2d-f96b-450f-a627-7fb90eb7d491] [replace catalog] 
>> macbook-pro-9.lan 
>>
>> Then the connection between puppet master & puppetdb is not configured 
>> correctly, these instructions cover that: 
>>
>> https://docs.puppet.com/puppetdb/4.0/connect_puppet_master.html 
>>
>> (adjust for your version of PuppetDB, which looks like its a 2.x to me) 
>>
>> You should also check your puppet master logs to see if there are any 
>> errors while submitting the catalog. 
>>
>> ken. 
>>
>> On Wed, May 18, 2016 at 7:21 AM, Harish Kothuri  
>> wrote: 
>> > Hi, 
>> > 
>> > I am trying to access resources from PuppetDB API as follows, API makes 
>> a 
>> > successful call but empty response. 
>> > 
>> > API call: 
>> > curl -X GET 'http://sdin-swt-ctf-01:8080/v3/resources/' 
>> > 
>> > Ouput: 
>> > [ ] 
>> > 
>> > Is there anything that i need to enable to populate the same? 
>> > 
>> > 
>> > Thanks 
>> > 
>> > -- 
>> > You received this message because you are subscribed to the Google 
>> Groups 
>> > "Puppet Users" group. 
>> > To unsubscribe from this group and stop receiving emails from it, send 
>> an 
>> > email to puppet-users...@googlegroups.com. 
>> > To view this discussion on the web visit 
>> > 
>> https://groups.google.com/d/msgid/puppet-users/ca08dcc7-f58b-462e-b9ab-6c6dd5610fe8%40googlegroups.com.
>>  
>>
>> > For more options, visit https://groups.google.com/d/optout. 
>>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to puppet-users...@googlegroups.com .
> To view this discussion on the web visit 
> 
> https://groups.google.com/d/msgid/puppet-users/69a5f06d-374d-4229-9cab-9bbd98e1c4f5%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/f51215df-1364-4f51-9c5a-7c7d9f15e069%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] PuppetDB resources are not available

2016-05-18 Thread Wyatt Alt

Hey Harish,

Your issue could be that trailing backslash. PuppetDB is likely 
interpretting it as a query for all resources with type "" (i.e empty 
string).


You should be able to get all package resources with 
/v3/resources/Package, and you can restrict that to a given node with


curl -X GET http://:8080/v3/resources/Package -d 
'query=["=","certname","example.com"]'


Wyatt



On 05/18/2016 11:08 AM, Harish Kothuri wrote:

Hi Ken,

Thanks for your reply.

I got the resource and catalog endpoints working after changing the 
confdir ownership with " sudo chown -R puppet:puppet `sudo puppet 
config print confdir`".


Now, i just need to get the resource list for all machines or for a 
specific machine. I can't seem to find the resource/package list from 
" http://sdin-swt-ctf-01:8080/v3/resources/;


Plz help.

Thanks

On Wednesday, May 18, 2016 at 6:47:17 PM UTC+5:30, Ken Barber wrote:

So at a high level 

The resources are populated from successful Puppet runs that submit
their catalogs to PuppetDB. So step 1, run puppet agent -t or
whatever, if you aren't seeing something like this in your
puppetdb.log:

2016-05-18 14:12:28,855 INFO  [command-proc-3055] [p.p.command]
[898d1f2d-f96b-450f-a627-7fb90eb7d491] [replace catalog]
macbook-pro-9.lan

Then the connection between puppet master & puppetdb is not
configured
correctly, these instructions cover that:

https://docs.puppet.com/puppetdb/4.0/connect_puppet_master.html


(adjust for your version of PuppetDB, which looks like its a 2.x
to me)

You should also check your puppet master logs to see if there are any
errors while submitting the catalog.

ken.

On Wed, May 18, 2016 at 7:21 AM, Harish Kothuri
 wrote:
> Hi,
>
> I am trying to access resources from PuppetDB API as follows,
API makes a
> successful call but empty response.
>
> API call:
> curl -X GET 'http://sdin-swt-ctf-01:8080/v3/resources/
'
>
> Ouput:
> [ ]
>
> Is there anything that i need to enable to populate the same?
>
>
> Thanks
>
> --
> You received this message because you are subscribed to the
Google Groups
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from
it, send an
> email to puppet-users...@googlegroups.com .
> To view this discussion on the web visit
>

https://groups.google.com/d/msgid/puppet-users/ca08dcc7-f58b-462e-b9ab-6c6dd5610fe8%40googlegroups.com

.

> For more options, visit https://groups.google.com/d/optout
.

--
You received this message because you are subscribed to the Google 
Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to puppet-users+unsubscr...@googlegroups.com 
.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/69a5f06d-374d-4229-9cab-9bbd98e1c4f5%40googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "Puppet 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/ef1cf576-d3f1-dfa6-6c6f-8d9a8a33ece6%40puppet.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] PuppetDB resources are not available

2016-05-18 Thread Harish Kothuri
Hi Ken,

Thanks for your reply.

I got the resource and catalog endpoints working after changing the confdir 
ownership with " sudo chown -R puppet:puppet `sudo puppet config print 
confdir`".

Now, i just need to get the resource list for all machines or for a 
specific machine. I can't seem to find the resource/package list from 
" http://sdin-swt-ctf-01:8080/v3/resources/; 

Plz help.

Thanks

On Wednesday, May 18, 2016 at 6:47:17 PM UTC+5:30, Ken Barber wrote:
>
> So at a high level  
>
> The resources are populated from successful Puppet runs that submit 
> their catalogs to PuppetDB. So step 1, run puppet agent -t or 
> whatever, if you aren't seeing something like this in your 
> puppetdb.log: 
>
> 2016-05-18 14:12:28,855 INFO  [command-proc-3055] [p.p.command] 
> [898d1f2d-f96b-450f-a627-7fb90eb7d491] [replace catalog] 
> macbook-pro-9.lan 
>
> Then the connection between puppet master & puppetdb is not configured 
> correctly, these instructions cover that: 
>
> https://docs.puppet.com/puppetdb/4.0/connect_puppet_master.html 
>
> (adjust for your version of PuppetDB, which looks like its a 2.x to me) 
>
> You should also check your puppet master logs to see if there are any 
> errors while submitting the catalog. 
>
> ken. 
>
> On Wed, May 18, 2016 at 7:21 AM, Harish Kothuri  > wrote: 
> > Hi, 
> > 
> > I am trying to access resources from PuppetDB API as follows, API makes 
> a 
> > successful call but empty response. 
> > 
> > API call: 
> > curl -X GET 'http://sdin-swt-ctf-01:8080/v3/resources/' 
> > 
> > Ouput: 
> > [ ] 
> > 
> > Is there anything that i need to enable to populate the same? 
> > 
> > 
> > Thanks 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "Puppet Users" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an 
> > email to puppet-users...@googlegroups.com . 
> > To view this discussion on the web visit 
> > 
> https://groups.google.com/d/msgid/puppet-users/ca08dcc7-f58b-462e-b9ab-6c6dd5610fe8%40googlegroups.com.
>  
>
> > For more options, visit https://groups.google.com/d/optout. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/69a5f06d-374d-4229-9cab-9bbd98e1c4f5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] PuppetDB resources are not available

2016-05-18 Thread Ken Barber
So at a high level 

The resources are populated from successful Puppet runs that submit
their catalogs to PuppetDB. So step 1, run puppet agent -t or
whatever, if you aren't seeing something like this in your
puppetdb.log:

2016-05-18 14:12:28,855 INFO  [command-proc-3055] [p.p.command]
[898d1f2d-f96b-450f-a627-7fb90eb7d491] [replace catalog]
macbook-pro-9.lan

Then the connection between puppet master & puppetdb is not configured
correctly, these instructions cover that:

https://docs.puppet.com/puppetdb/4.0/connect_puppet_master.html

(adjust for your version of PuppetDB, which looks like its a 2.x to me)

You should also check your puppet master logs to see if there are any
errors while submitting the catalog.

ken.

On Wed, May 18, 2016 at 7:21 AM, Harish Kothuri  wrote:
> Hi,
>
> I am trying to access resources from PuppetDB API as follows, API makes a
> successful call but empty response.
>
> API call:
> curl -X GET 'http://sdin-swt-ctf-01:8080/v3/resources/'
>
> Ouput:
> [ ]
>
> Is there anything that i need to enable to populate the same?
>
>
> Thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to puppet-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/ca08dcc7-f58b-462e-b9ab-6c6dd5610fe8%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CAE4bNT%3D--8V37as-PiLLYuV%2BLu3ZjSJypO-HdSR_pToPAirn4Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.