This recipe will provide a step-by-step guide to setting up the Timebeat software as a follower device without the need for a front-end or database solution. The goal of this process will be that at the end of which you can deploy your own simple PTP sync solution with the steps learned in this that are tailored to your needs.
Problem:
You just want to quickly deploy Timebeat for a small batch of devices without the whole database and front-end solution.
Ingredients (the minimum required items)
- A source of PTP
- A device that needs synchronising (a follower device)
- Internet access (or the ability to drop a file to the follower device)
Total Prep time: 2 mins, Total Cook time: 10 mins
In this recipe, we will use a GPS antenna connected to a Timebeat Grandmaster Clock (G0kK-1) for our PTP feed pre-configured to distribute multicast PTP over domain 0.
Step 1:
First, we need to get Timebeat PTP software onto the device we are looking to synchronise.
There are several methods but for this recipe, we will be using the wget function in Linux command line to pull the software from the Timebeat website (https://timebeat.app/download.php)
Once logged into the command line of our device we will just run the following command:
[root@fedora ~]# wget https://timebeat.app/assets/packages/timebeat-1.5.2-x86_64.rpm
This will place the timebeat rpm into the current folder (amend timebeat version number to match recent).
Step 2:
Let's install the package. As it's an rpm this is nice and simple:
[root@fedora ~]# rpm -ivh timebeat-1.5.2-x86_64.rpm
Verifying... ################################# [100%]
Preparing... ################################# [100%]
Updating / installing...
1:timebeat-1.5.2-1 ################################# [100%]
Step 3:
Timebeat requires a license to run with all the features, so let's get that onto the device. The license can be generated from https://timebeat.app/license.php
Simply fill in the form and the license will be emailed to you, once received (takes 10 seconds usually) just download it to your host.
In this example we have it downloaded on a different host in the same network so we are just going to do a simple scp to the follower device and we can also place it into the correct folder at the same time.
For reference the correct folder is /etc/timebeat/
scp /Users/iangough/Downloads/timebeat.lic root@10.101.101.132:/etc/timebeat/
If we go to the folder we placed the timebeat.lic file into then we can see that it has arrived correctly.
So on the host device (the follower) run the below commands:
[root@fedora ~]# cd /etc/timebeat/
[root@fedora timebeat]# ls -al
total 444
drwxr-xr-x. 1 root root 112 Dec 6 11:29 .
drwxr-xr-x. 1 root root 4706 Dec 6 11:24 ..
-rw-r--r--. 1 root root 358511 Nov 26 19:59 fields.yml
-rw-r--r--. 1 root root 432 Dec 6 11:29 timebeat.lic
-rw-r--r--. 1 root root 60201 Nov 26 19:59 timebeat.reference.yml
-rw-------. 1 root root 24950 Nov 26 19:59 timebeat.yml
As we can see the timebeat.lic file is present and has the date stamp of when we sent the file to the device.
Step 4:
Now let's configure Timebeat and then we are complete so.....
As Timebeat PTP software is an intelligent system the default configuration will pick up PTP on domain 0 and start to synchronise towards it. This means we don't need to configure a source in this recipe. Of course, if you wish to configure the source you can check out this recipe to understand how.
We will be looking at configuring the logging system so that we dont need to worry about the elastic database and grafana front end.
For this, we will look at the timebeat.reference.yml file.
This file holds almost (if not all), possible configuration options for Timebeat.
root@fedora timebeat]# vi /etc/timebeat/timebeat.reference.yml
Now it's a big file. So we want to jump to line 959. This is the file output section. It will match the below:
959 # -------------------------------- File Output --------------------------------- 960 #output.file: 961 # Boolean flag to enable or disable the output module. 962 #enabled: true 963 964 # Configure JSON encoding 965 #codec.json: 966 # Pretty-print JSON event 967 #pretty: false 968 969 # Configure escaping HTML symbols in strings. 970 #escape_html: false 971 972 # Path to the directory where to save the generated files. The option is 973 # mandatory. 974 #path: "/tmp/timebeat" 975 976 # Name of the generated files. The default is `timebeat` and it generates 977 # files: `timebeat`, `timebeat.1`, `timebeat.2`, etc. 978 #filename: timebeat 979 980 # Maximum size in kilobytes of each file. When this size is reached, and on 981 # every Timebeat restart, the files are rotated. The default value is 10240 982 # kB. 983 #rotate_every_kb: 10000 984 985 # Maximum number of files under path. When this number of files is reached, 986 # the oldest file is deleted and the rest are shifted from last to first. The 987 # default is 7 files. 988 #number_of_files: 7 989 990 # Permissions to use for file creation. The default is 0600. 991 #permissions: 0600 992
Once we have found this, we want to copy it into our main config file.
So use your traditional copy-paste keys or mouse clicks then open up the timebeat.yml file
root@fedora timebeat]# vi /etc/timebeat/timebeat.yml
Jump to line 455
We want to comment out our elasticsearch output here. From the default config file, the only item we need to amend is line 457 and 459
Let's quickly comment them out with the # symbol.
456 # ---------------------------- Elasticsearch Output ---------------------------- 457 # output.elasticsearch: 458 # Array of hosts to connect to. 459 # hosts: ['localhost:9200'] # insert ip address of your elastic server 460 # hosts: ['elastic.customer.timebeat.app:9200'] # host format when using timebeat cloud
Now move a couple of lines above to line 455 and paste them into our file output config.
455 # -------------------------------- File Output --------------------------------- 456 output.file: 457 # Boolean flag to enable or disable the output module. 458 enabled: true 459 460 # Configure JSON encoding 461 codec.json: 462 # Pretty-print JSON event 463 pretty: true 464 465 # Configure escaping HTML symbols in strings. 466 #escape_html: false 467 468 # Path to the directory where to save the generated files. The option is 469 # mandatory. 470 path: "/tmp/timebeat" 471 472 # Name of the generated files. The default is `timebeat` and it generates 473 # files: `timebeat`, `timebeat.1`, `timebeat.2`, etc. 474 filename: timebeat 475 476 # Maximum size in kilobytes of each file. When this size is reached, and on 477 # every Timebeat restart, the files are rotated. The default value is 10240 478 # kB. 479 rotate_every_kb: 10000 480 481 # Maximum number of files under path. When this number of files is reached, 482 # the oldest file is deleted and the rest are shifted from last to first. The 483 # default is 7 files. 484 number_of_files: 7 485 486 # Permissions to use for file creation. The default is 0600. 487 permissions: 0600
Once in we just need to uncomment the above coloured items so:
line 456, 458 & 461 = uncommented
line 463 = uncommented and set to true
line 470, 474, 479, 484 & 487 = uncommented
Now we have to scroll to the bottom of the timebeat.yml file and just turn off the elastic search monitoring:
591 # ============================= X-Pack Monitoring ============================== 592 # Timebeat can export internal metrics to a central Elasticsearch monitoring 593 # cluster. This requires xpack monitoring to be enabled in Elasticsearch. The 594 # reporting is disabled by default. 595 596 # Set to true to enable the monitoring reporter. 597 monitoring.enabled: false 598 599 # Sets the UUID of the Elasticsearch cluster under which monitoring data for this 600 # Timebeat instance will appear in the Stack Monitoring UI. If output.elasticsearch 601 # is enabled, the UUID is derived from the Elasticsearch cluster referenced by output.elasticsearch. 602 #monitoring.cluster_uuid: 603 604 # Uncomment to send the metrics to Elasticsearch. Most settings from the 605 # Elasticsearch output are accepted here as well. 606 # Note that the settings should point to your Elasticsearch *monitoring* cluster. 607 # Any setting that is not set is automatically inherited from the Elasticsearch 608 # output configuration, so if you have the Elasticsearch output configured such 609 # that it is pointing to your Elasticsearch monitoring cluster, you can simply 610 # uncomment the following line. 611 #monitoring.elasticsearch:
So for this just modify line 597 to false and line 611 needs commenting out.
Once complete we just save and quit:
:wq!
Step 4:
Now just start the timebeat service:
[root@fedora timebeat]# service timebeat start
To test that this is working let's just 'cat' the following file:
[root@fedora timebeat]# cat /tmp/timebeat/timebeat
If all is working you will see the output in JSON format, and that is it, Timebeat now working without the database or front end.