* listening ipv6 sockets may be both ipv4 and ipv6, depending on the IPV6_ONLY flag
* working libmnl ipv46 detection and added latency and retransmits from TCP_INFO
* fix aggregations for rtt and retrans
* code cleanup
* code cleanup
* code cleanup again
* restore field renames
* count namespaces
* run namespaces in parallel
* add libmnl to buildinfo
* lock around safe_fork()
* libmnl ports are in network byte order
* posix spawn server for both executables and callback functions
* local-sockets and network-viewer using the new spawn server
* cleanup spawn servers sockets
* spawn server stdin and stdout are linked to /dev/null
* no need for spinlock in spawn server
* empty all parameters
* new spawn server is now used for plugins.d plugins
* fix for environ
* claiming script runs via the new spawn server
* tc.plugin uses the new spawn server
* analytics, buildinfo and cgroups.plugin use the new spawn server
* cgroup-discovery uses the new spawn server
* added ability to wait or kill spawned processes
* removed old spawn server and now alert notifications use the new one
* remove left-overs
* hide spawn server internals; started working on windows version of the spawn server
* fixes for windows
* more windows work
* more work on windows
* added debug log to spawn server
* fix compilation warnings
* enable static threads on windows
* running external plugins
* working spawn server on windows
* spawn server logs to collectoers.log
* log windows last error together with errno
* log updates
* cleanup
* decode_argv does not add an empty parameter
* removed debug log
* removed debug return
* rework on close_range()
* eliminate the need for waitid()
* clear errno on the signal handler
* added universal os_setproctitle() call to support FreeBSD too
* os_get_pid_max() for windows and macos
* isolate pids array from the rest of the code in apps.plugin so that it can be turned to a hashtable
* Run the agent as a Windows service.
This commit contains the boilerplate code for running the agent as a
Windows service.
We start the agent's main as a separate thread, although this is not
strictly required based on my experiments. We need similar logic for
calling netdata's exit function when someone wants to stop the agent.
However, at this point we need to resolve the issue of gaps when
running the agent as a service. It seems that sleeping for one second
with `sleep(1)`, actually sleeps for 2 to 4 seconds on my setup.
Once we resolve this, the work that remains concerns packaging: ie.
installing the binaries at the proper places so that the relevant
DLLs are found.
To test this PR you need to:
- Build the agent: ./packaging/utils/compile-on-windows.sh
- Install the files: `ninja -C build/ install`
- Copy the main binary: `cp ./build/netdata /usr/bin/`
- (Only once) Create the netdata service: `sc.exe config Netdata binPath="C:\msys64\usr\bin\netdata"`
- Start the service: `sc.exe start Netdata`
A couple notes:
- The health and the spawn client have been disabled for the time
being. They will be re-enabled once we finish the agent-as-service
issue and the packaging.
- Last time I checked, the agent crashes after a while when using
dbengine. In order to have something that works correctly, you
should specify memory-mode ram in your netdata.conf.
* Add windows version for sleep_usec_with_now
* Split install prefix from runtime prefix
These paths are always the same for non-Windows
systems. On Windows, RFS is the top-level
installation path.
With the current setup, Netdata will be installed
at C:\msys64\opt\netdata at packaging time. However,
the layout of the application means that when the
agent starts, it'll look as if everything was installed
at /.
* Do not use mold linker on Windows.
* Use modern UI for installer.
* Make the service delayed-auto
* Use mutexes instead of spinlocks.
* Update service handling logic.
* Add proper ifdefs for spinlock implementation.
* Initialize analytics spinlock
* Add a macro to build the agent as regular cli tool.
* Add makensis dependency
* Let installer know it's installing Netdata.
* Disable pluginsd on Windows
When pluginsd is enabled, the agent freezes approximately
20% of the time during startup.
* Add service description.
* Return pthread_join result
* Print tag when we fail to join a thread.
* Do not use mutexes instead of spinlocks.
* Assorted changes to service/main code.
* Rework service functions.
With the current implementation we are not getting any
MUTEX_LOCK errors and thread joining succeeds.
The only case where joining fails is the parallel initialization
of dbengine threads, which we can easily avoid by serializing
the initialization step.
* Rework main functions
This will allow someone to run the agent either as a service
or as a command-line tool.
* Change runtime prefix only when building for packaging.
* Install binaries and dlls.
* Make netdata claiming through UI work correctly.
* Fix netdata path
* Define a single variable to identify OS.
* Remove comments.
* Move version-detection logic to separate module.
* s/VERSION/NETDATA_VERSION/g
* Hard-code NETDATA_VERSION wherever possible.
Now `program_version` is only used for getting or
setting the host's field.
* Update version variables
* Add license, fix variable name and provide better message.
* abstraction layer for O/S
* updates
* updates
* updates
* temp fix for protobuf
* emulated waitid()
* fix
* fix
* compatibility layer
* fix for idtype
* fix for missing includes
* fix for missing includes
* added missing includes
* added missing includes
* added missing includes
* added missing includes
* added missing includes
* added missing includes
* UUID renamed to ND_UUID to avoid conflict with windows.h
* include libnetdata.h always - no conflicts
* simplify abstraction headers
* fix missing functions
* fix missing functions
* fix missing functions
* fix missing functions
* rename MSYS to WINDOWS
* moved byteorder.h
* structure for an internal windows plugin
* 1st windows plugin
* working plugin
* fix printf
* Special case windows for protobuf
* remove cygwin, compile both as windows
* log windows libraries used
* fix cmake
* fix protobuf
* compilation
* updated compilation script
* added system.ram
* windows uptime
* perflib
* working perflibdump
* minify dump
* updates to windows plugins, enable ML
* minor compatibility fixes for cygwin and msys
* perflib-dump to its own file
* perflib now indexes names
* improvements to the library; disks module WIP
* API for selectively traversing the metrics
* first working perflib chart: disk.space
* working chart on logical and physical disks
* added windows protocols
* fix datatypes for loops
* tinysleep for native smallest sleep support
* remove libuuid dependency on windows
* fix uuid functions for macos compilation
* fix uuid comparison function
* do not overwrite uuid library functions, define them as aliases to our own
* fixed uuid_unparse functions
* fixed typo
* added perflib processor charts
* updates for compiling without posix emulation
* gather common contexts together
* fix includes on linux
* perflib-memory
* windows mem.available
* Update variable names for protobuf
* network traffic
* add network adapters that have traffic as virtual interfaces
* add -pipe to windows compilation
* reset or overflow flag is now per dimension
* dpc is now counted separately
* verified all perflib fields are processed and no text fields are present in the data
* more common contexts
* fix crash
* do not add system.net multiple times
* install deps update and shortcut
* all threads are now joinable behind the scenes
* fix threads cleanup
* prepare for abstracting threads API
* netdata threads full abstraction from pthreads
* more threads abstraction and cleanup
* more compatibility changes
* fix compiler warnings
* add base-devel to packages
* removed duplicate base-devel
* check for strndup
* check headers in quotes
* fix linux compilation
* fix attribute gnu_printf on macos
* fix for threads on macos
* mingw64 compatibility
* enable compilation on windows clion
* added instructions
* enable cloud
* compatibility fixes
* compatibility fixes
* compatibility fixes
* clion works on windows
* support both MSYSTEM=MSYS and MSYSTEM=MINGW64 for configure
* cleanup and docs
* rename uuid_t to nd_uuid_t to avoid conflict with windows uuid_t
* leftovers uuid_t
* do not include uuid.h on macos
* threads signaled cancellations
* do not install v0 dashboard on windows
* script to install openssh server on windows
* update openssh installation script
* update openssh installation script
* update openssh installation script
* update openssh installation script
* update openssh installation script
* update openssh installation script
* update openssh installation script
* update openssh installation script
* update openssh installation script
* use cleanup variable instead of pthreads push and pop
* replace all calls to netdata_thread_cleanup_push() and netdata_thread_cleanup_pop() with __attribute__((cleanup(...)))
* remove left-over freez
* make sure there are no locks acquired at thread exit
* add missing parameter
* stream receivers and senders are now voluntarily cancelled
* plugins.d now voluntarily exits its threads
* uuid_t may not be aligned to word boundaries - fix the uuid_t functions to work on unaligned objects too.
* collectors evloop is now using the new threading cancellation; ml is now not using pthread_cancel; more fixes
* eliminate threads cancellability from the code base
* fix exit timings and logs; fix uv_threads tags
* use SSL_has_pending() only when it is available
* do not use SSL_has_pending()
* dyncfg files on windows escape collon and pipe characters
* fix compilation on older systems
* fix compilation on older systems
* Create windows installer.
The installer will install everything
under C:\netdata by default.
It will:
- Install msys2 at C:\netdata
- Install netdata dependencies with pacman
- Install the agent itself under C:\netdata\opt
You can start the agent by running an MSYS
shell with C:\netdata\msys2_shell.cmd and
then start the agent normally with:
/opt/netdata/usr/sbin/netdata -D
There are a more couple things to work on:
- Verify publisher.
- Install all deps not just libuv & protobuf.
- Figure out how we want to auto-start the agent as a service.
- Check how to uninstall things.
* fixed typo
* code cleanup
* Create uninstaller
---------
Co-authored-by: vkalintiris <vasilis@netdata.cloud>