Skip to content

Instantly share code, notes, and snippets.

Avatar
👨‍🎓
studying ...

Tomoyuki KOYAMA tomoyk

👨‍🎓
studying ...
View GitHub Profile
@tomoyk
tomoyk / chronograf-influxdb-nginx-visualize.md
Created Oct 15, 2020
ChronografでInfluxDBに格納したNginxログを可視化
View chronograf-influxdb-nginx-visualize.md

ChronografでInfluxDBに格納したNginxログを可視化

対象ホスト: dmz-bastion

可視化ツール Chronografを以下の手順でインストールする. https://docs.influxdata.com/chronograf/v1.8/introduction/installation/

wget https://dl.influxdata.com/chronograf/releases/chronograf_1.8.4_amd64.deb
sudo dpkg -i chronograf_1.8.4_amd64.deb
@tomoyk
tomoyk / grafana-influxdb-log-visualize.md
Last active Oct 15, 2020
GrafanaでInfluxDBに格納したNginxログを可視化
View grafana-influxdb-log-visualize.md

GrafanaでInfluxDBに格納したNginxログを可視化

reference

https://grafana.com/grafana/download

Grafanaのインストール

sudo apt-get install -y adduser libfontconfig1
View cisco-aironet-3702-setup.md

Cisco Aironetの設定 CAP-3602I-Q-K9

初期化

設定の削除

erase nvram
write default-config
> Y
View classi_status_cli.py
from colored import fg, bg, attr
import requests
r = requests.get('https://status.classi.jp/')
from bs4 import BeautifulSoup
soup = BeautifulSoup(r.text, "lxml")
status_all = soup.find_all("div", {"class": "component-inner-container"})
for status in status_all:
View openldap-install.md

環境

$ cat /etc/*release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.3 LTS"
NAME="Ubuntu"
VERSION="18.04.3 LTS (Bionic Beaver)"
@tomoyk
tomoyk / reverse_polish_notation.py
Created Jan 28, 2020
逆ポーランド記法の構文解析やってみた
View reverse_polish_notation.py
in_txt = '13 5 4 + 3 / 4 * -'.split(' ')
symbols = ('+', '-', '*', '/')
stack = []
print("input::", ' '.join(in_txt))
for i,_ in enumerate(in_txt):
# FOUND NUM
if in_txt[i] not in symbols:
stack.append(int(in_txt[i]))
continue
@tomoyk
tomoyk / get-ldap-keys.sh
Created Nov 11, 2019
SSH LDAP Wrapper supported multiple keys
View get-ldap-keys.sh
#!/bin/bash
user="${1}"
host="ldap://example.com"
base="dc=example,dc=com"
filter1="(& (objectClass=posixAccount) (uid=${user}))"
filter2="sshPublicKey"
id "$user" >/dev/null 2>&1
RESULT=$(ldapsearch -x -LLL -H "$host" -b "$base" "$filter1" "$filter2" \
View event-noc-note.md
View logstash-grok.md

logstashの設定をするときのメモ

デバッグ用

以下が基本のパターン

patterns_dir を書かずに message 以降にそのままパターンを書いても良さそう

input {
@tomoyk
tomoyk / dhcpd-lease-table.py
Last active Oct 26, 2019
print dhcpd.lease (isc dhcpd) to table-format
View dhcpd-lease-table.py
#!/usr/bin/env python3.6
def parse_file(file_name: str):
import re
with open(file_name, "r") as file:
file_content = file.read()
file_content = re.sub(r"#.*\n(\n)?|server-duid.+;\n", r'', file_content)
lease_logs = [fc for fc in re.split(r"\n}\n*", file_content)]
You can’t perform that action at this time.