docs: finalize userguide for Danube
[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 utilitzation 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 overriden.
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 persistant (i.e. it will not survive a
194  reboot).
195
196 DPDK events plugin
197 ^^^^^^^^^^^^^^^^^^^^^^
198 Repo: https://github.com/collectd/collectd
199
200 Branch: master
201
202 Dependencies: DPDK (http://dpdk.org/)
203
204 To build and install DPDK to /usr please see:
205 https://github.com/collectd/collectd/blob/master/docs/BUILD.dpdkstat.md
206
207 Building and installing collectd:
208
209 .. code:: bash
210
211     $ git clone https://github.com/maryamtahhan/collectd.git
212     $ cd collectd
213     $ ./build.sh
214     $ ./configure --enable-syslog --enable-logfile --enable-debug
215     $ make
216     $ sudo make install
217
218 This will install collectd to /opt/collectd
219 The collectd configuration file can be found at /opt/collectd/etc
220 To configure the dpdkevents plugin you need to modify the configuration file to
221 include:
222
223 .. code:: bash
224
225     LoadPlugin dpdkevents
226     <Plugin "dpdkevents">
227         Interval 1
228         <EAL>
229             Coremask "0x1"
230             MemoryChannels "4"
231             ProcessType "secondary"
232             FilePrefix "rte"
233         </EAL>
234         <Event "link_status">
235             SendEventsOnUpdate true
236             EnabledPortMask 0xffff
237             PortName "interface1"
238             PortName "interface2"
239             SendNotification false
240         </Event>
241         <Event "keep_alive">
242             SendEventsOnUpdate true
243             LCoreMask "0xf"
244             KeepAliveShmName "/dpdk_keepalive_shm_name"
245             SendNotification false
246         </Event>
247     </Plugin>
248
249 For more information on the plugin parameters, please see:
250 https://github.com/collectd/collectd/blob/master/src/collectd.conf.pod
251
252 .. note:: If you are not building and installing DPDK system-wide
253  you will need to specify the specific paths to the header files and libraries
254  using LIBDPDK_CPPFLAGS and LIBDPDK_LDFLAGS. You will also need to add the DPDK
255  library symbols to the shared library path using ldconfig. Note that this
256  update to the shared library path is not persistant (i.e. it will not survive a
257  reboot).
258
259 .. code:: bash
260
261     $ ./configure LIBDPDK_CPPFLAGS="path to DPDK header files" LIBDPDK_LDFLAGS="path to DPDK libraries"
262
263 Hugepages Plugin
264 ^^^^^^^^^^^^^^^^^
265 Repo: https://github.com/collectd/collectd
266
267 Branch: master
268
269 Dependencies: None, but assumes hugepages are configured.
270
271 To configure some hugepages:
272
273 .. code:: bash
274
275    sudo mkdir -p /mnt/huge
276    sudo mount -t hugetlbfs nodev /mnt/huge
277    sudo echo 14336 > /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages
278
279 Building and installing collectd:
280
281 .. code:: bash
282
283     $ git clone https://github.com/collectd/collectd.git
284     $ cd collectd
285     $ ./build.sh
286     $ ./configure --enable-syslog --enable-logfile --enable-hugepages --enable-debug
287     $ make
288     $ sudo make install
289
290 This will install collectd to /opt/collectd
291 The collectd configuration file can be found at /opt/collectd/etc
292 To configure the hugepages plugin you need to modify the configuration file to
293 include:
294
295 .. code:: bash
296
297     LoadPlugin hugepages
298     <Plugin hugepages>
299         ReportPerNodeHP  true
300         ReportRootHP     true
301         ValuesPages      true
302         ValuesBytes      false
303         ValuesPercentage false
304     </Plugin>
305
306 For more information on the plugin parameters, please see:
307 https://github.com/collectd/collectd/blob/master/src/collectd.conf.pod
308
309 Intel RDT Plugin
310 ^^^^^^^^^^^^^^^^
311 Repo: https://github.com/collectd/collectd
312
313 Branch: master
314
315 Dependencies:
316
317   * PQoS/Intel RDT library https://github.com/01org/intel-cmt-cat.git
318   * msr kernel module
319
320 Building and installing PQoS/Intel RDT library:
321
322 .. code:: bash
323
324     $ git clone https://github.com/01org/intel-cmt-cat.git
325     $ cd intel-cmt-cat
326     $ make
327     $ make install PREFIX=/usr
328
329 You will need to insert the msr kernel module:
330
331 .. code:: bash
332
333     $ modprobe msr
334
335 Building and installing collectd:
336
337 .. code:: bash
338
339     $ git clone https://github.com/collectd/collectd.git
340     $ cd collectd
341     $ ./build.sh
342     $ ./configure --enable-syslog --enable-logfile --with-libpqos=/usr/ --enable-debug
343     $ make
344     $ sudo make install
345
346 This will install collectd to /opt/collectd
347 The collectd configuration file can be found at /opt/collectd/etc
348 To configure the RDT plugin you need to modify the configuration file to
349 include:
350
351 .. code:: bash
352
353     <LoadPlugin intel_rdt>
354       Interval 1
355     </LoadPlugin>
356     <Plugin "intel_rdt">
357       Cores ""
358     </Plugin>
359
360 For more information on the plugin parameters, please see:
361 https://github.com/collectd/collectd/blob/master/src/collectd.conf.pod
362
363 IPMI Plugin
364 ^^^^^^^^^^^^
365 Repo: https://github.com/maryamtahhan/collectd
366
367 Branch: feat_ipmi_events, feat_ipmi_analog
368
369 Dependencies: OpenIPMI library
370
371 The IPMI plugin is already implemented in the latest collectd and sensors
372 like temperature, voltage, fanspeed, current are already supported there.
373 The list of supported IPMI sensors has been extended and sensors like flow,
374 power are supported now. Also, a System Event Log (SEL) notification feature
375 has been introduced.
376
377 * The feat_ipmi_events branch includes new SEL feature support in collectd
378   IPMI plugin. If this feature is enabled, the collectd IPMI plugin will
379   dispatch notifications about new events in System Event Log.
380
381 * The feat_ipmi_analog branch includes the support of extended IPMI sensors in
382   collectd IPMI plugin.
383
384 On Ubuntu, install the dependencies:
385
386 .. code:: bash
387
388     $ sudo apt-get install libopenipmi-dev
389
390 Enable IPMI support in the kernel:
391
392 .. code:: bash
393
394     $ sudo modprobe ipmi_devintf
395     $ sudo modprobe ipmi_si
396
397 **Note**: If HW supports IPMI, the ``/dev/ipmi0`` character device will be
398 created.
399
400 Clone and install the collectd IPMI plugin:
401
402 .. code:: bash
403
404     $ git clone  https://github.com/maryamtahhan/collectd
405     $ cd collectd
406     $ git checkout $BRANCH
407     $ ./build.sh
408     $ ./configure --enable-syslog --enable-logfile --enable-debug
409     $ make
410     $ sudo make install
411
412 Where $BRANCH is feat_ipmi_events or feat_ipmi_analog.
413
414 This will install collectd to default folder ``/opt/collectd``. The collectd
415 configuration file (``collectd.conf``) can be found at ``/opt/collectd/etc``. To
416 configure the IPMI plugin you need to modify the file to include:
417
418 .. code:: bash
419
420     LoadPlugin ipmi
421     <Plugin ipmi>
422        SELEnabled true # only feat_ipmi_events branch supports this
423     </Plugin>
424
425 **Note**: By default, IPMI plugin will read all available analog sensor values,
426 dispatch the values to collectd and send SEL notifications.
427
428 For more information on the IPMI plugin parameters and SEL feature configuration,
429 please see:
430 https://github.com/maryamtahhan/collectd/blob/feat_ipmi_events/src/collectd.conf.pod
431
432 Extended analog sensors support doesn't require additional configuration. The usual
433 collectd IPMI documentation can be used:
434
435 - https://collectd.org/wiki/index.php/Plugin:IPMI
436 - https://collectd.org/documentation/manpages/collectd.conf.5.shtml#plugin_ipmi
437
438 IPMI documentation:
439
440 - https://www.kernel.org/doc/Documentation/IPMI.txt
441 - http://www.intel.com/content/www/us/en/servers/ipmi/ipmi-second-gen-interface-spec-v2-rev1-1.html
442
443 Mcelog Plugin
444 ^^^^^^^^^^^^^^
445 Repo: https://github.com/collectd/collectd
446
447 Branch: master
448
449 Dependencies: mcelog
450
451 Start by installing mcelog. Note: The kernel has to have CONFIG_X86_MCE
452 enabled. For 32bit kernels you need at least a 2.6,30 kernel.
453
454 On ubuntu:
455
456 .. code:: bash
457
458     $ apt-get update && apt-get install mcelog
459
460 Or build from source
461
462 .. code:: bash
463
464     $ git clone git://git.kernel.org/pub/scm/utils/cpu/mce/mcelog.git
465     $ cd mcelog
466     $ make
467     ... become root ...
468     $ make install
469     $ cp mcelog.service /etc/systemd/system/
470     $ systemctl enable mcelog.service
471     $ systemctl start mcelog.service
472
473
474 Verify you got a /dev/mcelog. You can verify the daemon is running completely
475 by running:
476
477 .. code:: bash
478
479      $ mcelog --client
480
481 This should query the information in the running daemon. If it prints nothing
482 that is fine (no errors logged yet). More info @
483 http://www.mcelog.org/installation.html
484
485 Modify the mcelog configuration file "/etc/mcelog/mcelog.conf" to include or
486 enable:
487
488 .. code:: bash
489
490     socket-path = /var/run/mcelog-client
491
492 Clone and install the collectd mcelog plugin:
493
494 .. code:: bash
495
496     $ git clone  https://github.com/maryamtahhan/collectd
497     $ cd collectd
498     $ git checkout feat_ras
499     $ ./build.sh
500     $ ./configure --enable-syslog --enable-logfile --enable-debug
501     $ make
502     $ sudo make install
503
504 This will install collectd to /opt/collectd
505 The collectd configuration file can be found at /opt/collectd/etc
506 To configure the mcelog plugin you need to modify the configuration file to
507 include:
508
509 .. code:: bash
510
511     <LoadPlugin mcelog>
512       Interval 1
513     </LoadPlugin>
514     <Plugin "mcelog">
515        McelogClientSocket "/var/run/mcelog-client"
516     </Plugin>
517
518 For more information on the plugin parameters, please see:
519 https://github.com/maryamtahhan/collectd/blob/feat_ras/src/collectd.conf.pod
520
521 Simulating a Machine Check Exception can be done in one of 3 ways:
522
523 * Running $make test in the mcelog cloned directory - mcelog test suite
524 * using mce-inject
525 * using mce-test
526
527 **mcelog test suite:**
528
529 It is always a good idea to test an error handling mechanism before it is
530 really needed. mcelog includes a test suite. The test suite relies on
531 mce-inject which needs to be installed and in $PATH.
532
533 You also need the mce-inject kernel module configured (with
534 CONFIG_X86_MCE_INJECT=y), compiled, installed and loaded:
535
536 .. code:: bash
537
538     $ modprobe mce-inject
539
540 Then you can run the mcelog test suite with
541
542 .. code:: bash
543
544     $ make test
545
546 This will inject different classes of errors and check that the mcelog triggers
547 runs. There will be some kernel messages about page offlining attempts. The
548 test will also lose a few pages of memory in your system (not significant)
549 **Note this test will kill any running mcelog, which needs to be restarted
550 manually afterwards**.
551 **mce-inject:**
552
553 A utility to inject corrected, uncorrected and fatal machine check exceptions
554
555 .. code:: bash
556
557     $ git clone https://git.kernel.org/pub/scm/utils/cpu/mce/mce-inject.git
558     $ cd mce-inject
559     $ make
560     $ modprobe mce-inject
561
562 Modify the test/corrected script to include the following:
563
564 .. code:: bash
565
566     CPU 0 BANK 0
567     STATUS 0xcc00008000010090
568     ADDR 0x0010FFFFFFF
569
570 Inject the error:
571 .. code:: bash
572
573     $ ./mce-inject < test/corrected
574
575 **Note: the uncorrected and fatal scripts under test will cause a platform reset.
576 Only the fatal script generates the memory errors**. In order to  quickly
577 emulate uncorrected memory errors and avoid host reboot following test errors
578 from mce-test  suite can be injected:
579
580 .. code:: bash
581
582        $ mce-inject  mce-test/cases/coverage/soft-inj/recoverable_ucr/data/srao_mem_scrub
583
584 **mce-test:**
585
586 In addition an more in-depth test of the Linux kernel machine check facilities
587 can be done with the mce-test test suite. mce-test supports testing uncorrected
588 error handling, real error injection, handling of different soft offlining
589 cases, and other tests.
590
591 **Corrected memory error injection:**
592
593 To inject corrected memory errors:
594
595 * Remove sb_edac and edac_core kernel modules: rmmod sb_edac rmmod edac_core
596 * Insert einj module: modprobe einj param_extension=1
597 * Inject an error by specifying details (last command should be repeated at least two times):
598
599 .. code:: bash
600
601     $ APEI_IF=/sys/kernel/debug/apei/einj
602     $ echo 0x8 > $APEI_IF/error_type
603     $ echo 0x01f5591000 > $APEI_IF/param1
604     $ echo 0xfffffffffffff000 > $APEI_IF/param2
605     $ echo 1 > $APEI_IF/notrigger
606     $ echo 1 > $APEI_IF/error_inject
607
608 * Check the MCE statistic: mcelog --client. Check the mcelog log for injected error details: less /var/log/mcelog.
609
610 Open vSwitch Plugins
611 ^^^^^^^^^^^^^^^^^^^^^
612 OvS Events Repo: https://github.com/collectd/collectd
613
614 OvS Stats Repo: https://github.com/maryamtahhan/collectd
615
616 OvS Events Branch: master
617
618 OvS Stats Branch:feat_ovs_stats
619
620 OvS Events MIBs: The SNMP OVS interface link status is provided by standard
621 IF-MIB (http://www.net-snmp.org/docs/mibs/IF-MIB.txt)
622
623 Dependencies: Open vSwitch, Yet Another JSON Library (https://github.com/lloyd/yajl)
624
625 On Ubuntu, install the dependencies:
626
627 .. code:: bash
628
629     $ sudo apt-get install libyajl-dev openvswitch-switch
630
631 Start the Open vSwitch service:
632
633 .. code:: bash
634
635     $ sudo service openvswitch-switch start
636
637 configure the ovsdb-server manager:
638
639 .. code:: bash
640
641     $ sudo ovs-vsctl set-manager ptcp:6640
642
643 Clone and install the collectd ovs plugin:
644
645 .. code:: bash
646
647     $ git clone $REPO
648     $ cd collectd
649     $ git checkout $BRANCH
650     $ ./build.sh
651     $ ./configure --enable-syslog --enable-logfile --enable-debug
652     $ make
653     $ sudo make install
654
655 where $REPO is one of the repos listed at the top of this section.
656
657 Where $BRANCH is master or feat_ovs_stats.
658
659 This will install collectd to /opt/collectd. The collectd configuration file
660 can be found at /opt/collectd/etc. To configure the OVS events plugin you
661 need to modify the configuration file to include:
662
663 .. code:: bash
664
665     <LoadPlugin ovs_events>
666        Interval 1
667     </LoadPlugin>
668     <Plugin "ovs_events">
669        Port 6640
670        Socket "/var/run/openvswitch/db.sock"
671        Interfaces "br0" "veth0"
672        SendNotification false
673        DispatchValues true
674     </Plugin>
675
676 To configure the OVS stats plugin you need to modify the configuration file
677 to include:
678
679 .. code:: bash
680
681     <LoadPlugin ovs_stats>
682        Interval 1
683     </LoadPlugin>
684     <Plugin ovs_stats>
685        Port "6640"
686        Address "127.0.0.1"
687        Socket "/var/run/openvswitch/db.sock"
688        Bridges "br0" "br_ext"
689     </Plugin>
690
691 For more information on the plugin parameters, please see:
692 https://github.com/collectd/collectd/blob/master/src/collectd.conf.pod
693 and
694 https://github.com/maryamtahhan/collectd/blob/feat_ovs_stats/src/collectd.conf.pod
695
696 SNMP Agent Plugin
697 ^^^^^^^^^^^^^^^^^
698 Repo: https://github.com/maryamtahhan/collectd/
699
700 Branch: feat_snmp
701
702 Dependencies: NET-SNMP library
703
704 Start by installing net-snmp and dependencies.
705
706 On ubuntu:
707
708 .. code:: bash
709
710     $ apt-get install snmp snmp-mibs-downloader snmpd libsnmp-dev
711     $ systemctl start snmpd.service
712
713 Or build from source
714
715 Become root to install net-snmp dependencies
716
717 .. code:: bash
718
719     $ apt-get install libperl-dev
720
721 Clone and build net-snmp
722
723 .. code:: bash
724
725     $ git clone https://github.com/haad/net-snmp.git
726     $ cd net-snmp
727     $ ./configure --with-persistent-directory="/var/net-snmp" --with-systemd --enable-shared --prefix=/usr
728     $ make
729
730 Become root
731
732 .. code:: bash
733
734     $ make install
735
736 Copy default configuration to persistent folder
737
738 .. code:: bash
739
740     $ cp EXAMPLE.conf /usr/share/snmp/snmpd.conf
741
742 Set library path and default MIB configuration
743
744 .. code:: bash
745
746     $ cd ~/
747     $ echo export LD_LIBRARY_PATH=/usr/lib >> .bashrc
748     $ net-snmp-config --default-mibdirs
749     $ net-snmp-config --snmpconfpath
750
751 Configure snmpd as a service
752
753 .. code:: bash
754
755     $ cd net-snmp
756     $ cp ./dist/snmpd.service /etc/systemd/system/
757     $ systemctl enable snmpd.service
758     $ systemctl start snmpd.service
759
760 Add the following line to snmpd.conf configuration file
761 "/usr/share/snmp/snmpd.conf" to make all OID tree visible for SNMP clients:
762
763 .. code:: bash
764
765     view   systemonly  included   .1
766
767 To verify that SNMP is working you can get IF-MIB table using SNMP client
768 to view the list of Linux interfaces:
769
770 .. code:: bash
771
772     $ snmpwalk -v 2c -c public localhost IF-MIB::interfaces
773
774 Clone and install the collectd snmp_agent plugin:
775
776 .. code:: bash
777
778     $ git clone  https://github.com/maryamtahhan/collectd
779     $ cd collectd
780     $ git checkout feat_snmp
781     $ ./build.sh
782     $ ./configure --enable-syslog --enable-logfile --enable-debug --enable-snmp --with-libnetsnmp
783     $ make
784     $ sudo make install
785
786 This will install collectd to /opt/collectd
787 The collectd configuration file can be found at /opt/collectd/etc
788 **SNMP Agent plugin is a generic plugin and cannot work without configuration**.
789 To configure the snmp_agent plugin you need to modify the configuration file to
790 include OIDs mapped to collectd types. The following example maps scalar
791 memAvailReal OID to value represented as free memory type of memory plugin:
792
793 .. code:: bash
794
795     LoadPlugin snmp_agent
796     <Plugin "snmp_agent">
797       <Data "memAvailReal">
798         Plugin "memory"
799         Type "memory"
800         TypeInstance "free"
801         OIDs "1.3.6.1.4.1.2021.4.6.0"
802       </Data>
803     </Plugin>
804
805 For more information on the plugin parameters, please see:
806 https://github.com/maryamtahhan/collectd/blob/feat_snmp/src/collectd.conf.pod
807
808 For more details on AgentX subagent, please see:
809 http://www.net-snmp.org/tutorial/tutorial-5/toolkit/demon/
810
811 Installing collectd as a service
812 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
813 **NOTE**: In an OPNFV installation, collectd is installed and configured as a
814 service.
815
816 Collectd service scripts are available in the collectd/contrib directory.
817 To install collectd as a service:
818
819 .. code:: bash
820
821     $ sudo cp contrib/systemd.collectd.service /etc/systemd/system/
822     $ cd /etc/systemd/system/
823     $ sudo mv systemd.collectd.service collectd.service
824     $ sudo chmod +x collectd.service
825
826 Modify collectd.service
827
828 .. code:: bash
829
830     [Service]
831     ExecStart=/opt/collectd/sbin/collectd
832     EnvironmentFile=-/opt/collectd/etc/
833     EnvironmentFile=-/opt/collectd/etc/
834     CapabilityBoundingSet=CAP_SETUID CAP_SETGID
835
836 Reload
837
838 .. code:: bash
839
840     $ sudo systemctl daemon-reload
841     $ sudo systemctl start collectd.service
842     $ sudo systemctl status collectd.service should show success
843
844 Additional useful plugins
845 ^^^^^^^^^^^^^^^^^^^^^^^^^^
846
847 * **Exec Plugin** : Can be used to show you when notifications are being
848  generated by calling a bash script that dumps notifications to file. (handy
849  for debug). Modify /opt/collectd/etc/collectd.conf:
850
851 .. code:: bash
852
853    LoadPlugin exec
854    <Plugin exec>
855    #   Exec "user:group" "/path/to/exec"
856       NotificationExec "user" "<path to barometer>/barometer/src/collectd/collectd_sample_configs/write_notification.sh"
857    </Plugin>
858
859 write_notification.sh (just writes the notification passed from exec through
860 STDIN to a file (/tmp/notifications)):
861
862 .. code:: bash
863
864    #!/bin/bash
865    rm -f /tmp/notifications
866    while read x y
867    do
868      echo $x$y >> /tmp/notifications
869    done
870
871 output to /tmp/notifications should look like:
872
873 .. code:: bash
874
875     Severity:WARNING
876     Time:1479991318.806
877     Host:localhost
878     Plugin:ovs_events
879     PluginInstance:br-ex
880     Type:gauge
881     TypeInstance:link_status
882     uuid:f2aafeec-fa98-4e76-aec5-18ae9fc74589
883
884     linkstate of "br-ex" interface has been changed to "DOWN"
885
886 * **logfile plugin**: Can be used to log collectd activity. Modify
887   /opt/collectd/etc/collectd.conf to include:
888
889 .. code:: bash
890
891     LoadPlugin logfile
892     <Plugin logfile>
893         LogLevel info
894         File "/var/log/collectd.log"
895         Timestamp true
896         PrintSeverity false
897     </Plugin>
898
899
900 Monitoring Interfaces and Openstack Support
901 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
902 .. Figure:: monitoring_interfaces.png
903
904    Monitoring Interfaces and Openstack Support
905
906 The figure above shows the DPDK L2 forwarding application running on a compute
907 node, sending and receiving traffic. collectd is also running on this compute
908 node retrieving the stats periodically from DPDK through the dpdkstat plugin
909 and publishing the retrieved stats to Ceilometer through the ceilometer plugin.
910
911 To see this demo in action please checkout: `Barometer OPNFV Summit demo`_
912
913 References
914 ^^^^^^^^^^^
915 .. [1] https://collectd.org/wiki/index.php/Naming_schema
916 .. [2] https://github.com/collectd/collectd/blob/master/src/daemon/plugin.h
917 .. [3] https://collectd.org/wiki/index.php/Value_list_t
918 .. [4] https://collectd.org/wiki/index.php/Data_set
919 .. [5] https://collectd.org/documentation/manpages/types.db.5.shtml
920 .. [6] https://collectd.org/wiki/index.php/Data_source
921 .. [7] https://collectd.org/wiki/index.php/Meta_Data_Interface
922
923 .. _Barometer OPNFV Summit demo: https://prezi.com/kjv6o8ixs6se/software-fastpath-service-quality-metrics-demo/
924 .. _ceilometer plugin: https://github.com/openstack/collectd-ceilometer-plugin/tree/stable/mitaka
925