*** irclogbot_3 has quit IRC | 01:05 | |
*** irclogbot_3 has joined #openstack-vitrage | 01:06 | |
*** bobh has joined #openstack-vitrage | 01:50 | |
*** bobh has quit IRC | 01:51 | |
*** ifat_afek has joined #openstack-vitrage | 05:24 | |
*** e0ne has joined #openstack-vitrage | 06:17 | |
*** e0ne has quit IRC | 06:18 | |
*** e0ne has joined #openstack-vitrage | 08:33 | |
*** e0ne has quit IRC | 08:34 | |
*** e0ne has joined #openstack-vitrage | 08:45 | |
*** e0ne has quit IRC | 08:47 | |
*** e0ne has joined #openstack-vitrage | 08:59 | |
*** e0ne has quit IRC | 09:54 | |
*** e0ne has joined #openstack-vitrage | 10:00 | |
*** hoa has joined #openstack-vitrage | 11:04 | |
hoa | hi, i'm want to write unit test for kapacitor datasource but never do write it before.Have any document, or command for run that test??? | 11:07 |
---|---|---|
ifat_afek | hoa: hi | 11:07 |
ifat_afek | you can see examples in other tests, like: vitrage/tests/unit/datasources/prometheus/test_prometheus_driver.py | 11:08 |
ifat_afek | you can run a specific test using: tox -epy27 -- TestVitrageTemplate | 11:08 |
hoa | yeah, i saw, but how i run it? | 11:08 |
ifat_afek | or you can run all tests using ‘tox -epy27’ | 11:08 |
ifat_afek | you can also run it inside pycharm, if you are using it | 11:09 |
hoa | and how that command work? little explain it :-) | 11:10 |
ifat_afek | tox is used to run tests on a specific project | 11:10 |
ifat_afek | -e is for one of tox targets. we have: py27, py36, docs, releasenotes, pep8 | 11:11 |
ifat_afek | and if you write the name of the test class, then it runs the test | 11:11 |
hoa | so if i run 'tox -epy27 PrometheusDriverTest' it do Prometheus test right? | 11:12 |
ifat_afek | yes, it should | 11:12 |
hoa | and in that test, what mocks module do? | 11:12 |
ifat_afek | if you run it from pycharm, you will be able to debug too | 11:12 |
ifat_afek | the mocks module is used to create mock data. it means that you don’t really get events from Prometheus or Kapacitor, because it’s a unit test. the mock simulates these events | 11:13 |
ifat_afek | it is not well documented, you’ll have to copy&paste from another datasource to make that part work | 11:13 |
ifat_afek | sorry for that | 11:13 |
hoa | yeah, hope you help me for that doc. i'm bad in english and still not good in code too. :-) | 11:15 |
ifat_afek | sorry :-( | 11:16 |
ifat_afek | your English is ok :-) | 11:16 |
hoa | i'm basically a sysadmin, nano editor seem familiar to me, not pycharm :-D | 11:16 |
ifat_afek | :D | 11:17 |
hoa | umm. that mock simulates event, any document can help me in that? | 11:18 |
ifat_afek | no… it was written long ago and was not documented | 11:19 |
ifat_afek | I think that you can just create a hard-coded event in your test class, instead of using the mock | 11:19 |
hoa | . about the code i had push, in mapping betwent instance and host that kapacior alarm. i still don't get the ideal | 11:21 |
ifat_afek | the alarm is on a host or on an instance? or it can be both? | 11:21 |
hoa | can be both | 11:21 |
ifat_afek | ok, so it’s a bit complicated. you don’t want to write an instance id in the conf file, because instances can be created/deleted all the time | 11:22 |
ifat_afek | so we found a solution from Prometheus, and you may reuse it if it’s good for Kapacitor | 11:23 |
ifat_afek | did you read the spec? | 11:23 |
hoa | i did read. it point on domain of libvirt? or??? | 11:23 |
ifat_afek | the Prometheus alarm can point to a host or an instance. and they are identified by Prometheus labels. and the conf file defines the rules of how to translate them to Vitrage resources | 11:25 |
hoa | in resources section of the mapping file . i see --- instance_name: "1.1.1.1:9999" host_id: "instance-00000004" ---- but "1.1.1.1:9999" seem weird and host_id "instance-00000004" look weird too. | 11:32 |
ifat_afek | instance_name is just an example, it is not real | 11:33 |
ifat_afek | host_id is the libvirt name of the instance (I think) | 11:33 |
hoa | ex : my instance have name: "node1" and id "fdb0ccf1-4367-4bce-a8a0-9f15e2739224" ... strange.... | 11:34 |
ifat_afek | these are the values that you get from Prometheus, I think | 11:34 |
ifat_afek | these are not Nova values | 11:34 |
ifat_afek | Prometheus knows the ip and port of the instance, and also its libvirt name | 11:35 |
ifat_afek | you don’t need to care about it, it is relevant only to Prometheus | 11:35 |
ifat_afek | the important part is that you understand what are the Kapacitor fiels that identify the resource and how to tell Vitrage if it’s a host or an instance and the id | 11:35 |
hoa | so let see . in TICK, each metric (or alert) alway have "host" tag (hostname) to tell where metric belong to | 11:40 |
hoa | i only see that field to identify the resource. | 11:40 |
ifat_afek | but how can you tell if it’s a host or an instance? | 11:40 |
hoa | can't . telegraf agent install on host or instance to get metric. When hostname is point on alert. i map it to vitrage, tell that resource type is nova.instance or nova.host ? | 11:43 |
ifat_afek | so you can’t know the type from the alarm fields? | 11:52 |
hoa | yeah. i don't see that way | 11:55 |
hoa | *way to find it* | 11:57 |
*** bobh has joined #openstack-vitrage | 11:59 | |
ifat_afek | ok. in that case, maybe you should define a conf file that is similar to Zabbix, and only maps hosts. and in the code you can decide that if the “host” is not mapped to anything, it means that it’s an instance | 12:04 |
ifat_afek | can it be something else? (like interface, switch) | 12:04 |
hoa | i just ask our expert, he say i can tag type of that resource . Of all . tag of alarm have basic tags is "host= {{hostname }}" . i can tag "type= {{instance}}" | 12:06 |
hoa | https://github.com/influxdata/telegraf/blob/master/docs/CONFIGURATION.md | 12:06 |
hoa | in section [golbal] | 12:06 |
hoa | may it work | 12:06 |
ifat_afek | it can work, but it’s problematic | 12:06 |
ifat_afek | because it will work only in your environment | 12:07 |
ifat_afek | other customers will not have the “type” tag | 12:07 |
ifat_afek | usually we want the datasources to connect to *any* environment | 12:07 |
hoa | um ok. TICK-telegraf can monitor switch too. https://lkhill.com/telegraf-influx-grafana-network-stats/ | 12:09 |
ifat_afek | I’m not sure what to say. If you have a host and a switch with the same name, how can Vitrage tell what resource it is? | 12:14 |
hoa | https://jsonblob.com/83e75e9c-61d4-11e9-a9df-ffa188c70e7d. it all i have on one alarm | 12:22 |
hoa | ... | 12:22 |
*** bobh has quit IRC | 12:23 | |
hoa | i think in series field . the "name" - mean name-of-metric may useful | 12:23 |
ifat_afek | how can it help | 12:27 |
ifat_afek | ? | 12:27 |
hoa | your can config that name in telegraft conf file . if a switch interface you can change it to "interface" or anything u want | 12:35 |
hoa | seem like problematic too | 12:36 |
hoa | :-) | 12:36 |
*** smrcascao has joined #openstack-vitrage | 12:38 | |
ifat_afek | yes, because again it requires some actions in Kapacitor in order to make it work | 12:42 |
ifat_afek | we prefer to just configure the datasource inside Vitrage and not touch Kapacitor | 12:42 |
hoa | i understand . so we skip on case monitor switch, mapping file like zabbix with resource.type chose betwent [nova.host or nova.instance ] ? | 12:45 |
ifat_afek | in your environment, you only need host and instance? | 12:45 |
hoa | yes. we not monitor switch yet. | 12:46 |
ifat_afek | so maybe you can start with a simple case and optionally change it in the future | 12:47 |
hoa | if switch join in. maybe it will mess @@. but we just don't send it to vitrage is ok | 12:47 |
hoa | ok i fix code tomorrow . get_all() function seem complicated and maybe need touch to kapacitor , i may implement in another pull . Ok? | 12:53 |
*** hoa has quit IRC | 12:54 | |
ifat_afek | sure. you can also split the StoryBoard story to two stories. and implement the next one later | 12:58 |
*** ifat_afek has quit IRC | 13:10 | |
*** e0ne has quit IRC | 15:08 | |
*** e0ne has joined #openstack-vitrage | 15:09 | |
*** e0ne has quit IRC | 15:16 | |
*** bobh has joined #openstack-vitrage | 15:41 | |
*** bobh has quit IRC | 16:16 | |
*** bobh has joined #openstack-vitrage | 16:29 | |
*** e0ne has joined #openstack-vitrage | 16:48 | |
*** e0ne has quit IRC | 16:52 | |
*** e0ne has joined #openstack-vitrage | 16:52 | |
*** bobh has quit IRC | 16:57 | |
*** e0ne has quit IRC | 16:58 | |
*** e0ne has joined #openstack-vitrage | 19:14 | |
*** e0ne has quit IRC | 19:18 |
Generated by irclog2html.py 2.15.3 by Marius Gedminas - find it at mg.pov.lt!