Comments (12)
@nemesisdesign The ubus uses for this the option
-S
root@st-dev-07 /etc # ubus Usage: ubus [<options>] <command> [arguments...] Options: -s <socket>: Set the unix domain socket to connect to -t <timeout>: Set the timeout (in seconds) for a command to complete -S: Use simplified output (for scripts) -v: More verbose output -m <type>: (for monitor): include a specific message type (can be used more than once) -M <r|t> (for monitor): only capture received or transmitted traffic Commands: - list [<path>] List objects - call <path> <method> [<message>] Call an object method - subscribe <path> [<path>...] Subscribe to object(s) notifications - listen [<path>...] Listen for events - send <type> [<message>] Send an event - wait_for <object> [<object>...] Wait for multiple objects to appear on ubus - monitor Monitor ubus traffic
ok, so the opposite, show pretty output by default and simplified with an option, that works for me.
@devkapilbansal are you keen to help out with these improvements?
from openwrt-openwisp-monitoring.
Ok, should be easy, is this part of the system path or would we have to call the script as /usr/libexec/netjson_monitoring
?
Being able to call netjson_monitoring
as a command is handy if anyone wants to use NetJSON in their applications.
from openwrt-openwisp-monitoring.
Ok, should be easy, is this part of the system path or would we have to call the script as
/usr/libexec/netjson_monitoring
?
The directory is not in the system PATH.
But this is a lua script with has no help.
From my point of view only script should end up in the PATH which are also intended for the user.
I have also seen this with openwisp-config which is also not so good.
Being able to call
netjson_monitoring
as a command is handy if anyone wants to use NetJSON in their applications.
You could add an option to openwisp-monitoring to call only the netjson llua script and then return the output and exit
https://github.com/openwisp/openwrt-openwisp-monitoring/blob/gsoc21/openwrt-openwisp-monitoring/files/monitoring.agent
from openwrt-openwisp-monitoring.
If I am not wrong, we created two packages instead of one because some people only want netjson-monitoring
for their use case. If we need to add an option in openwisp-monitoring
itself, then what's the purpose of having two different packages?
from openwrt-openwisp-monitoring.
@devkapilbansal That is not what I meant.
The lua script netjson-monitoring
is only called by openwisp-monitoring
, because this is a helper script.
The command openwisp-monitoring
is the entry command for this stuff.
So my suggestion is to move netjson-monitoring
to the following location /usr/libexec/openwisp-monitoring/
so this does net called directly because /usr/libexec/openwips-monitoring
path is not in the shell $PATH variable.
The reason is that no one knows what netjson-monitoring
does if your are not familiar with openwisp.
And it does not have a help text and is only called by openwisp-monitoring
.
If you want to get the output from netjson-monitoring
you could extend openwisp-monitoring
shell script with an option for example openwisp-monitoring --dump
. As I said, the main reason is that we do not polluting the shell $PATH with helper scripts.
If you would right the programm in C you would have only openwisp-monitoring
and not a helper script like netjson-monitoring
.
from openwrt-openwisp-monitoring.
@devkapilbansal That is not what I meant.
The lua scriptnetjson-monitoring
is only called byopenwisp-monitoring
, because this is a helper script.
The commandopenwisp-monitoring
is the entry command for this stuff.
So my suggestion is to movenetjson-monitoring
to the following location/usr/libexec/openwisp-monitoring/
so this does net called directly because/usr/libexec/openwips-monitoring
path is not in the shell $PATH variable.
The reason is that no one knows whatnetjson-monitoring
does if your are not familiar with openwisp.
And it does not have a help text and is only called byopenwisp-monitoring
.If you want to get the output from
netjson-monitoring
you could extendopenwisp-monitoring
shell script with an option for exampleopenwisp-monitoring --dump
. As I said, the main reason is that we do not polluting the shell $PATH with helper scripts.If you would right the programm in C you would have only
openwisp-monitoring
and not a helper script likenetjson-monitoring
.
@feckert one of the goals of the project is to make the netjson_monitoring
available as a NetJSON DeviceMonitoring implementation. Nobody knows now but the goal is to make it available and some people may use it.
Therefore this program should be kept the way it is. OpenWISP Monitoring is strictly related to OpenWISP, the "NetJSON DeviceMonitoring" format can be used independently from OpenWISP.
I hope this clarifies.
from openwrt-openwisp-monitoring.
@nemesisdesign Well, if that is the case, then we should add the following changes to netjson-monitoring
to be a full shell command.
- When calling the command without arguments, the help text should be displayed (this is normal the case for shell commands)
- When called with the
--help
or-h
option, the help text should also be displayed. - When calling with the option
--dump
the output should be dumped in json
You could also consider adding an option to --dump
that it should be well formatted (human readable) or simply a line (which is then quickly readable for a following script to read the json, since no new lines are included).
Translated with www.DeepL.com/Translator (free version)
from openwrt-openwisp-monitoring.
@nemesisdesign Well, if that is the case, then we should add the following changes to
netjson-monitoring
to be a full shell command.
- When calling the command without arguments, the help text should be displayed (this is normal the case for shell commands)
- When called with the
--help
or-h
option, the help text should also be displayed.- When calling with the option
--dump
the output should be dumped in jsonYou could also consider adding an option to
--dump
that it should be well formatted (human readable) or simply a line (which is then quickly readable for a following script to read the json, since no new lines are included).
Maybe you meant pretty
, readable
or something similar?
Ok, let's do these changes, I'll update the issue description.
from openwrt-openwisp-monitoring.
@nemesisdesign The ubus uses for this the option -S
root@st-dev-07 /etc # ubus
Usage: ubus [<options>] <command> [arguments...]
Options:
-s <socket>: Set the unix domain socket to connect to
-t <timeout>: Set the timeout (in seconds) for a command to complete
-S: Use simplified output (for scripts)
-v: More verbose output
-m <type>: (for monitor): include a specific message type
(can be used more than once)
-M <r|t> (for monitor): only capture received or transmitted traffic
Commands:
- list [<path>] List objects
- call <path> <method> [<message>] Call an object method
- subscribe <path> [<path>...] Subscribe to object(s) notifications
- listen [<path>...] Listen for events
- send <type> [<message>] Send an event
- wait_for <object> [<object>...] Wait for multiple objects to appear on ubus
- monitor Monitor ubus traffic
from openwrt-openwisp-monitoring.
ok, so the opposite, show pretty output by default and simplified with an option, that works for me.
@devkapilbansal are you keen to help out with these improvements?
Sure, I will look into it.
Here, what is difference between pretty and simplified?
Also, what we are supposed to do? Like, to move netjson-monitoring to /usr/libexec/netjson_monitoring
and call it via a script located at /usr/sbin
or make changes in netjson-monitoring directly.
from openwrt-openwisp-monitoring.
ok, so the opposite, show pretty output by default and simplified with an option, that works for me.
@devkapilbansal are you keen to help out with these improvements?Sure, I will look into it.
Here, what is difference between pretty and simplified?
Also, what we are supposed to do? Like, to move netjson-monitoring to/usr/libexec/netjson_monitoring
and call it via a script located at/usr/sbin
or make changes in netjson-monitoring directly.
My understanding is that we can leave it where it is now but add the help text to it as @feckert suggested.
He suggests to make sure the output is indented by default (pretty) but can be spit out as "simplified" for script usage (as ubus does), so we'll need to edit the code of the openwisp monitoring agent to use the simplified/script version.
The only thing in which I'd differ from ubus, is that for the JSON output I recommend using 4 spaces, which is the most readable option. Ubus uses tabs and I find its JSON output not greatly readable.
from openwrt-openwisp-monitoring.
@feckert @devkapilbansal If I recall correctly, lua-cjson does not allow to pretty print the output.
In order to not make the package bigger, I think we should not go ahead with this idea of the pretty print, the extra space is not worth an additional library.
from openwrt-openwisp-monitoring.
Related Issues (20)
- [bug] Do not retry sending data if HTTP response is 400 bad request HOT 1
- [bug] None is not of type 'object' HOT 2
- [change] Stop sending data on repeated 404 responses HOT 3
- [feature] Add retry mechanism with randomized backoff for HTTP requests
- [feature] Add bootup_delay option
- [tests] Change JSON string assertions to data structure assertions
- Time display and adjustement HOT 2
- [bug/change] Do not add wireless interface information if channel is not available
- [enhancement] Add `htmode` to wireless interface
- [bug] 'pairs' on unexpected variable value HOT 2
- [change] Move VERSION out of /etc/openwisp/
- [bug] Spanning Tree Status shown incorrectly HOT 2
- [feature] Add more wifi station information HOT 1
- [ci] "Build and upload package" job fails when using github action cache
- [change] Introduce random pause in sending of accumulated data
- [docs] Add package installation instructions
- [bug] Agent crashes when using monitored_interfaces "wlan0 wlan1 br-lan"
- [feature] Allow recognizing wireguard interface as of type virtual HOT 2
- [bug] ULA prefix check is bugged HOT 6
- [feature] Restart/reload agent when openwisp-config is restarted
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from openwrt-openwisp-monitoring.