rasti.hil@hilandco.com +41 79 367-9677

Install Elasticsearch + Kibana ( ELK) on Windows

choco install curl -y
choco install 7zip -y

curl https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.6.2-windows-x86_64.zip -o elasticsearch-7.6.2-windows-x86_64.zip
mkdir  "c:/elastic"
7z x elasticsearch-7.6.2-windows-x86_64.zip -oc:/elastic
cd c:/elastic/elasticsearch-7.6.2/bin
elasticsearch-service.bat install
elasticsearch-service.bat start
curl http://localhost:9200
GUI: elasticsearch-service.bat manager


choco install nssm

curl https://artifacts.elastic.co/downloads/kibana/kibana-7.6.2-windows-x86_64.zip -o kibana-7.6.2-windows-x86_64.zip
7z x kibana-7.6.2-windows-x86_64.zip -oc:/elastic
nssm install kibana C:\elastic\kibana-7.6.2-windows-x86_64\bin\kibana.bat
sc start kibana

curl http://localhost:5601

How to verify checksum on a Mac - SHA1, SHA256


SHA1 checksum

shasum -a 1 file


SHA256 checksum

shasum -a 256 file



Installing Grafana on Windows

install

choco install grafana

Config

copy c:\ProgramData\chocolatey\lib\grafana\tools\grafana-6.3.6\conf\defaults.ini c:\ProgramData\chocolatey\lib\grafana\tools\grafana-6.3.6\conf\custom.ini

"C:\Program Files\Notepad++\notepad++.exe" c:\ProgramData\chocolatey\lib\grafana\tools\grafana-6.3.6\conf\custom.ini

http_port = 8080

Windows Service 

choco install nssm
nssm install grafana c:\ProgramData\chocolatey\lib\grafana\tools\grafana-6.3.6\bin\grafana-server.exe
sc start grafana

Config Grafana
Configuration - Data Source - name : telegraf  - url: http://localhost:8086
Dashboard - Import - https://grafana.com/grafana/dashboards/1902

Install Telegraf

choco install telegraf
"C:\Program Files\Notepad++\notepad++.exe"  C:\Program Files\telegraf\telegraf.conf
url: http://localhost:8086
database: telegraf

sc start telegraf

Installing InfluxDB on Windows

install

choco install influxdb


"C:\Program Files\Notepad++\notepad++.exe" C:\influxdata\influxdb-1.7.10-1\influxdb.conf

Storage

dir = "C:/influxdata/storage/meta"
dir = "C:/influxdata/storage/data"
wal-dir = "C:/influxdata/storage/wal"

logging

logging-enabled = true
trace-logging-enabled = false 
query-log-enabled = true

HTTP endpoint

[http]
enabled = true

c:\influxdata\influxdb-1.7.10-1/influxd.exe -config influxdb.conf

Windows Service 

choco install nssm
nssm install influxdb c:\influxdata\influxdb-1.7.10-1\influxd.exe "-config c:\influxdata\influxdb-1.7.10-1\influxdb.conf"
sc start influxdb

Installing JMeter on Windows with Influxdb and Grafana


install

choco install jmeter

Config JMeter

download:https://github.com/NovatecConsulting/JMeter-InfluxDB-Writer/releases/download/v-1.2/JMeter-InfluxDB-Writer-plugin-1.2.jar
copy to: c:\ProgramData\chocolatey\lib\jmeter\tools\apache-jmeter-5.2.1\lib\ext\

Config InfluxDB

c:\influxdata\influxdb-1.7.10-1/influx.exe
CREATE DATABASE jmeter
SHOW DATABASES

Config Grafana

Configuration - Data Source - name : jmeter  - url: http://localhost:8086
Dashboard - Import -https://grafana.com/grafana/dashboards/5496


Config Test


Ansible


Adhoc

Lookup

ansible -m debug localhost -a msg="{{ lookup('url', 'http://localhost:8090/nslookup?host=blog.hilandco.com') }}"

Docker shell2http nslookup


Dockerfile

FROM shell2http:bind-tools
RUN apk --no-cache add bind-tools


docker-compose.yml

version: '2'
services:
  nslookup_api:
    image: shell2http:bind-tools
    ports:
      - "8090:8080"
    restart: unless-stopped
    command:  [ "-form", "/nslookup", "nslookup -q=A $$v_host | tail -2 | head -1 | awk '{print $$2\" \" $$3\" \" $$4}'" ]


Test
 curl localhost:8090/nslookup?host=blog.hilandco.com

enable hyper-v on windows 2109

Enable-WindowsOptionalFeature –Online -FeatureName Microsoft-Hyper-V –All -NoRestart

Install-WindowsFeature RSAT-Hyper-V-Tools -IncludeAllSubFeature

Install-WindowsFeature RSAT-Clustering -IncludeAllSubFeature

Install-WindowsFeature Multipath-IO

Restart-Computer

Install AWX

yum install -y git

mkdir ansible
cd ansible/
export http_proxy=http://<proxy>:3128
export https_proxy=http://<proxy>:3128
export HTTP_PROXY=http://<proxy>:3128
export HTTPS_PROXY=http://<proxy>:3128
git clone https://github.com/ansible/awx.git
cd awx/installer/

yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum install -y ansible
yum install -y python-pip python-devel gcc
pip install --upgrade pip

pip uninstall docker docker-py docker-compose
pip install docker-compose

ansible-playbook -i inventory install.yml

URL

http://<awx_server>/#/home

Rest API Call


http://<awx_server>/api/v2/job_templates/33/launch/

Launching from Job Templates via the API follows the following workflow:
GET https://your.tower.server/api/v2/job_templates/&lt;your job template id>/launch/

Chocolatey Windows package management


Install Chocolatey

cmd as Admin
@powershell -NoProfile -ExecutionPolicy Unrestricted -Command "[Net.WebRequest]::DefaultWebProxy.Credentials = [Net.CredentialCache]::DefaultCredentials; iex ((New-Object Net.WebClient).DownloadString('https://chocolatey.org/install.ps1’))” && SET PATH=%PATH%;%systemdrive%\chocolatey\bin

OR

cmd as Admin
@powershell -NoProfile Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

Install Apps


Cmd as Admin

Default

choco install -y notepadplusplus
choco install -y googlechrome
choco install -y firefox
choco install -y adobereader
choco install -y totalcommander
choco install -y irfanview
choco install 7zip -y
choco install sysinternals -y

Development 


choco install -y vscode
choco install -y svn
choco install -y virtualboxchoco install -y vagrant
choco install keepass -y
choco install curl -y
choco install git -y
choco install postman -y
choco install fiddler -y
choco install terraform -y
choco install git.install -y

Mircosoft


choco install Office365ProPlus -y
choco install microsoft-teams -y
choco install skype -y
choco install powerbi -y

Azure

choco install azure-cli -y
choco install azcopy -y
choco install azure-data-studio -y

Server Software

choco install nodejs -y





choco install elasticsearch -y

Proxy

cntlm -u <user>@<domain> -H

Upgrading software

choco upgrade <packagename>.

mklink /D azure "G:\My Drive\azure"







Install Portainer

docker volume create portainer_data
docker run -d -p 9000:9000 -p 8000:8000 --name portainer --restart always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer

in case of proxy restriction


docker run -d -p 9000:9000 -p 8000:8000 --name portainer --restart always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer --env HTTPS_PROXY="http://localhost:3129" --env HTTP_PROXY="http://localhost:3129"

How to install Docker CE (community edition): on RHEL 7

install steps

yum remove docker docker-common docker-selinux docker-engine
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum -y install http://mirror.centos.org/centos/7/extras/x86_64/Packages/container-selinux-2.107-3.el7.noarch.rpm
yum install docker-ce
groupadd docker
usermod -aG docker $USER
systemctl enable docker
systemctl start docker

install docker-compose

yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum install -y python-pip python-devel gcc
pip install --upgrade pip
pip uninstall docker docker-py docker-compose
pip install docker-compose


test docker 

docker run hello-world

in case of update 

cd /var/lib/docker/containers
sed -i "s/docker-runc//g"  $(grep  -rl "docker-run")
systemctl restart docker

in case of conflict with existing network

vi /etc/docker/daemon.json
{
"bip": "192.168.200.5/24",
"default-address-pools": [ {"base":"192.168.201.0/24","size":28} ]
}

systemctl daemon-reload
systemctl restart docker


in case of proxy restriction

mkdir -p /etc/systemd/system/docker.service.d

vi /etc/systemd/system/docker.service.d/http-proxy.conf

[Service]
Environment="HTTP_PROXY=http://localhost:3129/"
Environment="HTTPS_PROXY=http://localhost:3129/"

How do I enable the remote API for dockerd


vi /etc/systemd/system/docker.service.d/startup_options.conf
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -H fd:// -H tcp://0.0.0.0:2376

systemctl daemon-reload
systemctl restart docker.service