New relic infra agent not restarted - elasticsearch

We are using New Relic infrastructure agent from last 2 yrs but after 13th Nov 2019 suddenly its not working. Then I update the version of newrelic to 5.2.3.131. But the problem is not resolve. The problem is i’m unable to restart new relic infra agent.
I used below commands…
echo “license_key: ${NEW_RELIC_LICENSE_KEY}” | sudo tee /etc/newrelic-infra.yml
sudo curl -o /etc/yum.repos.d/newrelic-infra.repo https://download.newrelic.com/infrastructure_agent/linux/yum/el/6/x86_64/newrelic-infra.repo
sudo yum -q makecache -y --disablerepo=’*’ --enablerepo=‘newrelic-infra’
sudo yum install newrelic-infra -y
sudo initctl restart newrelic-infra
Application hosted aws elastic beanstalk.
I’m getting initctl: Unknown instance.
Deatails error are below…
INFO [7168] - [Application update pem.pem-staging.f6e105eb760.20191117-164558#668/AppDeployStage0/EbExtensionPostBuild/Infra-EmbeddedPostBuild/postbuild_1_PEM/Command 04-configure_new_relic] : Activity execution failed, because: license_key: XXXXXXXXXXXXXXXX
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:–:-- --:–:-- --:–:-- 0
100 239 100 239 0 0 2091 0 --:–:-- --:–:-- --:–:-- 2096
Loaded plugins: priorities, update-motd, upgrade-helper
Package newrelic-infra-1.7.1-1.x86_64 already installed and latest version
Nothing to do
initctl: Unknown instance:
(ElasticBeanstalk::ExternalInvocationError)

in my case it looks:
.ebextensions/new_relic.yml
packages:
yum:
newrelic-sysmond: []
rpm:
newrelic: http://yum.newrelic.com/pub/newrelic/el5/x86_64/newrelic-repo-5-3.noarch.rpm
commands:
"01":
command: nrsysmond-config --set license_key=XXXXXXXXXXXXXXXXXXXX
"02":
command: echo hostname=$SERVER_URL >> /etc/newrelic/nrsysmond.cfg
"03":
command: /etc/init.d/newrelic-sysmond start
You might not need '02' command

Problem is new relic end. I have solved this temporarily by using below commands...
cat /etc/newrelic-infra.yml
ps aux | grep newrelic-infra
Just kill all processes returned by the ps command above with kill -9 pid1 pid2...
Then start the service with sudo initctl start newrelic-infra
It's now working fine.

Related

Command succeeds within docker manually but not through bash script

The introduction
I am currently trying to build a docker image with all of my node project dependencies, so I can use it to run the tests on Bitbucket Pipelines.
The reason I decided to create an image was due to the fact I want to be in control of what version of the dependencies I have, and to control when to upgrade them accordingly.
The implementation
After having built the image using the following dockerfile:
FROM selenium/standalone-chrome-debug
LABEL name="nodejs-chrome-java"
USER root
# Install Java 8
RUN set -x \
&& apt-get update \
&& apt-get install -y \
ca-certificates-java \
openjdk-8-jre-headless \
openjdk-8-jre \
openjdk-8-jdk-headless \
openjdk-8-jdk \
&& apt-get clean
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64/
RUN export JAVA_HOME
# Install node 10 and npm
RUN set -x \
&& curl -sL https://deb.nodesource.com/setup_14.x | bash - \
&& apt-get update \
&& apt-get install -y nodejs \
&& npm install -g npm#latest \
&& apt-get clean
# Make node available
RUN set -x \
&& touch ~/.bashrc \
&& echo 'alias nodejs=node' > ~/.bashrc
# Install PhantomJS
RUN set -x \
&& apt-get update \
&& apt-get install -y \
phantomjs \
&& apt-get clean
# Set PhantomJS to run headless
ENV QT_QPA_PLATFORM offscreen
RUN mkdir /logs
RUN touch /logs/selenium.log
I executed the docker image using the following command:
docker run -it --entrypoint /bin/bash -v /my/project:/project -w /project <DOCKER_IMAGE_ID>
And I realised that in order to have selenium running, I would have to run the following command:
/opt/bin/start-selenium-standalone.sh
Which yields the following output:
22:14:13.034 INFO [GridLauncherV3.parse] - Selenium server version: 3.141.59, revision: e82be7d358
22:14:13.304 INFO [GridLauncherV3.lambda$buildLaunchers$3] - Launching a standalone Selenium Server on port 4444
2020-06-29 22:14:13.466:INFO::main: Logging initialized #1128ms to org.seleniumhq.jetty9.util.log.StdErrLog
22:14:14.228 INFO [WebDriverServlet.<init>] - Initialising WebDriverServlet
22:14:14.547 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 4444
However, because I do not want the command line within the container to get stuck, I tried the following instead:
/opt/bin/start-selenium-standalone.sh > /logs/selenium.log 2>&1 &
Which indeed outputs the same content as stated before, into the log file I defined (/logs/selenium.log) when creating the docker image. So, so far so good 👍
And if I then run my tests using the npm test command, all tests pass successfully. 🎉
Given this outcome, and because when I use this image within the Bitbucket Pipelines I wouldn't be able to run this command manually, I decided to include the line that starts the standalone selenium server in the background, on my bash script that gets executed when I call npm test, like so:
#!/bin/bash
printf "Starting Selenium Server"
/opt/bin/start-selenium-standalone.sh > /logs/selenium.log 2>&1 &
PROCESS_ID=$!
retry=0
maxRetries=10
until [ ${retry} -ge ${maxRetries} ]
do
grep "Selenium Server is up and running on port 4444" /logs/selenium.log > /dev/null \
&& echo \
&& break;
retry=$[${retry}+1]
printf . ;
sleep 1
done
if [ ${retry} -ge ${maxRetries} ]; then
echo "Failed after ${maxRetries} attempts!"
exit 1
fi
printf "Running UI tests...\n"
CONFIG_FILE_PATH='../../config_test.json' ./node_modules/.bin/nightwatch
The problem
When the command gets included into the bash script to be executed from there, it seems like the command cannot be executed on the same way as when it's done so manually. And I get the following on the log file:
22:29:12.814 INFO [GridLauncherV3.parse] - Selenium server version: 3.141.59, revision: e82be7d358
22:29:13.093 INFO [GridLauncherV3.lambda$buildLaunchers$3] - Launching a standalone Selenium Server on port 4444
2020-06-30 22:29:13.253:INFO::main: Logging initialized #1602ms to org.seleniumhq.jetty9.util.log.StdErrLog
22:29:14.058 INFO [WebDriverServlet.<init>] - Initialising WebDriverServlet
22:29:14.381 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 4444
22:29:21.121 INFO [ActiveSessionFactory.apply] - Capabilities are: {
"acceptSslCerts": true,
"browserName": "chrome",
"chromeOptions": {
"w3c": false,
"args": [
"headless",
"no-sandbox"
]
},
"javascriptEnabled": true,
"name": "Route Subdomain Dashboard Test"
}
22:29:21.128 INFO [ActiveSessionFactory.lambda$apply$11] - Matched factory org.openqa.selenium.grid.session.remote.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService)
/my/project/node_modules/chromedriver/lib/chromedriver/chromedriver: 1: /my/project/node_modules/chromedriver/lib/chromedriver/chromedriver: Syntax error: ")" unexpected
22:29:41.214 ERROR [OsProcess.checkForError] - org.apache.commons.exec.ExecuteException: Process exited with an error: 2 (Exit value: 2)
And the following output from my running tests:
⠴ Connecting to 127.0.0.1 on port 4444...
Response 500 POST /wd/hub/session (20425ms)
{
value: {
error: [
"Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'",
"System info: host: '75136e9ec116', ip: '172.17.0.2', os.name: 'Linux', os.arch: 'amd64', os.version: '4.19.76-linuxkit', java.version: '1.8.0_252'",
'Driver info: driver.version: unknown'
],
message: 'Timed out waiting for driver server to start.'
},
status: 13
⚠ Error connecting to 127.0.0.1 on port 4444.
_________________________________________________
TEST FAILURE: 1 error during execution; 0 tests failed, 0 passed (24.402s)
✖ route-subdomain-dashboard-test
An error occurred while retrieving a new session: "Timed out waiting for driver server to start."
Error: An error occurred while retrieving a new session: "Timed out waiting for driver server to start."
at endReadableNT (_stream_readable.js:1224:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
Error: An error occurred while retrieving a new session: "Timed out waiting for driver server to start."
at endReadableNT (_stream_readable.js:1224:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
The question
Is there anything I am missing that would allow the command to be successfully executed through the bash script? Why am I seeing such disparate results?
The appreciation
Sorry for the long post, but I think I needed to provide as much context as possible, since it seems a very tricky problem that I've been struggling for quite some time now.
Many thanks in advance 🙏
Updates
02/10/2020 - I realised today that once inside the docker image, if I execute the npm test command in order to run the tests, I have the issue described under the section named The problem. However, if I run the bash script that I created and that npm test command is calling under the hood, I have the tests successfully executed. Could it be the way that npm executes the scripts?

how to deal "failed to connect to Kubernetes master ip"

I started learn Kubernetes, so I follow this guide https://kubernetes.io/docs/setup/turnkey/gce/
I got an error after I run "cluster/kube-up.sh"
Waiting up to 300 seconds for cluster initialization.
This will continually check to see if the API for kubernetes is reachable.
This may time out if there was some uncaught error during start up.
.........................................................................................................................................Cluster failed to initialize within 300 seconds.
Last output from querying API server follows:
% Total % Received % Xferd Average Speed Time Time Time current
             Dload Upload Total Spent Left speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (7) Failed to connect to "[kubernetes-master (external IP)]"
So I tried to search about this error. And then found one solution. It said go to the "cluster/gce/config-default.sh"
secret: $(dd if=/dev/urandom iflag=fullblock bs=32 count=1 2>/dev/null | base64 | tr -d '\r\n')
And then change 'dd' to 'gdd'. So I modified config-default.sh, But it doesn't work.
I don't know how to fix it. Is there are any solution about this error ?̊̈ Also in the /var/logs there are no logs about Kubernetes. Where logs are saved ?̊̈
My Mac version: mas OS Mojave
version: 10.14.3
Looks like GDD is only available in MacOS, about the Kubernetes logs you can have a look at this other article. If you would have a Google Kubernetes Engine cluster it would be easier to check the log by looking at Stackdriver.

Getting deployment error when deploying sample script in Developer composer playground

I'm trying to setup the development environment for composer by following the steps in the tutorial. I was able to generate the .bna file successfully and use it in the online playground. But when I try to deploy the .bna file to the fabric V1.0 running in my local, I get the below error.
ubuntu#ip-172-31-8-83:~/fabric-tools/my-network$ cd dist
ubuntu#ip-172-31-8-83:~/fabric-tools/my-network/dist$ composer network
deploy -a my-network.bna -p hlfv1 -i PeerAdmin -s randomString
Deploying business network from archive: my-network.bna
Business network definition:
Identifier: my-network#0.0.1
Description: The Hello World of Hyperledger Composer samples
events.js:160
throw er; // Unhandled 'error' event
^
Error: event message must be properly signed by an identity from the same organization as the peer: [failed deserializing event creator: [Expected MSP ID Org1MSP, received ]]
at ClientDuplexStream._emitStatusIfDone (/home/ubuntu/.nvm/versions/node/v6.11.0/lib/node_modules/composer-cli/node_modules/grpc/src/node/src/client.js:189:19)
at ClientDuplexStream._receiveStatus (/home/ubuntu/.nvm/versions/node/v6.11.0/lib/node_modules/composer-cli/node_modules/grpc/src/node/src/client.js:169:8)
at /home/ubuntu/.nvm/versions/node/v6.11.0/lib/node_modules/composer-cli/node_modules/grpc/src/node/src/client.js:634:14
My docker images are as follows:
ubuntu#ip-172-31-8-83:~/fabric-tools/my-network/dist$ docker ps -a
CONTAINER ID IMAGE COMMAND
CREATED STATUS PORTS
NAMES
80c9949edf73 hyperledger/fabric-peer:x86_64-1.0.0-beta "peer
node start -..." 19 minutes ago Up 19 minutes 0.0.0.0:7051-
>7051/tcp, 0.0.0.0:7053->7053/tcp peer0.org1.example.com
126f6381cc90 hyperledger/fabric-couchdb:x86_64-1.0.0-beta "tini --
/docker-e..." 19 minutes ago Up 19 minutes 4369/tcp, 9100/tcp,
0.0.0.0:5984->5984/tcp couchdb
924081546fa1 hyperledger/fabric-ca:x86_64-1.0.0-beta "sh -c
'fabric-ca-..." 19 minutes ago Up 19 minutes 0.0.0.0:7054-
>7054/tcp ca.example.com
d13f2c8e8421 hyperledger/fabric-orderer:x86_64-1.0.0-beta "orderer"
19 minutes ago Up 19 minutes 0.0.0.0:7050->7050/tcp
orderer.example.com
Node version is: 4.2.6
npm version is : 3.5.2
Docker version 17.06.0-ce, build 02c1d87
Can someone tell me how to resolve this?
you need to be at the latest Node level - you're currently at 4.2.6 - you need to be at node version 6.x
https://hyperledger.github.io/composer/unstable/installing/development-tools.html
I assume you're using Ubuntu 14.04 or 16.0x LTS ..

Logstash install error: can't get unique system GID (no more available GIDs)

I am trying to install logstash with yum on a red hat vm, I already have the logstash.repo file setup according to the guide and i ran
yum install logstash
but I get the following error after it downloads everything
...
logstash-2.3.2-1.noarch.rpm | 72 MB 00:52
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
groupadd: Can't get unique system GID (no more available GIDs)
useradd: group 'logstash' does not exist
error: %pre(logstash-1:2.3.2-1.noarch) scriptlet failed, exit status 6
Error in PREIN scriptlet in rpm package 1:logstash-2.3.2-1.noarch
error: install: %pre scriptlet failed (2), skipping logstash-1:2.3.2-1
Verifying : 1:logstash-2.3.2-1.noarch 1/1
Failed:
logstash.noarch 1:2.3.2-1
Complete!
I can't find much information about this. Any suggestions?
groupadd determines gids for the creation of regular groups from the /etc/login.defs file.
In my centos 6 box. /etc/login.defs contains following two lines:
#
# Min/max values for automatic gid selection in groupadd
#
GID_MIN 500
GID_MAX 60000
For system accounts add these two lines to your /etc/login.defs
# System accounts
SYS_GID_MIN 100
SYS_GID_MAX 499
I updated the SYS_GID_MAX Value and it worked for me.

Running selenium on a headless EC2 machine?

I have a headless EC2 M1.Small instance running Ubuntu. I have been trying to use it to run a selenium test coded in Ruby. I am running selenium server 2.0b3 (the latest).
i have enabled XVFB:
$ sudo startx -- which Xvfb :1 -screen 0 1024x768x24 2>&1 >/dev/null &
[1] 1119
$ DISPLAY=:1 java -jar Automation/ruby-selenium-framework/selenium-server-1.0.3/selenium-server.jar > /tmp/selenium_log.log &
[2] 1245
And then run my code:
$ ./BTRuby.rb coverage_
I get the following output to the selenium log:
14:11:27.448 INFO - Command request: getNewBrowserSession[*firefox, URL, , ] on session null
14:11:27.448 INFO - creating new remote session
14:11:27.448 INFO - Allocated session 4b1395b136174ab798eddd6a59d8e308 for URL, launching...
14:11:27.488 INFO - Preparing Firefox profile...
14:11:30.709 INFO - Launching Firefox...
14:11:35.873 INFO - Got result: OK,4b1395b136174ab798eddd6a59d8e308 on session 4b1395b136174ab798eddd6a59d8e308
14:11:35.878 INFO - Command request: setTimeout[30000000, ] on session 4b1395b136174ab798eddd6a59d8e308
14:11:35.937 INFO - Got result: OK on session 4b1395b136174ab798eddd6a59d8e308
14:11:36.007 INFO - Command request: open[URL, ] on session 4b1395b136174ab798eddd6a59d8e308
Can anyone provide any help? It just seems to hang at this last INFO line.
BTW, the URL variable is a valid URL that I have stripped out for purposes of this question
sudo startx -- which Xvfb :1 -screen 0 1024x768x24 2>&1 >/dev/null &
DISPLAY=:1 java -jar selenium-server-1.0.3/selenium-server.jar > /tmp/selenium_log.log &
was able to do the trick

Resources