Re: [Puppet Users] [PuppetDB] Error 500 'Failed to execute '/pdb/cmd/v1....'

2022-11-02 Thread Nir Fishler
I tried to configure it using two different methods;

   1. Installing PuppetDB via Puppet module
   2. Installing from packages
   
neither one of the above had given a complete success.

On Monday, October 31, 2022 at 12:14:31 PM UTC+2 Martin Alfke wrote:

> How did you configure puppetdb and puppetserver?
> On Open Source we usually recommend the puppetlabs-puppetdb module.
>
>
> On 31. Oct 2022, at 10:39, Nir Fishler  wrote:
>
> Hey Martin,
>
> Thanks for your reply. 
>
> There are three files underneath that directory:
>
>- puppetdb-access.log
>- puppetdb.log
>- puppetdb-status.log
>
> but all seem to be empty - 0kb
> what does that mean?
>
> On Monday, October 10, 2022 at 11:03:05 AM UTC+3 Martin Alfke wrote:
>
>> Hi Nir,
>>
>> Please check the puppetdb log file for further error investigation.
>> Usually this is located at /var/log/puppetlabs/puppetdb/puppetdb.log
>>
>> Hth,
>> Martin
>>
>>
>> On 30. Sep 2022, at 10:30, Nir Fishler  wrote:
>>
>> Hello,
>>
>> *puppetserver *version: 7.8.0  (CentOS 7) | *hostname*:  
>> puppet-staging-srv
>> *puppet *agent: 7.19
>> *puppetdb*: 7.11.0-1focal (Ubuntu 20.04) | *hostname*: 
>> puppet-staging-srv-db
>> *Postgres*: 12.12-0ubuntu0.20.04.1
>>
>> Foreman is enabled on Puppetserver.
>> Postgres is configured to work with SSL.
>>
>> Getting the below error from ANY VM on the network whenever I try to sync 
>> with Puppet master server.
>>
>> *Error message:*
>> Error: Could not retrieve catalog from remote server: Error 500 on 
>> SERVER: Server Error: Failed to execute 
>> '/pdb/cmd/v1?checksum=a0d1b67028ed455a4d8b15fd5fc846ca54d4c0a6=5=vm-ubuntu20=replace_facts=2022-09-30T07:47:13.621Z'
>>  
>> on at least 1 of the following 'server_urls': 
>> https://puppet-staging-srv-db:8081
>> Warning: Not using cache on failed catalog
>> Error: Could not retrieve catalog; skipping run
>>
>> However, When I remove the configuration files(puppetdb.conf , values 
>> from puppet.conf, routes.yaml) from the Puppet master $CONF dir, everything 
>> is back to normal and sync works.
>>
>> Connection between Puppet master and puppetdb and vice vesra:
>> [root@puppet-staging-srv puppet] *nc -zvw10 puppet-staging-srv-db 8081*
>> Ncat: Version 7.50 ( https://nmap.org/ncat )
>> Ncat: 
>> *Connected to 10.111.8.77:8081 <http://10.111.8.77:8081/>.*
>> root@puppet-staging-srv-db:~# *nc -zvw10 puppet-staging-srv 8140*
>> Connection to puppet-staging-srv 8140 port [tcp/puppet] succeeded!
>>
>> PuppetDB website is UP and shows zero data on 'Active Nodes' and most of 
>> the fields(see screenshot snap-1.png.)
>>
>> Thanks in advanced!
>>
>> -- 
>> 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/af30e761-f765-4260-978e-b4817e42f3b8n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/puppet-users/af30e761-f765-4260-978e-b4817e42f3b8n%40googlegroups.com?utm_medium=email_source=footer>
>> .
>> 
>>
>>
>>
> -- 
> 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/c8eb95ed-64fc-4900-868b-791e3b0bf94fn%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/puppet-users/c8eb95ed-64fc-4900-868b-791e3b0bf94fn%40googlegroups.com?utm_medium=email_source=footer>
> .
>
>
>

-- 
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/63bfcccd-a462-41c7-9ca4-cebf537fe968n%40googlegroups.com.


Re: [Puppet Users] Create a variable out of a bash command and notify it

2022-12-05 Thread Nir Fishler
Thanks a lot guys for your prompt reply!

Gonna try it out later on.

On Monday, December 5, 2022 at 9:47:52 AM UTC+2 dhei...@opentext.com wrote:

> Am Sonntag, dem 04.12.2022 um 07:43 -0800 schrieb Nir Fishler:
>
> Main goal: get a list of upgrade-able packages and notify the user about 
> it.
>
>
> The puppetlabs-apt module from the Puppet Forge has various facts for this.
>
> HTH...
>
> Dirk
>
> -- 
>
> *Dirk Heinrichs*
> Senior Systems Engineer, Delivery Pipeline
> OpenText ™ Discovery | Recommind
> *Phone*: +49 2226 15966 18 <+49%202226%201596618>
> *Email*: dhei...@opentext.com
> *Website*: www.recommind.de
> Recommind GmbH, Von-Liebig-Straße 1, 53359 Rheinbach
> Vertretungsberechtigte Geschäftsführer Gordon Davies, Madhu Ranganathan, 
> Christian Waida, Registergericht Amtsgericht Bonn, Registernummer HRB 10646
> This e-mail may contain confidential and/or privileged information. If you 
> are not the intended recipient (or have received this e-mail in error) 
> please notify the sender immediately and destroy this e-mail. Any 
> unauthorized copying, disclosure or distribution of the material in this 
> e-mail is strictly forbidden
> Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte 
> Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail 
> irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und 
> vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte 
> Weitergabe dieser Mail sind nicht gestattet.
>

-- 
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/af3e512b-5b91-4c2b-99bf-d9a2206c85b0n%40googlegroups.com.


[Puppet Users] Puppet filters

2022-12-17 Thread Nir Fishler
Hey Guys,

I'm trying to pull data from an array using the 'mountpoints' facter

$root_partition = $mountpoints.filter |$values| { $values[0] =~ "/$" }

the results I get are:

Notice: {/ => {device => /dev/mapper/ubuntu--vg-ubuntu--lv, filesystem => 
ext4, options => [rw, relatime], size_bytes => 262901354496, 
available_bytes => 240302788608, used_bytes => 11734274048, capacity => 
4.66%, size => 244.85 GiB, available => 223.80 GiB, used => 10.93 GiB}}
Notice: /Stage[main]/Disk_usage/Notify[{/ => {device => 
/dev/mapper/ubuntu--vg-ubuntu--lv, filesystem => ext4, options => [rw, 
relatime], size_bytes => 262901354496, available_bytes => 240302788608, 
used_bytes => 11734274048, capacity => 4.66%, size => 244.85 GiB, available 
=> 223.80 GiB, used => 10.93 GiB}}]/message: defined 'message' as '{/ => 
{device => /dev/mapper/ubuntu--vg-ubuntu--lv, filesystem => ext4, options 
=> [rw, relatime], size_bytes => 262901354496, available_bytes => 
240302788608, used_bytes => 11734274048, capacity => 4.66%, size => 244.85 
GiB, available => 223.80 GiB, used => 10.93 GiB}}'

What I need is the get the 'capacity' value out of it.


Thanks!
Nir.

-- 
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/a3de8dab-287c-40da-be6c-c8036bba38c5n%40googlegroups.com.


Re: [Puppet Users] Puppet filters

2022-12-18 Thread Nir Fishler
Perfect!

Thanks Martin.

On Sunday, December 18, 2022 at 10:35:59 AM UTC+2 Martin Alfke wrote:

> Hi Nir,
>
> do you only need the capacity from the root file system?
>
> You can access the data hash directly: 
> $facts['mountpoints']['/']['capacity']
>
> hth,
> Martin
>
>
> > On 18. Dec 2022, at 08:44, Nir Fishler  wrote:
> > 
> > Hey Guys,
> > 
> > I'm trying to pull data from an array using the 'mountpoints' facter
> > 
> > $root_partition = $mountpoints.filter |$values| { $values[0] =~ "/$" }
> > 
> > the results I get are:
> > 
> > Notice: {/ => {device => /dev/mapper/ubuntu--vg-ubuntu--lv, filesystem 
> => ext4, options => [rw, relatime], size_bytes => 262901354496, 
> available_bytes => 240302788608, used_bytes => 11734274048, capacity => 
> 4.66%, size => 244.85 GiB, available => 223.80 GiB, used => 10.93 GiB}}
> > Notice: /Stage[main]/Disk_usage/Notify[{/ => {device => 
> /dev/mapper/ubuntu--vg-ubuntu--lv, filesystem => ext4, options => [rw, 
> relatime], size_bytes => 262901354496, available_bytes => 240302788608, 
> used_bytes => 11734274048, capacity => 4.66%, size => 244.85 GiB, available 
> => 223.80 GiB, used => 10.93 GiB}}]/message: defined 'message' as '{/ => 
> {device => /dev/mapper/ubuntu--vg-ubuntu--lv, filesystem => ext4, options 
> => [rw, relatime], size_bytes => 262901354496, available_bytes => 
> 240302788608, used_bytes => 11734274048, capacity => 4.66%, size => 244.85 
> GiB, available => 223.80 GiB, used => 10.93 GiB}}'
> > 
> > What I need is the get the 'capacity' value out of it.
> > 
> > 
> > Thanks!
> > Nir.
> > 
> > -- 
> > 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/a3de8dab-287c-40da-be6c-c8036bba38c5n%40googlegroups.com
> .
>
>

-- 
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/0cd95451-576d-44e9-b55a-a37d522ddfa4n%40googlegroups.com.


Re: [Puppet Users] Create a variable out of a bash command and notify it

2022-12-18 Thread Nir Fishler
@Martin,

I have tried your approach; I put the facter file underneath:
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/custom_facts/core/execution/

*file:*
username.rb

*content:*
*# username.rb*

*Facter.add(:username) do*
*  setcode do*
*Facter::Core::Execution.execute("/usr/bin/hostname |/usr/bin/awk -F'-' 
{'print $1'}")*
*  end*
*end*

But I keep getting an error:
Error: Evaluation Error: Empty string title at 0. Title strings must have a 
length greater than zero. (line: 1, column: 8) on node 
puppet-master.domain.com

what am I missing here?
On Monday, December 5, 2022 at 10:02:09 AM UTC+2 Nir Fishler wrote:

> Thanks a lot guys for your prompt reply!
>
> Gonna try it out later on.
>
> On Monday, December 5, 2022 at 9:47:52 AM UTC+2 dhei...@opentext.com 
> wrote:
>
>> Am Sonntag, dem 04.12.2022 um 07:43 -0800 schrieb Nir Fishler:
>>
>> Main goal: get a list of upgrade-able packages and notify the user about 
>> it.
>>
>>
>> The puppetlabs-apt module from the Puppet Forge has various facts for 
>> this.
>>
>> HTH...
>>
>> Dirk
>>
>> -- 
>>
>> *Dirk Heinrichs*
>> Senior Systems Engineer, Delivery Pipeline
>> OpenText ™ Discovery | Recommind
>> *Phone*: +49 2226 15966 18 <+49%202226%201596618>
>> *Email*: dhei...@opentext.com
>> *Website*: www.recommind.de
>> Recommind GmbH, Von-Liebig-Straße 1, 53359 Rheinbach
>> Vertretungsberechtigte Geschäftsführer Gordon Davies, Madhu Ranganathan, 
>> Christian Waida, Registergericht Amtsgericht Bonn, Registernummer HRB 10646
>> This e-mail may contain confidential and/or privileged information. If 
>> you are not the intended recipient (or have received this e-mail in error) 
>> please notify the sender immediately and destroy this e-mail. Any 
>> unauthorized copying, disclosure or distribution of the material in this 
>> e-mail is strictly forbidden
>> Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte 
>> Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail 
>> irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und 
>> vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte 
>> Weitergabe dieser Mail sind nicht gestattet.
>>
>

-- 
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/703212ce-9dd7-426a-bb8d-20a0058fc3f1n%40googlegroups.com.


[Puppet Users] Create a variable out of a bash command and notify it

2022-12-04 Thread Nir Fishler
Hello,

I'd like to store an output of a bash command into a variable, and then 
print it to stdout using notify in Puppet.

Main goal: get a list of upgrade-able packages and notify the user about it.

I have tried the below but it doesn't seem to work:

$pkgs_list = $("/usr/bin/apt --simulate upgrade | grep '^Inst' | awk -F ' ' 
'{print $2}'")

notify { "STDOUT: ${pkgs_list}": }

-- 
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/9793f643-c386-4400-9fba-fd42f3e1269dn%40googlegroups.com.


Re: [Puppet Users] [PuppetDB] Error 500 'Failed to execute '/pdb/cmd/v1....'

2022-10-31 Thread Nir Fishler
Hey Martin,

Thanks for your reply. 

There are three files underneath that directory:

   - puppetdb-access.log
   - puppetdb.log
   - puppetdb-status.log
   
but all seem to be empty - 0kb
what does that mean?

On Monday, October 10, 2022 at 11:03:05 AM UTC+3 Martin Alfke wrote:

> Hi Nir,
>
> Please check the puppetdb log file for further error investigation.
> Usually this is located at /var/log/puppetlabs/puppetdb/puppetdb.log
>
> Hth,
> Martin
>
>
> On 30. Sep 2022, at 10:30, Nir Fishler  wrote:
>
> Hello,
>
> *puppetserver *version: 7.8.0  (CentOS 7) | *hostname*:  
> puppet-staging-srv
> *puppet *agent: 7.19
> *puppetdb*: 7.11.0-1focal (Ubuntu 20.04) | *hostname*: 
> puppet-staging-srv-db
> *Postgres*: 12.12-0ubuntu0.20.04.1
>
> Foreman is enabled on Puppetserver.
> Postgres is configured to work with SSL.
>
> Getting the below error from ANY VM on the network whenever I try to sync 
> with Puppet master server.
>
> *Error message:*
> Error: Could not retrieve catalog from remote server: Error 500 on SERVER: 
> Server Error: Failed to execute 
> '/pdb/cmd/v1?checksum=a0d1b67028ed455a4d8b15fd5fc846ca54d4c0a6=5=vm-ubuntu20=replace_facts=2022-09-30T07:47:13.621Z'
>  
> on at least 1 of the following 'server_urls': 
> https://puppet-staging-srv-db:8081
> Warning: Not using cache on failed catalog
> Error: Could not retrieve catalog; skipping run
>
> However, When I remove the configuration files(puppetdb.conf , values from 
> puppet.conf, routes.yaml) from the Puppet master $CONF dir, everything is 
> back to normal and sync works.
>
> Connection between Puppet master and puppetdb and vice vesra:
> [root@puppet-staging-srv puppet] *nc -zvw10 puppet-staging-srv-db 8081*
> Ncat: Version 7.50 ( https://nmap.org/ncat )
> Ncat: 
> *Connected to 10.111.8.77:8081 <http://10.111.8.77:8081>.*
> root@puppet-staging-srv-db:~# *nc -zvw10 puppet-staging-srv 8140*
> Connection to puppet-staging-srv 8140 port [tcp/puppet] succeeded!
>
> PuppetDB website is UP and shows zero data on 'Active Nodes' and most of 
> the fields(see screenshot snap-1.png.)
>
> Thanks in advanced!
>
> -- 
> 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/af30e761-f765-4260-978e-b4817e42f3b8n%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/puppet-users/af30e761-f765-4260-978e-b4817e42f3b8n%40googlegroups.com?utm_medium=email_source=footer>
> .
> 
>
>
>

-- 
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/c8eb95ed-64fc-4900-868b-791e3b0bf94fn%40googlegroups.com.