nouka inventry manager
DESCRIPTION
it inventry management software. using python , mongodb, fluendTRANSCRIPT
![Page 1: nouka inventry manager](https://reader034.vdocuments.site/reader034/viewer/2022052410/548e2fcbb479599d2d8b46f0/html5/thumbnails/1.jpg)
nouka inventory managerToshiaki Baba [email protected] / @netmarkjp
![Page 2: nouka inventry manager](https://reader034.vdocuments.site/reader034/viewer/2022052410/548e2fcbb479599d2d8b46f0/html5/thumbnails/2.jpg)
Inventory management software
http://en.wikipedia.org/wiki/Inventory_management_software
![Page 3: nouka inventry manager](https://reader034.vdocuments.site/reader034/viewer/2022052410/548e2fcbb479599d2d8b46f0/html5/thumbnails/3.jpg)
Microsoft Excel
![Page 4: nouka inventry manager](https://reader034.vdocuments.site/reader034/viewer/2022052410/548e2fcbb479599d2d8b46f0/html5/thumbnails/4.jpg)
(´Д`)
![Page 5: nouka inventry manager](https://reader034.vdocuments.site/reader034/viewer/2022052410/548e2fcbb479599d2d8b46f0/html5/thumbnails/5.jpg)
![Page 6: nouka inventry manager](https://reader034.vdocuments.site/reader034/viewer/2022052410/548e2fcbb479599d2d8b46f0/html5/thumbnails/6.jpg)
![Page 7: nouka inventry manager](https://reader034.vdocuments.site/reader034/viewer/2022052410/548e2fcbb479599d2d8b46f0/html5/thumbnails/7.jpg)
inventory management
¤ Microsoft Excel is VERY GOOD USEFUL PRODUCT
¤ but we need AUTOMATIC PERIODIC update
¤ and I love Linux and OSS
![Page 8: nouka inventry manager](https://reader034.vdocuments.site/reader034/viewer/2022052410/548e2fcbb479599d2d8b46f0/html5/thumbnails/8.jpg)
inventory management
¤ AUTOMATIC update
¤ PERIODIC update
¤ focus to Linux machines
¤ OSS
![Page 9: nouka inventry manager](https://reader034.vdocuments.site/reader034/viewer/2022052410/548e2fcbb479599d2d8b46f0/html5/thumbnails/9.jpg)
nouka inventry manager
![Page 10: nouka inventry manager](https://reader034.vdocuments.site/reader034/viewer/2022052410/548e2fcbb479599d2d8b46f0/html5/thumbnails/10.jpg)
nouka family
• nouka data collector
• naya data store
• yaoya data convertor
nouka
naya
yaoyaoutput
push command result crawl
![Page 11: nouka inventry manager](https://reader034.vdocuments.site/reader034/viewer/2022052410/548e2fcbb479599d2d8b46f0/html5/thumbnails/11.jpg)
nouka data collector
¤ pure python 2.4
¤ run with python standard library
¤ POST result to naya with HTTP
¤ if use cron, AUTOMATIC PERIODIC update comes true!
![Page 12: nouka inventry manager](https://reader034.vdocuments.site/reader034/viewer/2022052410/548e2fcbb479599d2d8b46f0/html5/thumbnails/12.jpg)
nouka default commands
¤ command_ifconfig = ifconfig -a
¤ command_hostname = hostname
¤ command_uname = uname -a
¤ command_df = df -akl
¤ command_iptables = /sbin/iptables-save
¤ command_rpm = rpm -qa
¤ command_chkconfig = /sbin/chkconfig --list
¤ command_ip_addr = /sbin/ip addr show
¤ command_ip_route = /sbin/ip route show
¤ command_dmidecode = /usr/sbin/dmidecode
¤ command_resolv = cat /etc/resolv.conf
¤ command_passwd = cat /etc/passwd
¤ command_group = cat /etc/group
¤ command_shadow = cat /etc/shadow
¤ command_proc_cpuinfo = cat /proc/cpuinfo
¤ command_proc_meminfo = cat /proc/meminfo
¤ command_proc_mounts = cat /proc/mounts
To add command, just only define in nouka.conf!
![Page 13: nouka inventry manager](https://reader034.vdocuments.site/reader034/viewer/2022052410/548e2fcbb479599d2d8b46f0/html5/thumbnails/13.jpg)
naya data store
¤ fluentd / td-agent
¤ fluent-plugin-http-enhanced ¤ https://github.com/parolkar/fluent-plugin-http-enhanced
¤ fluent-plugin-mongo
¤ mongodb
![Page 14: nouka inventry manager](https://reader034.vdocuments.site/reader034/viewer/2022052410/548e2fcbb479599d2d8b46f0/html5/thumbnails/14.jpg)
yaoya data convertor
¤ python 2.6 + pymongo 2.2
¤ CLI tool (GUI tool: yaoyacontrib-webif)
¤ output format ¤ JSON
¤ CSV
¤ chkconfig matrix(CSV)
¤ rpm matrix(CSV)
![Page 15: nouka inventry manager](https://reader034.vdocuments.site/reader034/viewer/2022052410/548e2fcbb479599d2d8b46f0/html5/thumbnails/15.jpg)
yaoya output example(1)
¤ $ bin/yaoya --group system_A --name command_uname
{u'return_code': u'0', u'command_line': u'uname -a', u'execute_at': u'1339942622', u'group_name': u'system_A', u'visible': u'True', u'host_name': u'bb-mba.local', u'time': datetime.datetime(2012, 6, 17, 14, 17, 3), u'output': u'Darwin bb-mba.local 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun 7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386\n', u'_id': ObjectId('4fdde6e0c286630ca0000009'), u'command_name': u'command_uname'}
{u'return_code': u'0', u'command_line': u'uname -a', u'execute_at': u'1339943547', u'group_name': u'system_A', u'visible': u'True', u'host_name': u'bbtest-c6', u'time': datetime.datetime(2012, 6, 17, 14, 32, 28), u'output': u'Linux bbtest-c6 2.6.32-220.13.1.el6.x86_64 #1 SMP Tue Apr 17 23:56:34 BST 2012 x86_64 x86_64 x86_64 GNU/Linux\n', u'_id': ObjectId('4fddea7dc286630ca000003c'), u'command_name': u'command_uname'}
![Page 16: nouka inventry manager](https://reader034.vdocuments.site/reader034/viewer/2022052410/548e2fcbb479599d2d8b46f0/html5/thumbnails/16.jpg)
yaoya output example(2)
¤ $ bin/csv --group system_A --name command_uname
"bb-mba.local","Darwin bb-mba.local 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun 7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386"
"bbtest-c6","Linux bbtest-c6 2.6.32-220.13.1.el6.x86_64 #1 SMP Tue Apr 17 23:56:34 BST 2012 x86_64 x86_64 x86_64 GNU/Linux"
![Page 17: nouka inventry manager](https://reader034.vdocuments.site/reader034/viewer/2022052410/548e2fcbb479599d2d8b46f0/html5/thumbnails/17.jpg)
getting started
![Page 18: nouka inventry manager](https://reader034.vdocuments.site/reader034/viewer/2022052410/548e2fcbb479599d2d8b46f0/html5/thumbnails/18.jpg)
project repository
¤ nouka ¤ https://bitbucket.org/netmarkjp/nouka
¤ yaoya ¤ https://bitbucket.org/netmarkjp/yaoya
¤ yaoyacontrib-webif ¤ https://bitbucket.org/netmarkjp/yaoyacontrib-webif
![Page 19: nouka inventry manager](https://reader034.vdocuments.site/reader034/viewer/2022052410/548e2fcbb479599d2d8b46f0/html5/thumbnails/19.jpg)
steps
1. setup naya
2. setup nouka
3. run nouka
![Page 20: nouka inventry manager](https://reader034.vdocuments.site/reader034/viewer/2022052410/548e2fcbb479599d2d8b46f0/html5/thumbnails/20.jpg)
setup naya @center server(1/2)
¤ td-agent ¤ cat <<EOT >/etc/yum.repos.d/td.repo
[treasuredata] name=TreasureData baseurl=http://packages.treasure-data.com/redhat/\$basearch gpgcheck=0 EOT
¤ yum -y install td-agent ¤ /usr/lib64/fluent/ruby/bin/gem install bson_ext ¤ /usr/lib64/fluent/ruby/bin/gem install fluent-plugin-http-
enhanced
![Page 21: nouka inventry manager](https://reader034.vdocuments.site/reader034/viewer/2022052410/548e2fcbb479599d2d8b46f0/html5/thumbnails/21.jpg)
setup naya @center server(2/2)
¤ mongod ¤ cat <<EOT >/etc/yum.repos.d/10gen.repo
[10gen] name=10gen Repository baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64 gpgcheck=0 EOT
¤ yum -y install mongo-10gen.x86_64 mongo-10gen-server.x86_64
¤ mercurial ¤ yum -y install python-devel python-setuptools gcc ¤ pip install mercurial
![Page 22: nouka inventry manager](https://reader034.vdocuments.site/reader034/viewer/2022052410/548e2fcbb479599d2d8b46f0/html5/thumbnails/22.jpg)
setup nouka @client
¤ curl https://bitbucket.org/netmarkjp/nouka/get/tip.tar.gz|tar xf –
¤ vi netmarkjp-nouka-*/conf/nouka.conf ¤ change server_url, group_name
¤ netmarkjp-nouka-*/bin/nouka
¤ (set cron if you need)
![Page 23: nouka inventry manager](https://reader034.vdocuments.site/reader034/viewer/2022052410/548e2fcbb479599d2d8b46f0/html5/thumbnails/23.jpg)
inside nouka
![Page 24: nouka inventry manager](https://reader034.vdocuments.site/reader034/viewer/2022052410/548e2fcbb479599d2d8b46f0/html5/thumbnails/24.jpg)
data format
{ *** are same value in same execution
‘group_name’ : ‘<group_name’s value in config file>‘, ***
'host_name' : '<env HOSTNAME>', ***
'command_name' : '<command name in config file. named command_*>',
'command_line' : '<command line(value) in config file>',
'output' : '<output of command line>',
'return_code' : '<return code of command line>',
‘visible’ : ‘True’, ***
'execute_at' : '<execute date as unixtime>’, ***
}
![Page 25: nouka inventry manager](https://reader034.vdocuments.site/reader034/viewer/2022052410/548e2fcbb479599d2d8b46f0/html5/thumbnails/25.jpg)
enjoy development!