Posts

Showing posts from June, 2025

How to config hosts automatically link specific templates

 In zabbix server Go to Configuration -> Actions -> Create action

Zabbix agent

 https://www.zabbix.com/download_agents ------------------- create a startup.sh /path/to/zabbix_agentd -c /path/to/conf/zabbix_agentd.conf ------------------- create shutdown.sh ps -ef|grep /path/to/zabbix_agentd |grep -v grep |awk '{print $2}'  |xargs kill -9 -------------------- zabbix_agentd.conf Include=/path/to/zabbix_agent/conf/zabbix_agentd/*.conf Timeout=10 HostnameItem=system.hostname ServerActive={10.1.2.123_zabbix_server_ip} ListenPort=10050 Server=10.1.2.123 LogFileSize=10 LogFile=/path/to/logs/zabbix_agentd.log PidFile=/path/to/zabbix_agent/zabbix_agentd.pid --------------------- /path/to/conf/zabbix_agentd/example.conf example.conf ----------- UserParameter=system.test,who|wc -l UserParameter=check_cpu,./custom_script.sh UserParameter=mysql.replication.discovery[*], mysql -h"$1" -P"$2" -sNX -e "show slave status" UserParameter=mysql.slave_status, mysql -h"$1" -P"$2" -sNX -e "show slave status" -----------...

Security groups for ALB

Public ALB: -----------------------rules-------- - Inbound rules: ipv4 http tcp 80 0.0.0.0/0 ipv6 http tcp 80  ::/0 ipv4 https tcp 443 0.0.0.0/0 ipv6 https tcp 443 ::/0 - Outbound rules:  Custom TCP TCP 30000 - xxxxx      eks_cluster_security_group1 Custom TCP TCP 30000 - xxxxx      eks_cluster_security_group2 -----------------------AZ 3 different zones-------- -----------------Listeners and rules---------------- http:80   -> redirect to https://#{host}:443/#{path}?#{query} status code: HTTP_301 ------ https:443   -> Forward to target group if path pattern is /xxx/* then forward to target1 if header is zzzz then forward or redirect to target2 if 

Compress gc logs and move gc log

#!/bin/bash SOURCE_DIR="/your/path/dir" DEST_DIR="/your/dest/dir" find "$SOURCE_DIR" -type f -name "*.gc.*" -mtime +30 -not -name "*.gz" -exec gzip {} \; mkdir -p "$DEST_DIR" mv "$SOURCE_DIR"/*.gz "$DEST_DIR"/ 2>/dev/null

Amazon Linux 2023 - User data configuration for launch templates to connect to the EKS cluster

  Amazon Linux 2023 (AL2023) introduces a new node initialization process nodeadm that uses a YAML configuration schema. If you’re using self-managed node groups or an AMI with a launch template, you’ll now need to provide additional cluster metadata explicitly when creating a new node group MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="//" --// Content-Type: application/node.eks.aws --- apiVersion: node.eks.aws/v1alpha1 kind: NodeConfig spec: cluster: name: my-cluster-name-prd apiServerEndpoint: https://D59F.xyz.ap-northest-2.eks.amazonaws.com certificateAuthority: Y2VydGlmaWNhdGVBdXRob3JpdHk= cidr: 172.10.0.0/16 kubelet: config: clusterDNS: - 172.10.0.10 flags: - --node-labels=app=my-app,environment=production --// Content-Type: text/x-shellscript; charset="us-ascii" #!/bin/bash set -o errexit set -o pipefail set -o nounset # Install additional packages yum install -y htop jq iptables-services --//--