Well, it might seem surprising, given what this blog is usually about, but during most of my career my main focus was… in front-end development. Yup, JavaScript and friends. It wasn’t the only thing I did, but definitely the biggest one. After moving to Canada focus shifted a little bit: I still do occasional front-end tasks for our web project, which started back in 2009, but basically last 2 years I’m on a server side. Continue reading “Caveman’s brief look into modern front-end”
Tag: JavaScript
Creating collectd data source in JavaScript
Exec Plugin
In the variety of collectd plugins there’s one ‘to rule them all’. If due to some course of events all collectd plugins except for Exec would be taken from you, you’d still be able to restore all its functionality with Exec.
As the name suggests, Exec starts external program or script and interprets its output as source of data. To be specific, it looks for lines that follow this scheme:
1 |
PUTVAL hostname/source-instance/datatype-instance [Interval=seconds] timestamp:value[:value..] |
To be even more specific, these lines would work:
1 2 |
PUTVAL myhost/cpu-0/cpu-system interval=10 N:51 PUTVAL hostname/vm_count/gauge 1484012951:U |
What’s interesting, Exec doesn’t specify in what language script should be written, so anything, including JavaScript, might work. In fact, using JavaScript would be beneficial in some scenarios, e.g. when dealing with RESTful services returning JSON.
Before we try JavaScript app as data source for collectd, let’s talk about PUTVAL lines a little bit more. Continue reading “Creating collectd data source in JavaScript”