kiskae / fping_exporter Goto Github PK
View Code? Open in Web Editor NEWPrometheus exporter for continuous fping metrics.
Prometheus exporter for continuous fping metrics.
fping.sh:
#!/usr/bin/env bash
SCRIPT_PATH="`dirname \"$0\"`"
docker stop fping_proxy > /dev/null 2>&1
docker rm fping_proxy > /dev/null 2>&1
exec docker run --name fping_proxy --stop-signal SIGKILL $(docker build -q $SCRIPT_PATH) "$@"
Dockerfile:
ARG FPING_VERSION="5.0"
FROM buildpack-deps:buster as fping_builder
WORKDIR /usr/src/fping
RUN apt-get update && apt-get install -y \
musl-tools \
&& rm -rf /var/lib/apt/lists/*
ARG FPING_VERSION
RUN curl https://fping.org/dist/fping-${FPING_VERSION}.tar.gz | tar -xz --strip-components=1
RUN CC=musl-gcc ./configure LDFLAGS=-static && make && make install
FROM scratch
COPY --from=fping_builder /usr/local/sbin/fping /bin/
ENTRYPOINT [ "/bin/fping" ]
Research using https://github.com/http-rs/tide for the http handler, mostly because the use-case is so simple:
Accept
header.instead of putting a timeout on the entire application, turn the fping listener into a loop which has the option of periodically re-executing the fping process. This will allow for continuity of the data while also allowing an optional refresh of fping targets.
Example snippet:
trait ValidControl<F: EventHandler> {
type WrappedHandler: EventHandler;
fn wrap(handler: F) -> Self::WrappedHandler;
}
enum Disabled {}
impl<F: EventHandler> ValidControl<F> for Disabled {
type WrappedHandler = F;
fn wrap(handler: F) -> Self::WrappedHandler {
handler
}
}
struct Enabled<T> {
_marker: PhantomData<T>,
}
impl<F, T: std::fmt::Debug> ValidControl<F> for Enabled<oneshot::Sender<T>>
where
F: EventHandler<Token = Interrupted<(oneshot::Sender<T>, Claim)>>,
F::Handle: util::signal::Interruptable<Signal = nix::sys::signal::Signal> + std::fmt::Debug,
{
type WrappedHandler =
NoPrelaunchControl<LockControl<ControlToInterrupt<F, nix::sys::signal::Signal>>>;
fn wrap(handler: F) -> Self::WrappedHandler {
NoPrelaunchControl::new(LockControl::new(ControlToInterrupt::new(
handler,
<F::Handle as Interruptable>::Signal::sigquit(),
)))
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.