[Enterprise SONiC] Collectd Follow
Overview:
- Collectd
Collectd can be used to place statistics in a database. Such as CPU, memory, interface, disk, etc. - Collectd-web
The main objective customizable web interface for Collectd. - RRDtool
According to Collectd data in RRD format to a Collectd-web instance for graphing.
Tested model & firmware version:
- Switch model name:
AS7362-56X
- Edgecore SONiC version:
202006
202012.2
Restriction:
- Collectd needs to take a while to start graphing, about 3 hours, or more...
Topology:
Device Spec:
Server:
ts@ts:~$ uname -a
Linux ts 5.4.0-42-generic #46~18.04.1-Ubuntu SMP Fri Jul 10 07:21:24 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
SONiC:
admin@sonic:~$ show version
SONiC Software Version: SONiC.Edgecore-SONiC_20201123_130028_ec202006_74
Distribution: Debian 10.6
Kernel: 4.19.0-6-2-amd64
Build commit: 1c751331
Build date: Mon Nov 23 15:11:49 UTC 2020
Built by: ubuntu@ip-10-5-1-235
Platform: x86_64-accton_as7326_56x-r0
HwSKU: Accton-AS7326-56X
ASIC: broadcom
Serial Number: 732656X1937002
Uptime: 14:51:41 up 22:08, 1 user, load average: 2.64, 2.66, 2.70
Procedure:
Step 1. Install packages on SONiC and Server.
SONiC:
- Modify the DNS server.
admin@sonic:~$ sudo vim /etc/resolv.conf
- apt-get update
admin@sonic:~$ sudo apt-get -o Acquire::Check-Valid-Until=false -o Acquire::Check-Date=false update
- Install the Collectd
admin@sonic:~$ sudo apt-get install collectd-core -y
admin@sonic:~$ sudo apt-get install collectd -y
- Modify collectd config.
admin@sonic:~$ sudo vim /etc/collectd/collectd.conf
Hostname "sonic"
FQDNLookup true
Interval 10
Timeout 2
ReadThreads 5
<Include "/etc/collectd/collectd.conf.d">
Filter "*.conf"
</Include>
LoadPlugin "cpu"
LoadPlugin "memory"
LoadPlugin syslog
<Plugin syslog>
LogLevel info
</Plugin>
LoadPlugin network
<Plugin network>
Server "188.188.87.33" "25826"
</Plugin>
LoadPlugin cpu
<Plugin cpu>
ReportByCpu true
ReportByState true
ValuesPercentage true
</Plugin>
LoadPlugin logfile
<Plugin logfile>
LogLevel notice
File "/var/log/collectd.log"
</Plugin>
- Restart collectd.
admin@sonic:~$ sudo service collectd restart
Server_Ubuntu18.04:
- apt-get update
root@ts:~# apt-get update
- Install the collectd.
root@ts:~# apt-get install collectd-core -y
root@ts:~# apt-get install collectd -y
- Modify collectd config.
root@ts:~# sudo vim /etc/collectd/collectd.conf
Hostname "ts"
FQDNLookup true
Interval 10
Timeout 2
ReadThreads 5
<Include "/etc/collectd/collectd.conf.d">
Filter "*.conf"
</Include>
LoadPlugin "cpu"
LoadPlugin "memory"
LoadPlugin syslog
<Plugin syslog>
LogLevel info
</Plugin>
LoadPlugin network
<Plugin network>
Listen "188.188.87.33" "25826"
</Plugin>
LoadPlugin rrdtool
<Plugin rrdtool>
DataDir "/var/lib/collectd/rrd"
# CacheTimeout 120
# CacheFlush 900
</Plugin>
LoadPlugin logfile
<Plugin logfile>
LogLevel notice
File "/var/log/collectd.log"
</Plugin>
- Restart collectd.
root@ts:~# sudo service collectd restart
- Install collectd-web
root@ts:~# apt-get install librrds-perl libjson-perl libhtml-parser-perl libcgi-session-perl
- Install git and python2 and python-minimal
root@ts:~# apt-get install git python2.7 python-minimal
- Git clone the repository of collectd-web in /usr/local.
root@ts:~# cd /usr/local/
root@ts:/usr/local# git clone https://github.com/httpdss/collectd-web.git
- The CGI scripts have to be executable
root@ts:/usr/local# cd collectd-web/
root@ts:/usr/local/collectd-web# chmod +x cgi-bin/graphdefs.cgi
- Execute collectd-web.
root@ts:/usr/local/collectd-web# python2 runserver.py 188.188.87.33 8787
Result:
*** Collectd needs to take a while to start graphing. about 3 hours, or more... ***
Comments
0 comments
Please sign in to leave a comment.