b "$Bin/../lib";
use File::Tail; # libfile-tail-perl
use HTTP::Tiny; # libhttp-tiny-perl
use JSON; # libjson-perl
# PODNAME: station-devmon
# ABSTRACT: station-devmon - Monitor Syslog for device eve
d";
my $json = to_json($device);
my %post_data = (
content => $json,
'content-type' => 'application/json',
'content-length' => length($json),
);
kage App::EventStreamr::Roles::ConfigAPI;
use v5.010;
use strict;
use warnings;
use Config::JSON;
use JSON;
use Method::Signatures 20140224; # libmethod-signatures-perl
use HTTP::Tiny '0.053'; # libh
nfig() {
return $self->config_path."/controller.json";
}
method _build_controller() {
if ( -e $self->controller_config ) {
return Config::JSON->new($self->controller_config)->config->{control
== 201) {
# Status Post Data
my $json = to_json($self->_post_data());
$self->debug($json);
my %post_data = (
content => $json,
headers => {
'stat
Bin);
use lib "$Bin/../lib";
use Proc::Daemon; # libproc-daemon-perl
use JSON; # libjson-perl
use Config::JSON; # libconfig-json-perl
use HTTP::Tiny; # libhttp-tiny-perl
use Log::Log4perl; # liblog-lo
/settings.json") {
$localconfig = Config::JSON->new("$Bin/../settings.json");
$localconfig = $localconfig->{config};
} else {
$localconfig = Config::JSON->create("$Bin/../settings.json");
$loc
nfig;
if (-e "$Bin/../station.json") {
$stationconfig = Config::JSON->new("$Bin/../station.json");
} else {
$stationconfig = Config::JSON->create("$Bin/../station.json");
$stationconfig->{config
package App::EventStreamr::Status;
use Method::Signatures;
use JSON;
use Scalar::Util::Reftype;
use Moo;
use namespace::clean;
# ABSTRACT: A status object
our $VERSION = '0.5'; # VERSION: Generated
fig->nickname;
my $json = to_json($status);
my %post_data = (
content => $json,
'content-type' => 'application/json',
'content-length' => length($json),
);
my $post
;
%post_data = (
content => to_json($data),
headers => {
'station-mgr' => 1,
'Content-Type' => 'application/json',
}
);
$post = $self->c
::Config;
use Method::Signatures;
use Sys::Hostname;
use experimental 'say';
use Config::JSON; # libconfig-json-perl
use File::Path qw(make_path);
use Carp 'croak';
use App::EventStreamr::Devices;
use
$self->devices_util->all();
}
method _build_config_file() {
return $self->config_path."/config.json";
}
method _build_nickname() {
return hostname || "default_name";
}
method _build_macaddress(
fig() {
# Config JSON barfs if you try to load a config that doesn't exist,
# this will load one or attempt to create it.
if ( -e $self->config_file ) {
return Config::JSON->new($self->confi
ERSION
my $files = File::ShareDir::Tarball::dist_dir( 'App-EventStreamr' );
set serializer => 'JSON';
# logging
set logpath => "$ENV{HOME}/.eventstreamr"; # need collect this somehow..
set logger
matches
post '/settings/:mac' => sub {
my $data->{mac} = params->{mac};
$data->{body} = from_json(request->body);
if ($data->{mac} eq "$self->{config}{macaddress}") {
my $manager = $self->{
-------------
# Post JSON content to restart an individual device eg: {"id":"dvswitch"}
post '/command/:command' => sub {
my $command = params->{command};
my $data = from_json(request->body);
in