[Prometheus]Couldn't load silences - ubuntu-14.04

I configure alermanager.conf:
notification_config {
name: "alert_test"
email_config {
email: "annt#gmail.com"
}
}
aggregation_rule {
repeat_rate_seconds: 3600
notification_config_name: "alert_test"
}
Then, I execute command: ./alertmanager -config.file alertmanager.conf and it displays notice:
Couldn't load silences, starting up with empty silence list: open silences.json: no such file or directory file=main.go line=81
how to fix this error???
Thanks!

This is a warning that it can't find the silence file, this is normal the first time you start the alertmanager and haven't created any silences yet.

Related

How can logstash identify and parse the newly created logfiles?

I'm new in ELK and currently I'm facing the following issue.
I want logstash to parse some server logfiles. Everyday, a new logfile is created which it has the following naming format: file160629.log (where 160629=current date)
Here's my config input:
input {
file {
path => "C:\LogFiles\u_ex%d.log"
start_position => beginning
}
}
But as it seems, it doesn't recognize the new logfiles..
Can someone tell me what am I doing wrong?
Thank you in advance.
For all the log files inside LogFiles folder you can use :
input {
file {
path => "C:\LogFiles\*.log"
}
}
It will tail files by default.

Ordering with creating and reading a file in Puppet

I know it is something with the catalog that is the issue, I just can't figure out how to work around it.
I have the following code and I get the following error:
class test1 {
file { '/tmp/test.txt':
ensure => present,
content => 'name=joe',
}
}
class test2 {
$test = file('/tmp/test.txt')
notify { $test: }
}
class test3 {
class { 'test1': } ->
class { 'test2': }
}
puppet apply -e "include test3"
Error: Could not find any files from test.txt at ../modules/test2/manifests/init.pp
So essentially, I am trying to read a file before it exists, and the ordering doesn't appear to be working. Any ideas how I can work around this?
Based on the description of the function you are trying to utilize it will never operate in the fashion you are trying.
file:
Loads a file from a module and returns its contents as a string.
Affectively what this means is that the file would exist in
test1/files/test.txt
And would be loaded using:
file('test1/test.txt') i.e. file(<MODULENAME>/<FILENAME>)

Why do I get a "connot be applied to 'Closure'" Warning in my gradle script?

I have a hard time figuring out, why IntelliJ warns me about this part in my build.gradle file:
apply plugin: 'distribution'
(...)
distributions {
main {
baseName = 'someName'
contents {
from { 'src/readme' }
}
}
}
shot:
I took it straight from the gradle user guide and the build seems to work ok. So, is this a false positive or should I take this serious? If so, what's the problem here and how would one check the API / code to find the expected types and so on?
it is a false positive, but if you want to make it disappear use the following
apply plugin: 'distribution'
distributions.create('someNameButMain', {
baseName = 'someName'
contents {
from { 'src/readme' }
}
})

Logstash expected one of #

I'm currently trying to run Lostash with the following config file:
input {
stdin { }
}
output {
rabbitmq {
exchange => "test_exchange"
exchange_type => "fanout"
host => "172.17.x.x"
}
}
I do however get an error:
logstash agent --configtest -f -config.conf
gives me:
Error: Expected one of #, } at line 1, column 105 (byte 105) after output { rabbitmq { exchange => test_exchange exchange_type => fanout host => 172.17
It seems that logstash has the problem when I put an IP-like address in the host field. What is wrong with my config?
The whole problem was in the method you used when created the config.conf file.
You were using the following command:
echo "input {stdin{}} output{rabbitmq{exchange=>"test_exchange" exchange_type =>"fanout" host=>"172.17.x.x"}}"
Surrounding a string containing double quotes with double quotes isn't a good idea...
By using single quotes around the string, the problem is solved...
echo 'input {stdin{}} output{rabbitmq{exchange=>"test_exchange" exchange_type =>"fanout" host=>"172.17.x.x"}}'
The real problem is that logstash doesn't report access problems to the configuration file correctly. Here is the issue on github:
https://github.com/elastic/logstash/issues/2571
Simply check access permissions and you'll be set.

Puppet: unable to get hiera variable

I've been using hiera for several weeks now and all was working fine til few days ago when i started to get that kind of message:
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not find data item nom in any Hiera data file and no default supplied on node d0puppetclient.victor-buck.com
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
So i tried to make a very simple test to check if the problem came from my last code changes and i'm still getting this message. I can't get hiera variable anymore.
Below the test i made:
hiera.yaml:
---
:backends:
- yaml
:yaml:
:datadir: /etc/puppet/hieradata
:hierarchy:
- common
site.pp:
# /etc/puppet/manifests/site.pp
case $operatingsystem {
'Solaris': { include role::solaris }
'RedHat', 'CentOS': { include redhat::roles::common }
/^(Debian|Ubuntu)$/: { include role::debian }
# default: { include role::generic }
}
case $hostname {
/^d0puppetclient/: { include test }
}
test.pp:
class test{
$nom = hiera('nom')
file {"/root/test.txt":
ensure => file,
source => "/etc/puppet/test.txt.erb",
}
}
test.txt.erb:
<%= nom %>
Any idea about to fix this? I thought this could be an file access right issue, so i tried to grante access on some files (755) and it's not working...
You need to define nom in your common.yaml in order for it to hold a value. You can set a default value and conditionally create the file if you don't plan on setting it.
class test {
$nom = hiera('nom', false)
if $nom {
file { '/root/test.txt':
ensure => file,
content => template('test/test.txt.erb')
}
}
}
Notice how i used content instead of source. When using erb templates you need to specify the content using the template() function.
Using Templates
If you use source it is expecting a file rather than an erb template.
Hope this helps.

Resources