$ sudo mysql -uroot
> create database zabbix character set utf8 collate utf8_bin;
> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
> quit;
テンプレートを使ってテーブルのセットアップ。
$ zcat /usr/share/doc/zabbix-server-mysql/create.sql.gz | mysql -uzabbix -p zabbix
設定をバックアップして編集。
$ sudo gzip -k /etc/zabbix/zabbix_server.conf
$ sudo vim /etc/zabbix/zabbix_server.conf
$ diff -u <(zcat /etc/snmp/snmp.conf.gz) /etc/snmp/snmp.conf
--- /dev/fd/63 2017-07-07 16:04:36.230571510 +0000+++ /etc/snmp/snmp.conf 2017-07-07 16:04:15.106009951 +0000@@ -1,4 +1,4 @@
# As the snmp packages come without MIB files due to license reasons, loading
# of MIBs is disabled by default. If you added the MIBs you can reenable
# loading them by commenting out the following line.
-mibs :+#mibs :
/etc/snmp/snmpd.confの agentAddress行と rocommunity public行を編集する。本来は IP アドレスを制限すべきだが、LXC 内のネットワークを使用するので無制限とした。
$ diff -u <(zcat /etc/snmp/snmpd.conf.gz) /etc/snmp/snmpd.conf
--- /dev/fd/63 2017-07-07 16:07:20.342934468 +0000+++ /etc/snmp/snmpd.conf 2017-07-07 16:06:45.642011890 +0000@@ -12,9 +12,9 @@
#
# Listen for connections from the local system only
- agentAddress udp:127.0.0.1:161+#agentAddress udp:127.0.0.1:161
# Listen for connections on all interfaces (both IPv4 *and* IPv6)
-#agentAddress udp:161,udp6:[::1]:161+ agentAddress udp:161,udp6:[::1]:161@@ -47,6 +47,7 @@
# Full access from the local host
#rocommunity public localhost
+ rocommunity public 10.0.3.0/24
# Default access to basic system info
rocommunity public default -V systemonly
# rocommunity6 is for IPv6
snmpdを再起動する。
$ sudo systemctl restart snmpd
Zabbix Server から snmpwalkを使って接続をテストしてみる。下記のような表示が返ってくればOK。
zabbix-server$ snmpwak -v2c -c public 10.0.3.98
SNMPv2-MIB::sysDescr.0 = STRING: Linux snmp_agent_2 4.4.0-83-generic #106-Ubuntu SMP Mon Jun 26 17:54:43 UTC 2017 x86_64
SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (115105) 0:19:11.05
SNMPv2-MIB::sysContact.0 = STRING: Me <me@example.org>
SNMPv2-MIB::sysName.0 = STRING: snmp_agent_2
SNMPv2-MIB::sysLocation.0 = STRING: Sitting on the Dock of the Bay
SNMPv2-MIB::sysServices.0 = INTEGER: 72
SNMPv2-MIB::sysORLastChange.0 = Timeticks: (0) 0:00:00.00
SNMPv2-MIB::sysORID.1 = OID: SNMP-MPD-MIB::snmpMPDCompliance
SNMPv2-MIB::sysORID.2 = OID: SNMP-USER-BASED-SM-MIB::usmMIBCompliance
:
:
$ docker search centos
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
centos The official build of CentOS. 3475 [OK]
jdeathe/centos-ssh CentOS-6 6.9 x86_64 / CentOS-7 7.3.1611 x8... 77 [OK]
tutum/centos Simple CentOS docker image with SSH access 32
kinogmt/centos-ssh CentOS with SSH 15 [OK]
centos/postgresql-94-centos7 PostgreSQL 9.4 SQL database server 10
centos/mysql-57-centos7 MySQL 5.7 SQL database server 8
centos/php-56-centos7 PHP 5.6 platform for building and running ... 6
centos/python-35-centos7 Python 3.5 platform for building and runni... 4
centos/mongodb-26-centos7 MongoDB 2.6 NoSQL database server 4
:
$ docker search -f is-official=true centos
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
centos The official build of CentOS. 3475 [OK]
STARS が 3以上のものに絞り込みたい場合は stars=3とする。
$ docker search -f stars=3 centos
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
centos The official build of CentOS. 3475 [OK]
jdeathe/centos-ssh CentOS-6 6.9 x86_64 / CentOS-7 7.3.1611 x8... 77 [OK]
tutum/centos Simple CentOS docker image with SSH access 32
kinogmt/centos-ssh CentOS with SSH 15 [OK]
centos/postgresql-94-centos7 PostgreSQL 9.4 SQL database server 10
centos/mysql-57-centos7 MySQL 5.7 SQL database server 8
centos/php-56-centos7 PHP 5.6 platform for building and running ... 6
centos/mysql-56-centos7 MySQL 5.6 SQL database server 4
centos/mongodb-26-centos7 MongoDB 2.6 NoSQL database server 4
centos/python-35-centos7 Python 3.5 platform for building and runni... 4
centos/redis Redis built for CentOS 3 [OK]
$ docker search -f stars=3 ubuntu
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
ubuntu Ubuntu is a Debian-based Linux operating s... 6269 [OK]
rastasheep/ubuntu-sshd Dockerized SSH service, built on top of of... 91 [OK]
ubuntu-upstart Upstart is an event-based replacement for ... 74 [OK]
neurodebian NeuroDebian provides neuroscience research... 37 [OK]
ubuntu-debootstrap debootstrap --variant=minbase --components... 30 [OK]
32bit/ubuntu Ubuntu for i386 (32bit) 30
armhf/ubuntu Ubuntu is a Debian-based Linux operating s... 27
nuagebec/ubuntu Simple always updated Ubuntu docker images... 22 [OK]
tutum/ubuntu Simple Ubuntu docker images with SSH access 18
ppc64le/ubuntu Ubuntu is a Debian-based Linux operating s... 10
sameersbn/ubuntu 9 [OK]
aarch64/ubuntu Ubuntu is a Debian-based Linux operating s... 9
nimmis/ubuntu This is a docker images different LTS vers... 7 [OK]
i386/ubuntu Ubuntu is a Debian-based Linux operating s... 7
libmesos/ubuntu 3
darksheer/ubuntu Base Ubuntu Image -- Updated hourly 3 [OK]
$ docker run -dti centos
762ea423472ea002b3c28bb88841bc7a66ce5f3b2b7257404ecb022d1cc4d562
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
762ea423472e centos "/bin/bash" 7 seconds ago Up 4 seconds modest_bose
$ sudo dmidecode -t memory
# dmidecode 3.0
Getting SMBIOS data from sysfs.
SMBIOS 2.6 present.
Handle 0x000C, DMI type 16, 15 bytes
Physical Memory Array
Location: System Board Or Motherboard
Use: System Memory
Error Correction Type: None
Maximum Capacity: 16 GB
Error Information Handle: Not Provided
Number Of Devices: 2
Handle 0x000E, DMI type 17, 28 bytes
Memory Device
Array Handle: 0x000C
Error Information Handle: Not Provided
Total Width: 64 bits
Data Width: 64 bits
Size: 4096 MB
Form Factor: SODIMM
Set: None
Locator: DIMM 1
Bank Locator: DIMM 1
Type: DDR3
Type Detail: Synchronous
Speed: 1067 MHz
Manufacturer: Not Specified
Serial Number: 61B63AAE
Asset Tag: Not Specified
Part Number: Not Specified
Rank: Unknown
Handle 0x0010, DMI type 17, 28 bytes
Memory Device
Array Handle: 0x000C
Error Information Handle: Not Provided
Total Width: Unknown
Data Width: Unknown
Size: No Module Installed
Form Factor: SODIMM
Set: None
Locator: DIMM 2
Bank Locator: DIMM 2
Type: Unknown
Type Detail: Synchronous
Speed: Unknown
Manufacturer: Not Specified
Serial Number: Not Specified
Asset Tag: Not Specified
Part Number: Not Specified
Rank: Unknown
Handle 0x0012, DMI type 16, 15 bytes
Physical Memory Array
Location: System Board Or Motherboard
Use: Flash Memory
Error Correction Type: None
Maximum Capacity: 8 MB
Error Information Handle: Not Provided
Number Of Devices: 1
Handle 0x0014, DMI type 17, 28 bytes
Memory Device
Array Handle: 0x0012
Error Information Handle: Not Provided
Total Width: 8 bits
Data Width: 8 bits
Size: 8192 kB
Form Factor: TSOP
Set: None
Locator: Flash ROM
Bank Locator: Flash ROM
Type: Flash
Type Detail: Non-Volatile
Speed: Unknown
Manufacturer: Not Specified
Serial Number: Not Specified
Asset Tag: Not Specified
Part Number: Not Specified
Rank: Unknown
$ xsetwacom --list param
Area - Valid tablet area in device coordinates.
Button - X11 event to which the given button should be mapped.
ToolDebugLevel - Level of debugging trace for individual tools (default is 0 [off]).
TabletDebugLevel - Level of debugging statements applied to shared code paths between all tools associated with the same tablet (default is 0 [off]).
Suppress - Number of points trimmed (default is 2).
RawSample - Number of raw data used to filter the points (default is 4).
PressureCurve - Bezier curve for pressure (default is 0 0 100 100 [linear]).
Mode - Switches cursor movement mode (default is absolute).
TabletPCButton - Turns on/off Tablet PC buttons (default is off for regular tablets, on for Tablet PC).
Touch - Turns on/off Touch events (default is on).
HWTouchSwitchState - Touch events turned on/off by hardware switch.
Gesture - Turns on/off multi-touch gesture events (default is on).
ZoomDistance - Minimum distance for a zoom gesture (default is 50).
ScrollDistance - Minimum motion before sending a scroll gesture (default is 20).
TapTime - Minimum time between taps for a right click (default is 250).
CursorProximity - Sets cursor distance for proximity-out in distance from the tablet (default is 10 for Intuos series, 42 for Graphire series).
Rotate - Sets the rotation of the tablet. Values = none, cw, ccw, half (default is none).
RelWheelUp - X11 event to which relative wheel up should be mapped.
RelWheelDown - X11 event to which relative wheel down should be mapped.
AbsWheelUp - X11 event to which absolute wheel up should be mapped.
AbsWheelDown - X11 event to which absolute wheel down should be mapped.
AbsWheel2Up - X11 event to which absolute wheel up should be mapped.
AbsWheel2Down - X11 event to which absolute wheel down should be mapped.
StripLeftUp - X11 event to which left strip up should be mapped.
StripLeftDown - X11 event to which left strip down should be mapped.
StripRightUp - X11 event to which right strip up should be mapped.
StripRightDown - X11 event to which right strip down should be mapped.
Threshold - Sets tip/eraser pressure threshold (default is 27).
ResetArea - Resets the bounding coordinates to default in tablet units.
ToolType - Returns the tool type of the associated device.
ToolSerial - Returns the serial number of the current device in proximity.
ToolID - Returns the tool ID of the current tool in proximity.
ToolSerialPrevious - Returns the serial number of the previous device in proximity.
BindToSerial - Binds this device to the serial number.
TabletID - Returns the tablet ID of the associated device.
PressureRecalibration - Turns on/off Tablet pressure recalibration
MapToOutput - Map the device to the given output.
all - Get value for all parameters.
get デバイス名 allでタブレットの設定値をすべて呼び出す。デバイス名の指定方法は確認した限りでは2種類で、デバイス名とデバイス ID で指定する方法がある。デバイス ID は変わることがあるので注意。
$ xsetwacom --list devices
Wacom Intuos PT S 2 Pen stylus id: 9 type: STYLUS
Wacom Intuos PT S 2 Finger touch id: 10 type: TOUCH
Wacom Intuos PT S 2 Pad pad id: 11 type: PAD
$ xsetwacom --get "Wacom Intuos PT S 2 Pen stylus" all # デバイス名で指定する場合
$ xsetwacom --get 9 all # デバイスIDで指定する場合
以降はわかりやすくデバイス名 Wacom Intuos PT S 2 Pen stylusを使うことにする。
とりあえず allで全項目を見る。
$ xsetwacom --get "Wacom Intuos PT S 2 Pen stylus" all
Button: Actions are not supported by xorg.conf. Try shell format (-s) instead.
Button: Actions are not supported by xorg.conf. Try shell format (-s) instead.
Button: Actions are not supported by xorg.conf. Try shell format (-s) instead.
Property 'Wacom Hardware Touch Switch' does not exist on device.
Property 'Wacom Proximity Threshold' does not exist on device.
Property 'Wacom Wheel Buttons' does not exist on device.
Property 'Wacom Wheel Buttons' does not exist on device.
Property 'Wacom Wheel Buttons' does not exist on device.
Property 'Wacom Wheel Buttons' does not exist on device.
Property 'Wacom Wheel Buttons' does not exist on device.
Property 'Wacom Wheel Buttons' does not exist on device.
Property 'Wacom Strip Buttons' does not exist on device.
Property 'Wacom Strip Buttons' does not exist on device.
Property 'Wacom Strip Buttons' does not exist on device.
Property 'Wacom Strip Buttons' does not exist on device.
Option "Area" "0 0 15200 9500"
Option "DebugLevel" "0"
Option "CommonDBG" "0"
Option "Suppress" "2"
Option "RawSample" "4"
Option "PressCurve" "0 0 100 100"
Option "Mode" "Absolute"
Option "TPCButton" "off"
Option "Touch" "off"
Option "Gesture" "off"
Option "ZoomDistance" "0"
Option "ScrollDistance" "0"
Option "TapTime" "250"
Option "Rotate" "none"
Option "Threshold" "27"
Option "Serial" "0"
Option "PressureRecalibration" "on"
とりあえず udev か xorg.confで設定することになると思うが、とりあえずデバイス ID を調べる…。
$ lsusb
Bus 002 Device 046: ID 056a:033c Wacom Co., Ltd
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
$ udevadm info -a $(eval echo $(xinput list-props 9 | grep Node | cut -f 3))
Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.
looking at device '/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.0/0003:056A:033C.0082/input/input275/event4':
KERNEL=="event4"
SUBSYSTEM=="input"
DRIVER==""
looking at parent device '/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.0/0003:056A:033C.0082/input/input275':
KERNELS=="input275"
SUBSYSTEMS=="input"
DRIVERS==""
ATTRS{name}=="Wacom Intuos PT S 2 Pen"
ATTRS{phys}=="usb-0000:00:1d.0-1.2/input0"
ATTRS{properties}=="1"
ATTRS{uniq}==""
looking at parent device '/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.0/0003:056A:033C.0082':
KERNELS=="0003:056A:033C.0082"
SUBSYSTEMS=="hid"
DRIVERS=="wacom"
ATTRS{country}=="00"
looking at parent device '/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.0':
KERNELS=="2-1.2:1.0"
SUBSYSTEMS=="usb"
DRIVERS=="usbhid"
ATTRS{authorized}=="1"
ATTRS{bAlternateSetting}==" 0"
ATTRS{bInterfaceClass}=="03"
ATTRS{bInterfaceNumber}=="00"
ATTRS{bInterfaceProtocol}=="00"
ATTRS{bInterfaceSubClass}=="00"
ATTRS{bNumEndpoints}=="01"
ATTRS{supports_autosuspend}=="1"
looking at parent device '/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2':
KERNELS=="2-1.2"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{authorized}=="1"
ATTRS{avoid_reset_quirk}=="0"
ATTRS{bConfigurationValue}=="1"
ATTRS{bDeviceClass}=="00"
ATTRS{bDeviceProtocol}=="00"
ATTRS{bDeviceSubClass}=="00"
ATTRS{bMaxPacketSize0}=="64"
ATTRS{bMaxPower}=="498mA"
ATTRS{bNumConfigurations}=="1"
ATTRS{bNumInterfaces}==" 3"
ATTRS{bcdDevice}=="0100"
ATTRS{bmAttributes}=="80"
ATTRS{busnum}=="2"
ATTRS{configuration}==""
ATTRS{devnum}=="46"
ATTRS{devpath}=="1.2"
ATTRS{idProduct}=="033c"
ATTRS{idVendor}=="056a"
ATTRS{ltm_capable}=="no"
ATTRS{manufacturer}=="Wacom Co.,Ltd."
ATTRS{maxchild}=="0"
ATTRS{product}=="Intuos PTS"
ATTRS{quirks}=="0x0"
ATTRS{removable}=="removable"
ATTRS{speed}=="12"
ATTRS{urbnum}=="366249"
ATTRS{version}==" 2.00"
looking at parent device '/devices/pci0000:00/0000:00:1d.0/usb2/2-1':
KERNELS=="2-1"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{authorized}=="1"
ATTRS{avoid_reset_quirk}=="0"
ATTRS{bConfigurationValue}=="1"
ATTRS{bDeviceClass}=="09"
ATTRS{bDeviceProtocol}=="01"
ATTRS{bDeviceSubClass}=="00"
ATTRS{bMaxPacketSize0}=="64"
ATTRS{bMaxPower}=="0mA"
ATTRS{bNumConfigurations}=="1"
ATTRS{bNumInterfaces}==" 1"
ATTRS{bcdDevice}=="0000"
ATTRS{bmAttributes}=="e0"
ATTRS{busnum}=="2"
ATTRS{configuration}==""
ATTRS{devnum}=="2"
ATTRS{devpath}=="1"
ATTRS{idProduct}=="0024"
ATTRS{idVendor}=="8087"
ATTRS{ltm_capable}=="no"
ATTRS{maxchild}=="8"
ATTRS{quirks}=="0x0"
ATTRS{removable}=="fixed"
ATTRS{speed}=="480"
ATTRS{urbnum}=="1238"
ATTRS{version}==" 2.00"
looking at parent device '/devices/pci0000:00/0000:00:1d.0/usb2':
KERNELS=="usb2"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{authorized}=="1"
ATTRS{authorized_default}=="1"
ATTRS{avoid_reset_quirk}=="0"
ATTRS{bConfigurationValue}=="1"
ATTRS{bDeviceClass}=="09"
ATTRS{bDeviceProtocol}=="00"
ATTRS{bDeviceSubClass}=="00"
ATTRS{bMaxPacketSize0}=="64"
ATTRS{bMaxPower}=="0mA"
ATTRS{bNumConfigurations}=="1"
ATTRS{bNumInterfaces}==" 1"
ATTRS{bcdDevice}=="0410"
ATTRS{bmAttributes}=="e0"
ATTRS{busnum}=="2"
ATTRS{configuration}==""
ATTRS{devnum}=="1"
ATTRS{devpath}=="0"
ATTRS{idProduct}=="0002"
ATTRS{idVendor}=="1d6b"
ATTRS{interface_authorized_default}=="1"
ATTRS{ltm_capable}=="no"
ATTRS{manufacturer}=="Linux 4.10.0-38-generic ehci_hcd"
ATTRS{maxchild}=="3"
ATTRS{product}=="EHCI Host Controller"
ATTRS{quirks}=="0x0"
ATTRS{removable}=="unknown"
ATTRS{serial}=="0000:00:1d.0"
ATTRS{speed}=="480"
ATTRS{urbnum}=="494"
ATTRS{version}==" 2.00"
looking at parent device '/devices/pci0000:00/0000:00:1d.0':
KERNELS=="0000:00:1d.0"
SUBSYSTEMS=="pci"
DRIVERS=="ehci-pci"
ATTRS{broken_parity_status}=="0"
ATTRS{class}=="0x0c0320"
ATTRS{companion}==""
ATTRS{consistent_dma_mask_bits}=="32"
ATTRS{d3cold_allowed}=="1"
ATTRS{device}=="0x1c26"
ATTRS{dma_mask_bits}=="32"
ATTRS{driver_override}=="(null)"
ATTRS{enable}=="1"
ATTRS{irq}=="23"
ATTRS{local_cpulist}=="0-3"
ATTRS{local_cpus}=="000f"
ATTRS{msi_bus}=="1"
ATTRS{numa_node}=="-1"
ATTRS{revision}=="0x04"
ATTRS{subsystem_device}=="0x8338"
ATTRS{subsystem_vendor}=="0x10f7"
ATTRS{uframe_periodic_max}=="100"
ATTRS{vendor}=="0x8086"
looking at parent device '/devices/pci0000:00':
KERNELS=="pci0000:00"
SUBSYSTEMS==""
DRIVERS==""
適当に /etc/udev/rules.d/90-wacom.rulesを作る。
ACTION=="add", SUBSYSTEMS=="input", ATTRS{name}=="Wacom Intuos PT S 2 Pen", RUN+="/usr/bin/env XAUTHORITY=/home/me/.Xauthority DISPLAY=:0 /usr/bin/xsetwacom set 'Wacom Intuos PT S 2 Pen stylus' Threashold 1"
$ udevadm test --action=add `udevadm trigger -nva name="Wacom Intuos PT S 2 Pen"`
calling: test
version 232
=== trie on-disk ===
tool version: 232
file size: 8801854 bytes
header size 80 bytes
strings 1856302 bytes
nodes 6945472 bytes
:
中略
:
Reading rules file: /etc/udev/rules.d/99-wacom.rules
RUN '/usr/bin/env XAUTHORITY=/home/matthew/.Xauthority DISPLAY=:0 /usr/bin/xsetwacom set 'Wacom Intuos PT S 2 Pen stylus' Threashold 1' /etc/udev/rules.d/99-wacom.rules:5
Unload module index
Unloaded link configuration context.
This program is for debugging only, it does not run any program
specified by a RUN key. It may show incorrect results, because
some values may be different, or not available at a simulation run.
.INPUT_CLASS=mouse
.MM_USBIFNUM=00
ABS=10003000003
ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.0/0003:056A:033C.0082/input/input275
EV=1b
ID_BUS=usb
ID_FOR_SEAT=input-pci-0000_00_1d_0-usb-0_1_2_1_0
ID_INPUT=1
ID_INPUT_TABLET=1
ID_MODEL=Intuos_PTS
ID_MODEL_ENC=Intuos\x20PTS
ID_MODEL_ID=033c
ID_PATH=pci-0000:00:1d.0-usb-0:1.2:1.0
ID_PATH_TAG=pci-0000_00_1d_0-usb-0_1_2_1_0
ID_REVISION=0100
ID_SERIAL=Wacom_Co._Ltd._Intuos_PTS
ID_TYPE=hid
ID_USB_DRIVER=usbhid
ID_USB_INTERFACES=:030000:030102:
ID_USB_INTERFACE_NUM=00
ID_VENDOR=Wacom_Co._Ltd.
ID_VENDOR_ENC=Wacom\x20Co.\x2cLtd.
ID_VENDOR_ID=056a
KEY=1c01 0 0 0 0 0
MODALIAS=input:b0003v056Ap033Ce0110-e0,1,3,4,k140,14A,14B,14C,ra0,1,18,19,28,m0,lsfw
MSC=1
NAME="Wacom Intuos PT S 2 Pen"
PHYS="usb-0000:00:1d.0-1.2/input0"
PRODUCT=3/56a/33c/110
PROP=1
SUBSYSTEM=input
TAGS=:seat:
UNIQ=""
USEC_INITIALIZED=12674348315
run: 'kmod load input:b0003v056Ap033Ce0110-e0,1,3,4,k140,14A,14B,14C,ra0,1,18,19,28,m0,lsfw'
run: '/usr/bin/env XAUTHORITY=/home/me/.Xauthority DISPLAY=:0 /usr/bin/xsetwacom set 'Wacom Intuos PT S 2 Pen stylus' Threashold 1'
for((i = 1; i <= ${#}; i++))doevalecho LINE ${i}: \${${i}}done
行ごとに位置パラメータに格納されているのがわかります。この中で必要になるのは最後の行だけです。
LINE 1: PING localhost (127.0.0.1) 56(84) bytes of data.
LINE 2: 64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.090 ms
LINE 3: --- localhost ping statistics ---
LINE 4: 1 packets transmitted, 1 received, 0% packet loss, time 0ms
LINE 5: rtt min/avg/max/mdev = 0.090/0.090/0.090/0.000 ms
# as = Assignment Statementstime_as(){(IFS=' []'
set --${2}
date -d@${2} +'time="%F %T"')}stat_as(){(IFS=' /='eval set --\${${#}}
echo${2}=${6}${3}=${7}${4}=${8}${5}=${9})}## IF CURRENT SHELL#save_IFS=${IFS} IFS=$'\n'#set -- $(ping -c1 -D localhost)#IFS=${save_IFS}eval$(IFS=$'\n' set -- $(ping -c1-D localhost) time_as "${@}" stat_as "${@}")echo${time}${min}${avg}${max}${mdev}
set-xreturn_time_as(){(IFS=' []'
set --${2}
date -d@${2} +'time="%F %T"')}return_stat_as(){(IFS=' /='eval set --\${${#}}
echo${2}=${6}${3}=${7}${4}=${8}${5}=${9})}eval$(IFS=$'\n' set -- $(ping -c1-D localhost) return_time_as "${@}" return_stat_as "${@}")
++ IFS=''
+++ ping -c1-D localhost
++ set -- 'PING localhost (127.0.0.1) 56(84) bytes of data.''[1511627944.923406] 64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.043 ms''--- localhost ping statistics ---''1 packets transmitted, 1 received, 0% packet loss, time 0ms''rtt min/avg/max/mdev = 0.043/0.043/0.043/0.000 ms'
++ return_time_as 'PING localhost (127.0.0.1) 56(84) bytes of data.''[1511627944.923406] 64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.043 ms''--- localhost ping statistics ---''1 packets transmitted, 1 received, 0% packet loss, time 0ms''rtt min/avg/max/mdev = 0.043/0.043/0.043/0.000 ms'
++ IFS=' []'
++ set -- '' 1511627944.923406 64 bytes from localhost '(127.0.0.1):' icmp_seq=1 ttl=64 time=0.043 ms
++ date -d@1511627944.923406 '+time="%F %T"'
++ return_stat_as 'PING localhost (127.0.0.1) 56(84) bytes of data.''[1511627944.923406] 64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.043 ms''--- localhost ping statistics ---''1 packets transmitted, 1 received, 0% packet loss, time 0ms''rtt min/avg/max/mdev = 0.043/0.043/0.043/0.000 ms'
++ IFS=' /='
++ evalset -- '${5}'
+++ set -- rtt min avg max mdev 0.043 0.043 0.043 0.000 ms
++ echo min=0.043 avg=0.043 max=0.043 mdev=0.000
+ eval'time="2017-11-26''01:39:04"'min=0.043 avg=0.043 max=0.043 mdev=0.000
time="2017-11-26 01:39:04"min=0.043 avg=0.043 max=0.043 mdev=0.000
++ time='2017-11-26 01:39:04'
++ min=0.043
++ avg=0.043
++ max=0.043
++ mdev=0.000
echo${time}${min}${avg}${max}${mdev}
+ echo 2017-11-26 01:39:04 0.043 0.043 0.043 0.0002017-11-2601:39:04 0.043 0.043 0.043 0.000
長いですね。
続いてサブシェル版。
## IF CURRENT SHELL#save_IFS=${IFS} IFS=$'\n'#set -- $(ping -c1 -D localhost)#IFS=${save_IFS}eval$(IFS=$'\n' set -- $(ping -c1-D localhost)(IFS=' []'
set --${2}
date -d@${2} +'time="%F %T"')(IFS=' /='eval set --\${${#}}
echo${2}=${6}${3}=${7}${4}=${8}${5}=${9}))echo${time}${min}${avg}${max}${mdev}
set -vxで実行してみます。
eval$(IFS=$'\n' set -- $(ping -c1-D localhost)(IFS=' []'
set --${2}
date -d@${2} +'time="%F %T"')(IFS=' /='eval set --\${${#}}
echo${2}=${6}${3}=${7}${4}=${8}${5}=${9}))
++ IFS=''
+++ ping -c1-D localhost
++ set -- 'PING localhost (127.0.0.1) 56(84) bytes of data.''[1511627682.894487] 64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.048 ms''--- localhost ping statistics ---''1 packets transmitted, 1 received, 0% packet loss, time 0ms''rtt min/avg/max/mdev = 0.048/0.048/0.048/0.000 ms'
++ IFS=' []'
++ set -- '' 1511627682.894487 64 bytes from localhost '(127.0.0.1):' icmp_seq=1 ttl=64 time=0.048 ms
++ date -d@1511627682.894487 '+time="%F %T"'
++ IFS=' /='
++ evalset -- '${5}'
+++ set -- rtt min avg max mdev 0.048 0.048 0.048 0.000 ms
++ echo min=0.048 avg=0.048 max=0.048 mdev=0.000
+ eval'time="2017-11-26''01:34:42"'min=0.048 avg=0.048 max=0.048 mdev=0.000
time="2017-11-26 01:34:42"min=0.048 avg=0.048 max=0.048 mdev=0.000
++ time='2017-11-26 01:34:42'
++ min=0.048
++ avg=0.048
++ max=0.048
++ mdev=0.000
echo${time}${min}${avg}${max}${mdev}
+ echo 2017-11-26 01:34:42 0.048 0.048 0.048 0.0002017-11-2601:34:42 0.048 0.048 0.048 0.000
$ sqlite3 -html -header ping.sqlite 'select * from (select * from PING where HOST = "192.168.1.103" order by TIMESTAMP desc LIMIT 10) order by TIMESTAMP;'
YouTubeなんかの動画を再生するには当然便利なんだけど、ローカルの動画とかを再生しようとなると Google Chrome(Chromium)で file:///にアクセスして Google Chromeの画面をキャスト…みたいなことになるのでプレイリストが使えなくて面倒くさい。普段は mpvを使っているので Chromecast 用のプラグインでも追加されてないかな〜と思ったけど今のところは非対応っぽい。
Usage: castnow [<media>, <media>, ...] [OPTIONS]
Option Meaning
--tomp4 Convert file to mp4 during playback
--device <name> The name of the Chromecast device that should be used
--address <ip> The IP address or hostname of your Chromecast device
--subtitles <path/url> Path or URL to an SRT or VTT file
--subtitle-scale <scale> Subtitle font scale
--subtitle-color <color> Subtitle font RGBA color
--subtitle-port <port> Specify the port to be used for serving subtitles
--myip <ip> Your local IP address
--quiet No output
--peerflix-<value> Pass options to peerflix
--ffmpeg-<value> Pass options to ffmpeg
--type <type> Explicitly set the mime-type (e.g. "video/mp4")
--bypass-srt-encoding Disable automatic UTF-8 encoding of SRT subtitles
--seek <hh:mm:ss> Seek to the specified time on start using the format hh:mm:ss or mm:ss
--loop Loop over playlist, or file, forever
--shuffle Play in random order
--recursive List all files in directories recursively
--volume-step <step> Step at which the volume changes. Helpful for speakers that are softer or louder than normal. Value ranges from 0 to 1 (e.g. ".05")
--localfile-port <port> Specify the port to be used for serving a local file
--transcode-port <port> Specify the port to be used for serving a transcoded file
--torrent-port <port> Specify the port to be used for serving a torrented file
--stdin-port <port> Specify the port to be used for serving a file read from stdin
--command <key1>,<key2> Execute key command(s) (where each <key> is one of the keys listed below)
--exit Exit when playback begins or --command completes
--help This help screen
Player controls
Key Action
space Toggle between play and pause
m Toggle mute
t Toggle subtitles
up Volume Up
down Volume Down
left Seek backward
right Seek forward
n Next in playlist
s Stop playback
quit Quit