### Start Docker Containers Source: https://github.com/snuids/nyx/blob/master/running_locally.md Initializes the platform services using docker-compose. ```shell docker-compose up -d ``` -------------------------------- ### Check REST API Health Status Source: https://context7.com/snuids/nyx/llms.txt Verify the operational status of the NYX REST API using a GET request. ```bash # Check REST API health status curl -X GET "https://YOUR_DOMAIN/api/v1/status" # Expected response when healthy: # Returns JSON with API status information indicating the service is running ``` -------------------------------- ### Deploy NYX with Docker Compose Source: https://context7.com/snuids/nyx/llms.txt Commands to initialize the platform, manage Elasticsearch permissions, and monitor container health. ```bash # Navigate to the docker-compose directory and start all services cd nyx/docker-compose docker-compose up -d # Fix Elasticsearch permissions if needed (first run) cd ../ELK/esnodebal chmod ugo+rw -R * docker restart esnodebal # Verify all containers are running docker ps -a # Check for stopped containers (should return empty if all healthy) docker ps -a | grep -v Up # View logs for a specific container docker logs --tail 100 nginx docker logs -f esnodebal ``` -------------------------------- ### List All Docker Containers Source: https://github.com/snuids/nyx/blob/master/troubleshooting.md Use this command to view all containers, including those that are stopped. Ensure you have root privileges. The output should show containers in an 'Up' status. ```bash docker ps -a ``` -------------------------------- ### View Container Logs Source: https://github.com/snuids/nyx/blob/master/troubleshooting.md Displays the last 100 lines of logs for a specified container to assist in debugging startup failures. ```bash docker logs --tail 100 nginx ``` -------------------------------- ### Restart Nginx Container Source: https://github.com/snuids/nyx/blob/master/troubleshooting.md Use this command to resolve potential race conditions or startup errors with the Nginx container. ```bash docker restart nginx ``` -------------------------------- ### Docker Management Commands Source: https://context7.com/snuids/nyx/llms.txt Common CLI commands for monitoring, restarting, and managing the lifecycle of NYX platform containers. ```bash # List all containers and their status docker ps -a # Restart a specific service docker restart nginx docker restart nyx_restapi docker restart esnodebal # View container logs docker logs --tail 100 nginx docker logs -f nyx_restapi # Start all services after configuration changes cd /home/nyx/docker-compose docker-compose up -d # Stop all services docker-compose down # Rebuild and restart a specific service docker-compose up -d --build nyx_restapi # Check disk usage (Elasticsearch needs < 75% disk) df -h du -sh /home/elkdata/* ``` -------------------------------- ### Find Docker Compose File Source: https://github.com/snuids/nyx/blob/master/troubleshooting.md Navigate to the root directory and use this command to recursively search for the 'docker-compose.yml' file. This is necessary to locate the correct configuration for restarting services. ```bash cd / find . -name "docker-compose.yml" ``` -------------------------------- ### Restart and Configure esnodebal Source: https://github.com/snuids/nyx/blob/master/running_locally.md Restarts the esnodebal container and provides the command to modify system limits if errors occur. ```shell docker restart esnodebal ``` ```shell sudo vi /etc/security/limits.conf ``` -------------------------------- ### Configure Logstash Log Processing Source: https://context7.com/snuids/nyx/llms.txt Sets up TCP and file inputs with Grok filtering and conditional Elasticsearch output routing. ```ruby # nyx/logstash/config/logstash.conf input { tcp { port => 5001 codec => json type => tcp add_field => { "server" => 1 "isource" => "tcp" } } file { type => "camelworker" start_position => "end" path => [ "/var/log/logs/camelworker1.log" ] tags => ["camelworker1"] add_field => { "program" => "camelworker1" "server" => 1 "isource" => "camelworker" } } } filter { if [isource] == "camelworker" { grok { patterns_dir => "/usr/share/logstash/config/patterns" match => { "message" => "%{CAMELWORKER}" } remove_tag => ["_grokparsefailure"] } } } output { if [isource] == "camelworker" and "ERROR" in [loglevel] { elasticsearch { hosts => ["esnodebal:9200"] } } if [isource] == "tcp" { elasticsearch { hosts => ["esnodebal:9200"] } } } ``` -------------------------------- ### Check Disk Usage Source: https://github.com/snuids/nyx/blob/master/troubleshooting.md Commands to monitor partition fill levels and directory sizes, which is critical for ElasticSearch performance. ```bash df -h ``` ```bash du -sh . ``` -------------------------------- ### Navigate to Docker Compose Directory Source: https://github.com/snuids/nyx/blob/master/troubleshooting.md Change the current directory to the location of the 'docker-compose.yml' file found in the previous step. This is a prerequisite for executing the docker-compose command. ```bash cd /home/nyx/docker-compose/ ``` -------------------------------- ### Identify Non-Running Docker Containers Source: https://github.com/snuids/nyx/blob/master/troubleshooting.md This command filters the output of 'docker ps -a' to show only containers that are not in the 'Up' status. An empty list indicates all containers are running correctly. ```bash docker ps -a | grep -v Up ``` -------------------------------- ### Configure Apache Camel ETL Routes Source: https://context7.com/snuids/nyx/llms.txt Defines message routes and connection beans for ActiveMQ and PostgreSQL in a Spring XML configuration. ```xml {"error": "OK", "type": "lifesign", "module": "CamelWorker1", "version": "v1.3.0", "alive": 1} nyx_log ``` -------------------------------- ### Configure ElastAlert Monitoring Source: https://context7.com/snuids/nyx/llms.txt Defines global settings for Elasticsearch connectivity, polling frequency, and metadata storage. ```yaml # nyx/elastalert/config.yaml # Folder containing alert rule definitions rules_folder: rules # Query frequency run_every: seconds: 10 # Buffer period for delayed log sources buffer_time: minutes: 15 # Elasticsearch connection es_host: esnodebal es_port: 9200 # Metadata storage index writeback_index: elastalert skip_invalid: True # Alert retry period alert_time_limit: days: 2 ``` -------------------------------- ### Curator Index Lifecycle Policies Source: https://context7.com/snuids/nyx/llms.txt YAML configuration for Curator to automate the deletion of logstash, module info, and API call log indices based on age. ```yaml actions: 1: action: delete_indices description: Delete logstash indices older than 20 days options: ignore_empty_list: True disable_action: False filters: - filtertype: pattern kind: prefix value: logstash- - filtertype: age source: name direction: older timestring: '%Y.%m.%d' unit: days unit_count: 20 2: action: delete_indices description: Delete module info indices older than 7 days options: ignore_empty_list: True disable_action: False filters: - filtertype: pattern kind: prefix value: nyx_module_info- - filtertype: age source: name direction: older timestring: '%Y.%m.%d' unit: days unit_count: 7 3: action: delete_indices description: Delete API call logs older than 14 days options: ignore_empty_list: True disable_action: False filters: - filtertype: pattern kind: prefix value: nyx_apicalls- - filtertype: age source: name direction: older timestring: '%Y.%m.%d' unit: days unit_count: 14 ``` -------------------------------- ### Access Elasticsearch via Proxy Source: https://context7.com/snuids/nyx/llms.txt Interact with the Elasticsearch cluster using basic authentication through the nginx proxy. ```bash # Query Elasticsearch nodes status through secure proxy curl -u username:password "https://YOUR_DOMAIN:9200/_cat/nodes?format=json&pretty" # Query cluster allocation status curl -u username:password "https://YOUR_DOMAIN:9200/_cat/allocation?format=json&pretty" # Bulk insert data into Elasticsearch curl -X POST "http://esnodebal:9200/_bulk" \ -H "Content-Type: application/json" \ -d '{"index":{"_index":"nyx_module_info-2024.01.15","_type":"_doc"}} {"error":"OK","type":"lifesign","module":"CamelWorker1","version":"v1.3.0","alive":1,"@timestamp":1705315200000} ' ``` -------------------------------- ### Elasticsearch Node Configuration Source: https://context7.com/snuids/nyx/llms.txt Configuration settings for an Elasticsearch node, including cluster naming, network binding, and remote reindexing whitelist. ```yaml # nyx/ELK/esnodebal/conf/elasticsearch.yml cluster.name: "nyxdata-cluster" network.host: 0.0.0.0 # Single node discovery for development/small deployments discovery.type: single-node # Node configuration node.name: esnodebal node.data: true node.master: true # Allow reindexing from remote sources reindex.remote.whitelist: app.rpinum.be:9200 ``` -------------------------------- ### Nginx Reverse Proxy Configuration Source: https://context7.com/snuids/nyx/llms.txt Nginx configuration for routing traffic to microservices, including SSL termination and Redis-based session authentication for Kibana. ```nginx # nyx/nginx/default.conf - Key route configurations # REST API endpoint location /api/ { proxy_set_header X-Real-IP $remote_addr; proxy_http_version 1.1; proxy_set_header Connection ""; proxy_pass http://nyx_restapi:8000; proxy_redirect off; } # Kibana with Redis session authentication location /kibana/ { resolver 127.0.0.11; access_by_lua_block{ local redis = require "resty.redis" local red = redis:new() red:set_timeout(1000) local ok, err = red:connect("redis", 6379) if not ok then ngx.exit(ngx.HTTP_FORBIDDEN) return end tok = ngx.var.cookie_nyx_kibana if not tok then ngx.exit(ngx.HTTP_NOT_ACCEPTABLE) return end rediskey = "nyx_kibana_" .. tok local res, err = red:get(rediskey) if res == ngx.null then ngx.exit(ngx.HTTP_NOT_ALLOWED) return end } proxy_pass http://kibana:5601/; proxy_redirect off; } # Node-RED workflow editor location /nodered/ { proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_pass http://nodered:1880; proxy_redirect off; } # Main UI application location / { proxy_pass http://nyx_ui:7654; proxy_redirect off; } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.