send event to local datadog agent via shell - shell

I'm trying to send events to my local datadog agent by shell through DataStatsD port. The message is sent without errors but doesn't reach the dashboard.
I use datadog agent in version 6.9 and use datadog documentation:
https://docs.datadoghq.com/developers/dogstatsd/datagram_shell/#send-metrics-and-events-using-dogstatsd-and-the-shell
When I try to send metrics is work fine and I see the metrics in the datadog dashboard but when I send events it's doesn't show in the dashboard.
I also see that when I send event via shell and then check agent status the number of metrics packets go up but the number of events is still 0.
That's the command i run:
~$ title="Event from the shell"
~$ text="This was sent from Bash!"
~$ echo “_e{${#title},${#text}}:$title|$text|#shell,bash"
>/dev/udp/localhost/8125
Edit When I changed the following configuration properties it's work.
The configuration I changed:
1) dogstatsd_non_local_traffic: yes
2) bind_host: localhost

Related

Accessing NIFI UI remotely

I did install Nifi on Linux, updated the nifi properties
nifi.web.https.host='ip address where nifi is running'
nifi.web.https.port=8443
Yet when i try to launch browser
https://ip:8443/nifi
i am unable to launch the Nifi UI. Kindly let me know if anything else has to be set in the NIFI properties to access the UI remotely
What I would do is check that the NiFi service/process is running properly. If the NiFi service isnt running properly, then getting it to run will help solve the issues. However, if it is running, I would check that the port is open using a command such as netstat -an | grep 8443 to show what is listening on that port. You can then connect to whatever the netstat command shows. Also check the nifi.properties file to confirm that the information being used is properly set and configured.

Connect to Jenkins server via SSH

I was wondering if I can ssh a local instance of Jenkins. When I go to Jenkins CLI menu in the UI, there's a comment saying the below:
You can access various features in Jenkins through a command-line
tool. See the documentation for more details of this feature. To get
started, download jenkins-cli.jar, and run it as follows:
java -jar jenkins-cli.jar -s http://localhost:8080/ -webSocket help
So I tried it and it worked but it only gave a list of limited commands which I can execute. So I searched more and found I can use -ssh instead of -webSocket but I get the same result as -webSocket.
What I want to do is accessing the Jenkins bash so I can test my build scripts.
I'm trying
ssh 127.0.0.1 -p 23 // I set this port in the settings
but I keep getting :
shell request failed on channel 0
is it impossible what I'm trying to do? if not, how can I achieve it?

Can't create external initiators from chainlink CLI

We're trying to set external initiators to our chainlink containers deployed in GKE cluster according to the docs: https://docs.chain.link/docs/external-initiators-in-nodes/
I log into the the pod:
kubectl exec -it -n chainlink chainlink-75dd5b6bdf-b4kwr -- /bin/bash
And there I attempt to create external initiators:
root#chainlink-75dd5b6bdf-b4kwr:/home/root# chainlink initiators create xxx xxx
No help topic for 'initiators'
I don’t even see initiators in chainlink cli options:
root#chainlink-75dd5b6bdf-b4kwr:/home/root# chainlink
NAME:
chainlink - CLI for Chainlink
USAGE:
chainlink [global options] command [command options] [arguments...]
VERSION:
0.9.10#7cd042c1a94c57219ed826a6eab46752d63fa67a
COMMANDS:
admin Commands for remotely taking admin related actions
attempts, txas Commands for managing Ethereum Transaction Attempts
bridges Commands for Bridges communicating with External Adapters
config Commands for the node's configuration
job_specs Commands for managing Job Specs (jobs V1)
jobs Commands for managing Jobs (V2)
keys Commands for managing various types of keys used by the Chainlink node
node, local Commands for admin actions that must be run locally
runs Commands for managing Runs
txs Commands for handling Ethereum transactions
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS:
--json, -j json output as opposed to table
--help, -h show help
--version, -v print the version
Chainlink version 0.9.10.
Could you please clarify what am I doing wrong?
You need to make sure you have the FEATURE_EXTERNAL_INITIATORS environment variable set to true in your .env file as such:
FEATURE_EXTERNAL_INITIATORS=true
This will open up access to the initiators command in the Chainlink CLI and you can resume the instructions from there.

Why does ApplicationStart timeout with AWS code deploy?

I am using codedeploy to deploy a springboot app to an ec2. But I keep getting a script timeout error. I event set the timeout to 60 seconds event tho the application always starts up within 20 seconds. The application starts up fine. I run top on the linux instance and see the java process started up. I can then use postman to hit the http status check endpoint and confirm that it has started up successfully. But this is what it looks like in the code deploy console:
The appspec.yml file looks like this
The server_start.sh file looks like this.
Why is this happening? Thanks.
I think this has more to do with how Linux process works than with Code Build. I'm far from being a specialist on that, but according to with AWS documentation, there is a certain way you must use to start your long-running processes, as a Java application
The syntax is:
#!/bin/bash
/tmp/sleep.sh > /dev/null 2> /dev/null < /dev/null &
Replace the sleep by your Java command.
More details here
You should put some some codes of your script to the BeforeInstall or AfterInstall.
remove java -jar application.jar
BeforeInstall – You can use this deployment lifecycle event for preinstall tasks, such as decrypting files and creating a backup of the current version.
Install – During this deployment lifecycle event, the CodeDeploy agent copies the revision files from the temporary location to the final destination folder. This event is reserved for the CodeDeploy agent and cannot be used to run scripts.
AfterInstall – You can use this deployment lifecycle event for tasks such as configuring your application or changing file permissions.
ApplicationStart – You typically use this deployment lifecycle event to restart services that were stopped during ApplicationStop.
Then create another bash script for your ApplicationStart. Put the line your removed earlier on this script.

Invoke a shell script execution using nagios

Hi all I am having a script which restarts all the components(.jar files) present in the server (/scripts/startAll.sh). So whenever my server goes down, I want to invoke the execution of the script using nagios, which is running on different linux server. is it possible to do so? kindly help on How to invoke execution of this script using nagios?
Event Handlers
Nagios and Naemon allow executing custom scripts, both for hosts and for services entering a 'problem state.' Since your implementation is for restarting specific applications, yours will most likely need to be service event handlers.
From Nagios Documentation:
Event handlers can be enabled or disabled on a program-wide basis by
using the enable_event_handlers in your main configuration file.
Host- and service-specific event handlers can be enabled or disabled
by using the event_handler_enabled directive in your host and service
definitions. Host- and service-specific event handlers will not be
executed if the global enable_event_handlers option is disabled.
Enabling and Creating Event Handler Commands for a Service or Host
First, enable event handlers by modifying or adding the following line to your Nagios config file.
[IE: /usr/local/nagios/etc/nagios.cfg]:
enable_event_handlers=1
Define and enable an event handler on the service failure(s) that will trigger the script. Do so by adding two event_handler directives inside of the service you've already defined.
[IE: /usr/local/nagios/etc/services.cfg]:
define service{
host_name my-server
service_description my-check
check_command my-check-command!arg1!arg2!etc
....
event_handler my-eventhandler
event_handler_enabled 1
}
The last step is to create the event_handler command named in step 2, and point it to a script you've already created. There are a few approaches to this (SSH, NRPE, Locally-Hosted, Remotely Hosted). I'll use the simplest method, hosting a BASH script on the monitor system that will connect via SSH and execute:
[IE: /usr/local/nagios/etc/objects/commands.cfg]:
define command{
command_name my-eventhandler
command_line /usr/local/nagios/libexec/eventhandlers/my-eventhandler.sh
}
In this example, the script "my-eventhandler.sh" should use SSH to connect to the remote system, and execute the commands you've decided on.
NOTE: This is only intended as a quick, working solution for one box in your environment. In practice, it is better to create an event handler script remotely, and to use an agent such as NRPE to execute the command while passing a $HOSTNAME$ variable (thus allowing the solution to scale across more than one system). The simplest tutorial I've found for using NRPE to execute an event handler can be found here.
You can run shell scripts on remote hosts by snmpd using check_by_snmp.pl
Take a view to https://exchange.nagios.org/directory/Plugins/*-Remote-Check-Tunneling/check_by_snmp--2F-check_snmp_extend--2F-check_snmp_exec/details
This is a very useful plugin for nagios. I work with this a lot.
Good luck!!

Resources