Merge "ipmi doc: build OpenIPMI lib from sources"
[barometer.git] / docs / release / userguide / feature.userguide.rst
1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
2 .. http://creativecommons.org/licenses/by/4.0
3 .. (c) <optionally add copywriters name>
4
5 ===================================
6 OPNFV Barometer User Guide
7 ===================================
8
9 .. contents::
10    :depth: 3
11    :local:
12
13 Barometer collectd plugins description
14 ---------------------------------------
15 .. Describe the specific features and how it is realised in the scenario in a brief manner
16 .. to ensure the user understand the context for the user guide instructions to follow.
17
18 collectd is a daemon which collects system performance statistics periodically
19 and provides a variety of mechanisms to publish the collected metrics. It
20 supports more than 90 different input and output plugins. Input plugins
21 retrieve metrics and publish them to the collectd deamon, while output plugins
22 publish the data they receive to an end point. collectd also has infrastructure
23 to support thresholding and notification.
24
25 Barometer has enabled the following collectd plugins:
26
27 * *dpdkstat plugin*: A read plugin that retrieve stats from the DPDK extended
28    NIC stats API.
29
30 * *dpdkevents plugin*:  A read plugin that retrieves DPDK link status and DPDK
31   forwarding cores liveliness status (DPDK Keep Alive).
32
33 * `ceilometer plugin`_: A write plugin that pushes the retrieved stats to
34   Ceilometer. It's capable of pushing any stats read through collectd to
35   Ceilometer, not just the DPDK stats.
36
37 * *hugepages plugin*:  A read plugin that retrieves the number of available
38   and free hugepages on a platform as well as what is available in terms of
39   hugepages per socket.
40
41 * *Open vSwitch events Plugin*: A read plugin that retrieves events from OVS.
42
43 * *Open vSwitch stats Plugin*: A read plugin that retrieve flow and interface
44   stats from OVS.
45
46 * *mcelog plugin*: A read plugin that uses mcelog client protocol to check for
47   memory Machine Check Exceptions and sends the stats for reported exceptions
48
49 * *RDT plugin*: A read plugin that provides the last level cache utilization and
50   memory bandwidth utilization
51
52 All the plugins above are available on the collectd master, except for the
53 ceilometer plugin as it's a python based plugin and only C plugins are accepted
54 by the collectd community. The ceilometer plugin lives in the OpenStack
55 repositories.
56
57 Other plugins existing as a pull request into collectd master:
58
59 * *SNMP Agent*: A write plugin that will act as a AgentX subagent that receives
60   and handles queries from SNMP master agent and returns the data collected
61   by read plugins. The SNMP Agent plugin handles requests only for OIDs
62   specified in configuration file. To handle SNMP queries the plugin gets data
63   from collectd and translates requested values from collectd's internal format
64   to SNMP format. Supports SNMP: get, getnext and walk requests.
65
66 * *Legacy/IPMI*: A read plugin that reports platform thermals, voltages,
67   fanspeed, current, flow, power etc. Also, the plugin monitors Intelligent
68   Platform Management Interface (IPMI) System Event Log (SEL) and sends the
69
70
71 **Plugins included in the Danube release:**
72
73 * Hugepages
74 * Open vSwitch Events
75 * Ceilometer
76 * Mcelog
77
78 collectd capabilities and usage
79 ------------------------------------
80 .. Describe the specific capabilities and usage for <XYZ> feature.
81 .. Provide enough information that a user will be able to operate the feature on a deployed scenario.
82
83 .. note:: Plugins included in the OPNFV D release will be built-in to the fuel
84  plugin and available in the /opt/opnfv directory on the fuel master. You don't
85  need to clone the barometer/collectd repos to use these, but you can configure
86  them as shown in the examples below.
87
88  The collectd plugins in OPNFV are configured with reasonable defaults, but can
89  be overridden.
90
91 Building all Barometer upstreamed plugins from scratch
92 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
93 The plugins that have been merged to the collectd master branch can all be
94 built and configured through the barometer repository.
95
96 .. note::
97  * sudo permissions are required to install collectd.
98  * These are instructions for Ubuntu 16.04
99
100 To build and install these dependencies, clone the barometer repo:
101
102 .. code:: c
103
104     $ git clone https://gerrit.opnfv.org/gerrit/barometer
105
106 Install the build dependencies
107
108 .. code:: bash
109
110     $ ./src/install_build_deps.sh
111
112 To install collectd as a service and install all it's dependencies:
113
114 .. code:: bash
115
116     $ cd barometer/src && sudo make && sudo make install
117
118 This will install collectd as a service and the base install directory
119 will be /opt/collectd.
120
121 Sample configuration files can be found in '/opt/collectd/etc/collectd.conf.d'
122
123 .. note::
124   - If you plan on using the Exec plugin, the plugin requires non-root
125     user to execute scripts. By default, `collectd_exec` user is used. Barometer
126     scripts do *not* create this user. It needs to be manually added or exec plugin
127     configuration has to be changed to use other, existing user before starting
128     collectd service.
129
130   - If you don't want to use one of the Barometer plugins, simply remove the
131     sample config file from '/opt/collectd/etc/collectd.conf.d'
132
133   - If you are using any Open vSwitch plugins you need to run:
134
135 .. code:: bash
136
137     $ sudo ovs-vsctl set-manager ptcp:6640
138
139
140 Below is the per plugin installation and configuration guide, if you only want
141 to install some/particular plugins.
142
143 DPDK statistics plugin
144 ^^^^^^^^^^^^^^^^^^^^^^
145 Repo: https://github.com/collectd/collectd
146
147 Branch: master
148
149 Dependencies: DPDK (http://dpdk.org/) Min_Version: 16.04
150
151 To build and install DPDK to /usr please see:
152 https://github.com/collectd/collectd/blob/master/docs/BUILD.dpdkstat.md
153
154 Building and installing collectd:
155
156 .. code:: bash
157
158     $ git clone https://github.com/collectd/collectd.git
159     $ cd collectd
160     $ ./build.sh
161     $ ./configure --enable-syslog --enable-logfile --enable-debug
162     $ make
163     $ sudo make install
164
165
166 This will install collectd to /opt/collectd
167 The collectd configuration file can be found at /opt/collectd/etc
168 To configure the dpdkstats plugin you need to modify the configuration file to
169 include:
170
171 .. code:: bash
172
173     LoadPlugin dpdkstat
174     <Plugin "dpdkstat">
175         <EAL>
176             Coremask "0x2"
177             MemoryChannels "4"
178             ProcessType "secondary"
179             FilePrefix "rte"
180         </EAL>
181         EnabledPortMask 0xffff
182         PortName "interface1"
183         PortName "interface2"
184     </Plugin>
185
186 For more information on the plugin parameters, please see:
187 https://github.com/collectd/collectd/blob/master/src/collectd.conf.pod
188
189 .. note:: If you are not building and installing DPDK system-wide
190  you will need to specify the specific paths to the header files and libraries
191  using LIBDPDK_CPPFLAGS and LIBDPDK_LDFLAGS. You will also need to add the DPDK
192  library symbols to the shared library path using ldconfig. Note that this
193  update to the shared library path is not persistent (i.e. it will not survive a
194  reboot).
195
196 .. note:: Plugin initialization time depends on read interval. It requires
197  5 read cycles to set up internal buffers and states. During that time
198  no statistics are submitted. Also if plugin is running and the number of DPDK
199  ports is increased, internal buffers are resized. That requires 3 read cycles
200  and no port statistics are submitted in that time.
201
202 DPDK events plugin
203 ^^^^^^^^^^^^^^^^^^^^^^
204 Repo: https://github.com/collectd/collectd
205
206 Branch: master
207
208 Dependencies: DPDK (http://dpdk.org/)
209
210 To build and install DPDK to /usr please see:
211 https://github.com/collectd/collectd/blob/master/docs/BUILD.dpdkstat.md
212
213 Building and installing collectd:
214
215 .. code:: bash
216
217     $ git clone https://github.com/collectd/collectd.git
218     $ cd collectd
219     $ ./build.sh
220     $ ./configure --enable-syslog --enable-logfile --enable-debug
221     $ make
222     $ sudo make install
223
224 This will install collectd to /opt/collectd
225 The collectd configuration file can be found at /opt/collectd/etc
226 To configure the dpdkevents plugin you need to modify the configuration file to
227 include:
228
229 .. code:: bash
230
231     LoadPlugin dpdkevents
232     <Plugin "dpdkevents">
233         Interval 1
234         <EAL>
235             Coremask "0x1"
236             MemoryChannels "4"
237             ProcessType "secondary"
238             FilePrefix "rte"
239         </EAL>
240         <Event "link_status">
241             SendEventsOnUpdate true
242             EnabledPortMask 0xffff
243             PortName "interface1"
244             PortName "interface2"
245             SendNotification false
246         </Event>
247         <Event "keep_alive">
248             SendEventsOnUpdate true
249             LCoreMask "0xf"
250             KeepAliveShmName "/dpdk_keepalive_shm_name"
251             SendNotification false
252         </Event>
253     </Plugin>
254
255 For more information on the plugin parameters, please see:
256 https://github.com/collectd/collectd/blob/master/src/collectd.conf.pod
257
258 .. note:: If you are not building and installing DPDK system-wide
259  you will need to specify the specific paths to the header files and libraries
260  using LIBDPDK_CPPFLAGS and LIBDPDK_LDFLAGS. You will also need to add the DPDK
261  library symbols to the shared library path using ldconfig. Note that this
262  update to the shared library path is not persistent (i.e. it will not survive a
263  reboot).
264
265 .. code:: bash
266
267     $ ./configure LIBDPDK_CPPFLAGS="path to DPDK header files" LIBDPDK_LDFLAGS="path to DPDK libraries"
268
269 Hugepages Plugin
270 ^^^^^^^^^^^^^^^^^
271 Repo: https://github.com/collectd/collectd
272
273 Branch: master
274
275 Dependencies: None, but assumes hugepages are configured.
276
277 To configure some hugepages:
278
279 .. code:: bash
280
281    sudo mkdir -p /mnt/huge
282    sudo mount -t hugetlbfs nodev /mnt/huge
283    sudo echo 14336 > /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages
284
285 Building and installing collectd:
286
287 .. code:: bash
288
289     $ git clone https://github.com/collectd/collectd.git
290     $ cd collectd
291     $ ./build.sh
292     $ ./configure --enable-syslog --enable-logfile --enable-hugepages --enable-debug
293     $ make
294     $ sudo make install
295
296 This will install collectd to /opt/collectd
297 The collectd configuration file can be found at /opt/collectd/etc
298 To configure the hugepages plugin you need to modify the configuration file to
299 include:
300
301 .. code:: bash
302
303     LoadPlugin hugepages
304     <Plugin hugepages>
305         ReportPerNodeHP  true
306         ReportRootHP     true
307         ValuesPages      true
308         ValuesBytes      false
309         ValuesPercentage false
310     </Plugin>
311
312 For more information on the plugin parameters, please see:
313 https://github.com/collectd/collectd/blob/master/src/collectd.conf.pod
314
315 Intel RDT Plugin
316 ^^^^^^^^^^^^^^^^
317 Repo: https://github.com/collectd/collectd
318
319 Branch: master
320
321 Dependencies:
322
323   * PQoS/Intel RDT library https://github.com/01org/intel-cmt-cat.git
324   * msr kernel module
325
326 Building and installing PQoS/Intel RDT library:
327
328 .. code:: bash
329
330     $ git clone https://github.com/01org/intel-cmt-cat.git
331     $ cd intel-cmt-cat
332     $ make
333     $ make install PREFIX=/usr
334
335 You will need to insert the msr kernel module:
336
337 .. code:: bash
338
339     $ modprobe msr
340
341 Building and installing collectd:
342
343 .. code:: bash
344
345     $ git clone https://github.com/collectd/collectd.git
346     $ cd collectd
347     $ ./build.sh
348     $ ./configure --enable-syslog --enable-logfile --with-libpqos=/usr/ --enable-debug
349     $ make
350     $ sudo make install
351
352 This will install collectd to /opt/collectd
353 The collectd configuration file can be found at /opt/collectd/etc
354 To configure the RDT plugin you need to modify the configuration file to
355 include:
356
357 .. code:: bash
358
359     <LoadPlugin intel_rdt>
360       Interval 1
361     </LoadPlugin>
362     <Plugin "intel_rdt">
363       Cores ""
364     </Plugin>
365
366 For more information on the plugin parameters, please see:
367 https://github.com/collectd/collectd/blob/master/src/collectd.conf.pod
368
369 IPMI Plugin
370 ^^^^^^^^^^^^
371 Repo: https://github.com/maryamtahhan/collectd
372
373 Branch: feat_ipmi_events, feat_ipmi_analog
374
375 Dependencies: OpenIPMI library (http://openipmi.sourceforge.net/)
376
377 The IPMI plugin is already implemented in the latest collectd and sensors
378 like temperature, voltage, fanspeed, current are already supported there.
379 The list of supported IPMI sensors has been extended and sensors like flow,
380 power are supported now. Also, a System Event Log (SEL) notification feature
381 has been introduced.
382
383 * The feat_ipmi_events branch includes new SEL feature support in collectd
384   IPMI plugin. If this feature is enabled, the collectd IPMI plugin will
385   dispatch notifications about new events in System Event Log.
386
387 * The feat_ipmi_analog branch includes the support of extended IPMI sensors in
388   collectd IPMI plugin.
389
390 **Install dependencies**
391
392 On Ubuntu, the OpenIPMI library can be installed via apt package manager:
393
394 .. code:: bash
395
396     $ sudo apt-get install libopenipmi-dev
397
398 Anyway, it's recommended to use the latest version of the OpenIPMI library as
399 it includes fixes of known issues which aren't included in standard OpenIPMI
400 library package. The latest version of the library can be found at
401 https://sourceforge.net/p/openipmi/code/ci/master/tree/. Steps to install the
402 library from sources are described below.
403
404 Remove old version of OpenIPMI library:
405
406 .. code:: bash
407
408     $ sudo apt-get remove libopenipmi-dev
409
410 Download OpenIPMI library sources:
411
412 .. code:: bash
413
414     $ git clone https://git.code.sf.net/p/openipmi/code openipmi-code
415     $ cd openipmi-code
416
417 Patch the OpenIPMI pkg-config file to provide correct compilation flags
418 for collectd IPMI plugin:
419
420 .. code:: diff
421
422     diff --git a/OpenIPMIpthread.pc.in b/OpenIPMIpthread.pc.in
423     index 59b52e5..fffa0d0 100644
424     --- a/OpenIPMIpthread.pc.in
425     +++ b/OpenIPMIpthread.pc.in
426     @@ -6,6 +6,6 @@ includedir=@includedir@
427      Name: OpenIPMIpthread
428      Description: Pthread OS handler for OpenIPMI
429      Version: @VERSION@
430     -Requires: OpenIPMI pthread
431     +Requires: OpenIPMI
432      Libs: -L${libdir} -lOpenIPMIutils -lOpenIPMIpthread
433     -Cflags: -I${includedir}
434     +Cflags: -I${includedir} -pthread
435
436 Build and install OpenIPMI library:
437
438 .. code:: bash
439
440     $ autoreconf --install
441     $ ./configure --prefix=/usr
442     $ make
443     $ sudo make install
444
445 Enable IPMI support in the kernel:
446
447 .. code:: bash
448
449     $ sudo modprobe ipmi_devintf
450     $ sudo modprobe ipmi_si
451
452 **Note**: If HW supports IPMI, the ``/dev/ipmi0`` character device will be
453 created.
454
455 Clone and install the collectd IPMI plugin:
456
457 .. code:: bash
458
459     $ git clone  https://github.com/maryamtahhan/collectd
460     $ cd collectd
461     $ git checkout $BRANCH
462     $ ./build.sh
463     $ ./configure --enable-syslog --enable-logfile --enable-debug
464     $ make
465     $ sudo make install
466
467 Where $BRANCH is feat_ipmi_events or feat_ipmi_analog.
468
469 This will install collectd to default folder ``/opt/collectd``. The collectd
470 configuration file (``collectd.conf``) can be found at ``/opt/collectd/etc``. To
471 configure the IPMI plugin you need to modify the file to include:
472
473 .. code:: bash
474
475     LoadPlugin ipmi
476     <Plugin ipmi>
477        SELEnabled true # only feat_ipmi_events branch supports this
478     </Plugin>
479
480 **Note**: By default, IPMI plugin will read all available analog sensor values,
481 dispatch the values to collectd and send SEL notifications.
482
483 For more information on the IPMI plugin parameters and SEL feature configuration,
484 please see:
485 https://github.com/maryamtahhan/collectd/blob/feat_ipmi_events/src/collectd.conf.pod
486
487 Extended analog sensors support doesn't require additional configuration. The usual
488 collectd IPMI documentation can be used:
489
490 - https://collectd.org/wiki/index.php/Plugin:IPMI
491 - https://collectd.org/documentation/manpages/collectd.conf.5.shtml#plugin_ipmi
492
493 IPMI documentation:
494
495 - https://www.kernel.org/doc/Documentation/IPMI.txt
496 - http://www.intel.com/content/www/us/en/servers/ipmi/ipmi-second-gen-interface-spec-v2-rev1-1.html
497
498 Mcelog Plugin
499 ^^^^^^^^^^^^^^
500 Repo: https://github.com/collectd/collectd
501
502 Branch: master
503
504 Dependencies: mcelog
505
506 Start by installing mcelog. Note: The kernel has to have CONFIG_X86_MCE
507 enabled. For 32bit kernels you need at least a 2.6,30 kernel.
508
509 On ubuntu:
510
511 .. code:: bash
512
513     $ apt-get update && apt-get install mcelog
514
515 Or build from source
516
517 .. code:: bash
518
519     $ git clone git://git.kernel.org/pub/scm/utils/cpu/mce/mcelog.git
520     $ cd mcelog
521     $ make
522     ... become root ...
523     $ make install
524     $ cp mcelog.service /etc/systemd/system/
525     $ systemctl enable mcelog.service
526     $ systemctl start mcelog.service
527
528
529 Verify you got a /dev/mcelog. You can verify the daemon is running completely
530 by running:
531
532 .. code:: bash
533
534      $ mcelog --client
535
536 This should query the information in the running daemon. If it prints nothing
537 that is fine (no errors logged yet). More info @
538 http://www.mcelog.org/installation.html
539
540 Modify the mcelog configuration file "/etc/mcelog/mcelog.conf" to include or
541 enable:
542
543 .. code:: bash
544
545     socket-path = /var/run/mcelog-client
546
547 Clone and install the collectd mcelog plugin:
548
549 .. code:: bash
550
551     $ git clone  https://github.com/maryamtahhan/collectd
552     $ cd collectd
553     $ git checkout feat_ras
554     $ ./build.sh
555     $ ./configure --enable-syslog --enable-logfile --enable-debug
556     $ make
557     $ sudo make install
558
559 This will install collectd to /opt/collectd
560 The collectd configuration file can be found at /opt/collectd/etc
561 To configure the mcelog plugin you need to modify the configuration file to
562 include:
563
564 .. code:: bash
565
566     <LoadPlugin mcelog>
567       Interval 1
568     </LoadPlugin>
569     <Plugin "mcelog">
570        McelogClientSocket "/var/run/mcelog-client"
571     </Plugin>
572
573 For more information on the plugin parameters, please see:
574 https://github.com/maryamtahhan/collectd/blob/feat_ras/src/collectd.conf.pod
575
576 Simulating a Machine Check Exception can be done in one of 3 ways:
577
578 * Running $make test in the mcelog cloned directory - mcelog test suite
579 * using mce-inject
580 * using mce-test
581
582 **mcelog test suite:**
583
584 It is always a good idea to test an error handling mechanism before it is
585 really needed. mcelog includes a test suite. The test suite relies on
586 mce-inject which needs to be installed and in $PATH.
587
588 You also need the mce-inject kernel module configured (with
589 CONFIG_X86_MCE_INJECT=y), compiled, installed and loaded:
590
591 .. code:: bash
592
593     $ modprobe mce-inject
594
595 Then you can run the mcelog test suite with
596
597 .. code:: bash
598
599     $ make test
600
601 This will inject different classes of errors and check that the mcelog triggers
602 runs. There will be some kernel messages about page offlining attempts. The
603 test will also lose a few pages of memory in your system (not significant)
604 **Note this test will kill any running mcelog, which needs to be restarted
605 manually afterwards**.
606 **mce-inject:**
607
608 A utility to inject corrected, uncorrected and fatal machine check exceptions
609
610 .. code:: bash
611
612     $ git clone https://git.kernel.org/pub/scm/utils/cpu/mce/mce-inject.git
613     $ cd mce-inject
614     $ make
615     $ modprobe mce-inject
616
617 Modify the test/corrected script to include the following:
618
619 .. code:: bash
620
621     CPU 0 BANK 0
622     STATUS 0xcc00008000010090
623     ADDR 0x0010FFFFFFF
624
625 Inject the error:
626 .. code:: bash
627
628     $ ./mce-inject < test/corrected
629
630 **Note: the uncorrected and fatal scripts under test will cause a platform reset.
631 Only the fatal script generates the memory errors**. In order to  quickly
632 emulate uncorrected memory errors and avoid host reboot following test errors
633 from mce-test  suite can be injected:
634
635 .. code:: bash
636
637        $ mce-inject  mce-test/cases/coverage/soft-inj/recoverable_ucr/data/srao_mem_scrub
638
639 **mce-test:**
640
641 In addition an more in-depth test of the Linux kernel machine check facilities
642 can be done with the mce-test test suite. mce-test supports testing uncorrected
643 error handling, real error injection, handling of different soft offlining
644 cases, and other tests.
645
646 **Corrected memory error injection:**
647
648 To inject corrected memory errors:
649
650 * Remove sb_edac and edac_core kernel modules: rmmod sb_edac rmmod edac_core
651 * Insert einj module: modprobe einj param_extension=1
652 * Inject an error by specifying details (last command should be repeated at least two times):
653
654 .. code:: bash
655
656     $ APEI_IF=/sys/kernel/debug/apei/einj
657     $ echo 0x8 > $APEI_IF/error_type
658     $ echo 0x01f5591000 > $APEI_IF/param1
659     $ echo 0xfffffffffffff000 > $APEI_IF/param2
660     $ echo 1 > $APEI_IF/notrigger
661     $ echo 1 > $APEI_IF/error_inject
662
663 * Check the MCE statistic: mcelog --client. Check the mcelog log for injected error details: less /var/log/mcelog.
664
665 Open vSwitch Plugins
666 ^^^^^^^^^^^^^^^^^^^^^
667 OvS Events Repo: https://github.com/collectd/collectd
668
669 OvS Stats Repo: https://github.com/maryamtahhan/collectd
670
671 OvS Events Branch: master
672
673 OvS Stats Branch:feat_ovs_stats
674
675 OvS Events MIBs: The SNMP OVS interface link status is provided by standard
676 IF-MIB (http://www.net-snmp.org/docs/mibs/IF-MIB.txt)
677
678 Dependencies: Open vSwitch, Yet Another JSON Library (https://github.com/lloyd/yajl)
679
680 On Ubuntu, install the dependencies:
681
682 .. code:: bash
683
684     $ sudo apt-get install libyajl-dev openvswitch-switch
685
686 Start the Open vSwitch service:
687
688 .. code:: bash
689
690     $ sudo service openvswitch-switch start
691
692 configure the ovsdb-server manager:
693
694 .. code:: bash
695
696     $ sudo ovs-vsctl set-manager ptcp:6640
697
698 Clone and install the collectd ovs plugin:
699
700 .. code:: bash
701
702     $ git clone $REPO
703     $ cd collectd
704     $ git checkout $BRANCH
705     $ ./build.sh
706     $ ./configure --enable-syslog --enable-logfile --enable-debug
707     $ make
708     $ sudo make install
709
710 where $REPO is one of the repos listed at the top of this section.
711
712 Where $BRANCH is master or feat_ovs_stats.
713
714 This will install collectd to /opt/collectd. The collectd configuration file
715 can be found at /opt/collectd/etc. To configure the OVS events plugin you
716 need to modify the configuration file to include:
717
718 .. code:: bash
719
720     <LoadPlugin ovs_events>
721        Interval 1
722     </LoadPlugin>
723     <Plugin "ovs_events">
724        Port 6640
725        Socket "/var/run/openvswitch/db.sock"
726        Interfaces "br0" "veth0"
727        SendNotification false
728        DispatchValues true
729     </Plugin>
730
731 To configure the OVS stats plugin you need to modify the configuration file
732 to include:
733
734 .. code:: bash
735
736     <LoadPlugin ovs_stats>
737        Interval 1
738     </LoadPlugin>
739     <Plugin ovs_stats>
740        Port "6640"
741        Address "127.0.0.1"
742        Socket "/var/run/openvswitch/db.sock"
743        Bridges "br0" "br_ext"
744     </Plugin>
745
746 For more information on the plugin parameters, please see:
747 https://github.com/collectd/collectd/blob/master/src/collectd.conf.pod
748 and
749 https://github.com/maryamtahhan/collectd/blob/feat_ovs_stats/src/collectd.conf.pod
750
751 SNMP Agent Plugin
752 ^^^^^^^^^^^^^^^^^
753 Repo: https://github.com/maryamtahhan/collectd/
754
755 Branch: feat_snmp
756
757 Dependencies: NET-SNMP library
758
759 Start by installing net-snmp and dependencies.
760
761 On ubuntu:
762
763 .. code:: bash
764
765     $ apt-get install snmp snmp-mibs-downloader snmpd libsnmp-dev
766     $ systemctl start snmpd.service
767
768 Or build from source
769
770 Become root to install net-snmp dependencies
771
772 .. code:: bash
773
774     $ apt-get install libperl-dev
775
776 Clone and build net-snmp
777
778 .. code:: bash
779
780     $ git clone https://github.com/haad/net-snmp.git
781     $ cd net-snmp
782     $ ./configure --with-persistent-directory="/var/net-snmp" --with-systemd --enable-shared --prefix=/usr
783     $ make
784
785 Become root
786
787 .. code:: bash
788
789     $ make install
790
791 Copy default configuration to persistent folder
792
793 .. code:: bash
794
795     $ cp EXAMPLE.conf /usr/share/snmp/snmpd.conf
796
797 Set library path and default MIB configuration
798
799 .. code:: bash
800
801     $ cd ~/
802     $ echo export LD_LIBRARY_PATH=/usr/lib >> .bashrc
803     $ net-snmp-config --default-mibdirs
804     $ net-snmp-config --snmpconfpath
805
806 Configure snmpd as a service
807
808 .. code:: bash
809
810     $ cd net-snmp
811     $ cp ./dist/snmpd.service /etc/systemd/system/
812     $ systemctl enable snmpd.service
813     $ systemctl start snmpd.service
814
815 Add the following line to snmpd.conf configuration file
816 "/usr/share/snmp/snmpd.conf" to make all OID tree visible for SNMP clients:
817
818 .. code:: bash
819
820     view   systemonly  included   .1
821
822 To verify that SNMP is working you can get IF-MIB table using SNMP client
823 to view the list of Linux interfaces:
824
825 .. code:: bash
826
827     $ snmpwalk -v 2c -c public localhost IF-MIB::interfaces
828
829 Clone and install the collectd snmp_agent plugin:
830
831 .. code:: bash
832
833     $ git clone  https://github.com/maryamtahhan/collectd
834     $ cd collectd
835     $ git checkout feat_snmp
836     $ ./build.sh
837     $ ./configure --enable-syslog --enable-logfile --enable-debug --enable-snmp --with-libnetsnmp
838     $ make
839     $ sudo make install
840
841 This will install collectd to /opt/collectd
842 The collectd configuration file can be found at /opt/collectd/etc
843 **SNMP Agent plugin is a generic plugin and cannot work without configuration**.
844 To configure the snmp_agent plugin you need to modify the configuration file to
845 include OIDs mapped to collectd types. The following example maps scalar
846 memAvailReal OID to value represented as free memory type of memory plugin:
847
848 .. code:: bash
849
850     LoadPlugin snmp_agent
851     <Plugin "snmp_agent">
852       <Data "memAvailReal">
853         Plugin "memory"
854         Type "memory"
855         TypeInstance "free"
856         OIDs "1.3.6.1.4.1.2021.4.6.0"
857       </Data>
858     </Plugin>
859
860 For more information on the plugin parameters, please see:
861 https://github.com/maryamtahhan/collectd/blob/feat_snmp/src/collectd.conf.pod
862
863 For more details on AgentX subagent, please see:
864 http://www.net-snmp.org/tutorial/tutorial-5/toolkit/demon/
865
866 Installing collectd as a service
867 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
868 **NOTE**: In an OPNFV installation, collectd is installed and configured as a
869 service.
870
871 Collectd service scripts are available in the collectd/contrib directory.
872 To install collectd as a service:
873
874 .. code:: bash
875
876     $ sudo cp contrib/systemd.collectd.service /etc/systemd/system/
877     $ cd /etc/systemd/system/
878     $ sudo mv systemd.collectd.service collectd.service
879     $ sudo chmod +x collectd.service
880
881 Modify collectd.service
882
883 .. code:: bash
884
885     [Service]
886     ExecStart=/opt/collectd/sbin/collectd
887     EnvironmentFile=-/opt/collectd/etc/
888     EnvironmentFile=-/opt/collectd/etc/
889     CapabilityBoundingSet=CAP_SETUID CAP_SETGID
890
891 Reload
892
893 .. code:: bash
894
895     $ sudo systemctl daemon-reload
896     $ sudo systemctl start collectd.service
897     $ sudo systemctl status collectd.service should show success
898
899 Additional useful plugins
900 ^^^^^^^^^^^^^^^^^^^^^^^^^^
901
902 * **Exec Plugin** : Can be used to show you when notifications are being
903  generated by calling a bash script that dumps notifications to file. (handy
904  for debug). Modify /opt/collectd/etc/collectd.conf:
905
906 .. code:: bash
907
908    LoadPlugin exec
909    <Plugin exec>
910    #   Exec "user:group" "/path/to/exec"
911       NotificationExec "user" "<path to barometer>/barometer/src/collectd/collectd_sample_configs/write_notification.sh"
912    </Plugin>
913
914 write_notification.sh (just writes the notification passed from exec through
915 STDIN to a file (/tmp/notifications)):
916
917 .. code:: bash
918
919    #!/bin/bash
920    rm -f /tmp/notifications
921    while read x y
922    do
923      echo $x$y >> /tmp/notifications
924    done
925
926 output to /tmp/notifications should look like:
927
928 .. code:: bash
929
930     Severity:WARNING
931     Time:1479991318.806
932     Host:localhost
933     Plugin:ovs_events
934     PluginInstance:br-ex
935     Type:gauge
936     TypeInstance:link_status
937     uuid:f2aafeec-fa98-4e76-aec5-18ae9fc74589
938
939     linkstate of "br-ex" interface has been changed to "DOWN"
940
941 * **logfile plugin**: Can be used to log collectd activity. Modify
942   /opt/collectd/etc/collectd.conf to include:
943
944 .. code:: bash
945
946     LoadPlugin logfile
947     <Plugin logfile>
948         LogLevel info
949         File "/var/log/collectd.log"
950         Timestamp true
951         PrintSeverity false
952     </Plugin>
953
954
955 Monitoring Interfaces and Openstack Support
956 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
957 .. Figure:: monitoring_interfaces.png
958
959    Monitoring Interfaces and Openstack Support
960
961 The figure above shows the DPDK L2 forwarding application running on a compute
962 node, sending and receiving traffic. collectd is also running on this compute
963 node retrieving the stats periodically from DPDK through the dpdkstat plugin
964 and publishing the retrieved stats to Ceilometer through the ceilometer plugin.
965
966 To see this demo in action please checkout: `Barometer OPNFV Summit demo`_
967
968 References
969 ^^^^^^^^^^^
970 .. [1] https://collectd.org/wiki/index.php/Naming_schema
971 .. [2] https://github.com/collectd/collectd/blob/master/src/daemon/plugin.h
972 .. [3] https://collectd.org/wiki/index.php/Value_list_t
973 .. [4] https://collectd.org/wiki/index.php/Data_set
974 .. [5] https://collectd.org/documentation/manpages/types.db.5.shtml
975 .. [6] https://collectd.org/wiki/index.php/Data_source
976 .. [7] https://collectd.org/wiki/index.php/Meta_Data_Interface
977
978 .. _Barometer OPNFV Summit demo: https://prezi.com/kjv6o8ixs6se/software-fastpath-service-quality-metrics-demo/
979 .. _ceilometer plugin: https://github.com/openstack/collectd-ceilometer-plugin/tree/stable/mitaka
980