Some useful
List stacks or apps
Run the specified Compose file
List running services associated with an app
List tasks associated with an app
Inspect task or container
List container IDs
Tear down an application
Take down a single node swarm from the manager
#docker #cheatsheet #inspect #stack #swarm #service
docker
commands:docker stack ls
List stacks or apps
docker stack deploy -c <composefile> <appname>
Run the specified Compose file
docker service ls
List running services associated with an app
docker service ps <service>
List tasks associated with an app
docker inspect <task or container>
Inspect task or container
docker container ls -q
List container IDs
docker stack rm <appname>
Tear down an application
docker swarm leave --force
Take down a single node swarm from the manager
#docker #cheatsheet #inspect #stack #swarm #service
How to monitor network cards on
Ok for now we have added the plugin to nagios folder and ran some tests on target server's network interfaces. We need to add a command to
In brief it creates a new command called
Now we need to use this command in a service. We have to create a new service which will be used in our hosts configuration sections
Again in brief the service will be applied on hosts that have a variable section of
The final part is to add this service to your desired host. Go to
Add the service like below into your host:
You can go even further like me :) and add these data into
#icinga2 #icinga #service #host #command #nagios #interface #network
Icinga2
? (part-2)Ok for now we have added the plugin to nagios folder and ran some tests on target server's network interfaces. We need to add a command to
Icinga2
to use it in service section of Icinga2
. To create a new command create a new file in /etc/icinga2/conf.d/commands/check_nwc_command.conf
and with the following content:object CheckCommand "YOUR_COMMAND_NAME" {
import "plugin-check-command"
command = [ PluginDir + "/check_nwc_health", "--mode", "interface-usage" ]
arguments = {
"-H" = "$address$"
"-C" = "$community$"
"--name" = "$int$"
}
}
In brief it creates a new command called
YOUR_COMMAND_NAME
that calls the script check_nwc_health
with interface-usage
argument to get the bandwidth data.Now we need to use this command in a service. We have to create a new service which will be used in our hosts configuration sections
/etc/icinga2/conf.d/services/if_traffic.conf
:apply Service for (display_name => config in host.vars.int) {
import "generic-service"
check_command = "YOUR_COMMAND_NAME"
vars += config
assign where host.vars.int
}
Again in brief the service will be applied on hosts that have a variable section of
int
in their configuration that we will see a little bit later. YOUR_COMMAND_NAME
is the name that we have given in the first part when creating the command.The final part is to add this service to your desired host. Go to
/etc/icinga2/conf.d/hosts
and open the file which relates to your host. Host files content start with:object Host "host-54 (Infra)" {
Add the service like below into your host:
vars.int["YOUR DISPLAY NAME"] = {
int = "Device 1af4:0001 2"
community = "YOUR SERVER COMMUNITY STRING"
}
int
is the part that we give the interface name, this should be given from the output of list-interfaces
in part-1.You can go even further like me :) and add these data into
Grafana
dashboard to have a better understanding of what is happening around you.#icinga2 #icinga #service #host #command #nagios #interface #network
https://askubuntu.com/questions/919054/how-do-i-run-a-single-command-at-startup-using-systemd
#linux #systemd #systemctl #service
#linux #systemd #systemctl #service
Ask Ubuntu
How do I run a single command at startup using systemd?
I'd like to startup an Apache Spark cluster after boot using the following command:
sudo ./path/to/spark/sbin/start-all.sh
Then run this command when the system prepares to reboot/shutdown:
sudo ...
sudo ./path/to/spark/sbin/start-all.sh
Then run this command when the system prepares to reboot/shutdown:
sudo ...