Linux Format - UK (2019-12)

(Antfer) #1
http://www.techradar.com/pro/linux December 2019 LXF257 83

HOTPICKS


VISUALIZATION TOOL


NODE.JS MODULE REMOVER


Keep an eye on
your software and
middleware with
this robust CLI tool.

everal times in LXF we’ve moaned about
catchy yet useless apps like Hollywood
Technodrama. Dark-themed consoles with
running numbers, charts and other means of imitating
activity in a fictional mission-control board... At last, it’s
time to put that eye-candyish interface to good use,
with the help of Sampler.
This is a monitoring and alerting tool designed to
execute shell commands and keep you informed about
their progress or state. In some ways, Sampler is a
more basic CLI equivalent to Zabbix and other
monitoring solutions, so if you’re looking for a
lightweight tool that tracks dynamic processes,
Sampler is a good bet. The application offers a single
executable that accepts settings from a YAML
configuration file:
$ sampler --config /path/to/file.yml
The only thing left to do before you are ready to go is
create the contents of such a YAML file. Sampler
features a solid number of CLI visualisation modules for
displaying various charts and information boxes, this

Sampler


itself requires some skills in writing a config file. A good
starting point is to use the real-world recipes provided
by the project (follow the links in the readme file) and
see how Sampler works with SSH sessions, database
connections, Docker container statistics, Java JMX
monitoring and so on.
Don’t miss the impressive dashboard template
provided in the example.yml file. It’s a showcase for
many Sampler modules that work right out of the box.
For instance, there are ping response meters for
Google/Yahoo!/Bing, ASCII clocks, a CPU sparkline
chart, a weather applet and some other practical things.
By modifying the YAML file you can customise the
dashboard to your liking, add or remove commands or
their arguments in any way, rearrange blocks and so on.
It’s a splendid feature for many sysadmins.

Version: 1.0.3 Web: https://github.com/
sqshq/sampler

ore and more apps are based on JavaScript,
TypeScript and other *scripts these days.
That said, most of these apps have Node.js
under the bonnet, which means you need to use the
Node.js package manager (npm) in order to resolve
dependencies and run the application. Npm is a superb
tool that automates handling of the Node.js package
repository, which is claimed as the largest software
collection in the world with over 600,000 packages
(and counting).
The only concern is that the number of installed
Node.js packages on your local machine can grow huge
and eat too much disk space. This is especially
applicable to virtual machines or other setups with
relatively small partitions. Fortunately we have Npkill,
a maintenance tool for cleaning unneeded Node.js
packages and freeing up some disk space.
Npkill can be installed via npm:
$ npm i -g npkill
After that you will be able to run the npkill command
to use this app. Npkill is not a fully-fledged package

Npkill


manager – the only thing it can do is delete packages.
If run without extra arguments, Npkill rakes the entire
home directory searching for all node_modules
subdirectories. When this is done, you’ll see the whole
list of them along with the disk space they occupy.
Select a line with arrow keys and press Space to delete
the corresponding directory. That’s it!
No dependencies or anything else are taken into
account and therefore it is solely a user’s responsibility
not to break anything. To use Npkill wisely, try to
narrow down the scope by adding more arguments:
$ npkill -d ‘~/projects’ -gb --sort size
Here we’ve limited the search to a given directory
and sorted by file size.

Version: 0.6.0 Web: https://github.
com/voidcosmos/npkill

Get rid of that old
and dusty clutter
in ‘node_modules’
with ease.

M


S


DDDecmbr 202 eb198P 18apwok December 2019 LXF257 83


HOTPICKS


VISUALIZATIONTOOL


NODE.JSMODULEREMOVER


Keep an eye on
your software and
middleware with
this robust CLI tool.

everal times in LXF we’ve moaned about
catchy yet useless apps like Hollywood
Technodrama. Dark-themed consoles with
runningnumbers, charts and other means of imitating
activity in a fictional mission-control board... At last, it’s
time to put that eye-candyish interface to good use,
with the help of Sampler.
This is a monitoring and alerting tool designed to
execute shell commands and keep you informed about
their progress or state. In some ways, Sampler is a
more basic CLI equivalent to Zabbix and other
monitoring solutions, so if you’re looking for a
lightweight tool that tracks dynamic processes,
Sampler is a good bet. The application offers a single
executable that accepts settings from a YAML
configuration file:
$ sampler --config /path/to/file.yml
The only thing left to do before you are ready to go is
create the contents of such a YAML file. Sampler
features a solid number of CLI visualisation modules for
displaying various charts and information boxes, this


Sampler


itself requires some skills in writing a config file. A good
starting point is to use the real-world recipes provided
by the project (follow the links in the readme file) and
see how Sampler works with SSH sessions, database
connections, Docker container statistics, Java JMX
monitoring and so on.
Don’t miss the impressive dashboard template
provided in the example.yml file. It’s a showcase for
many Sampler modules that work right out of the box.
For instance, there are ping response meters for
Google/Yahoo!/Bing, ASCII clocks, a CPU sparkline
chart, a weather applet and some other practical things.
By modifying the YAML file you can customise the
dashboard to your liking, add or remove commands or
their arguments in any way, rearrange blocks and so on.
It’s a splendid feature for many sysadmins.

Version: 1.0.3 Web: https://github.com/


sqshq/sampler


oreandmoreappsarebasedonJavaScript,
TypeScriptandother*scriptsthesedays.
Thatsaid,mostoftheseappshaveNode.js
underthebonnet,whichmeansyouneedtousethe
Node.jspackagemanager(npm)inordertoresolve
dependenciesandruntheapplication.Npmisasuperb
toolthatautomateshandlingoftheNode.jspackage
repository,whichisclaimedasthelargestsoftware
collectionintheworldwithover600,000packages
(andcounting).
Theonlyconcernisthatthenumberofinstalled
Node.jspackagesonyourlocalmachinecangrowhuge
andeattoomuchdiskspace.Thisisespecially
applicabletovirtualmachinesorothersetupswith
relativelysmallpartitions.FortunatelywehaveNpkill,
amaintenancetoolforcleaningunneededNode.js
packagesandfreeingupsomediskspace.
Npkillcanbeinstalledvianpm:
$ npmi -gnpkill
Afterthatyouwillbeabletorunthe npkillcommand
tousethisapp.Npkillisnotafully-fledgedpackage


Npkill


manager – the only thing it can do is delete packages.
If run without extra arguments, Npkill rakes the entire
home directory searching for all node_modules
subdirectories. When this is done, you’ll see the whole
list of them along with the disk space they occupy.
Select a line with arrow keys and press Space to delete
the corresponding directory. That’s it!
No dependencies or anything else are taken into
account and therefore it is solely a user’s responsibility
not to break anything. To use Npkill wisely, try to
narrow down the scope by adding more arguments:
$ npkill -d ‘~/projects’ -gb --sort size
Here we’ve limited the search to a given directory
and sorted by file size.

Version: 0.6.0 Web: https://github.


com/voidcosmos/npkill


Get rid of that old
and dusty clutter
in ‘node_modules’
with ease.

M


S

Free download pdf