Skip to content

AleksNFedorov/Bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

90 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bot

Bot is a small application that helps to keep an eye on network resources using a variety of predefined checks and to be extensible for custom needs.

In a broad context the app might be used as a scheduler for any kind of task.

Project goals

  1. Provide an easy way to check network resource availability with different checks
  • Ping
  • Http
  • Trace
  1. Make it runnable on major OS: Windows, Mac OS, *nix
  2. Easily customizable and manageable

Use case

(clickable)

Features

  • Set of predefined checks: Ping, HTTP, Trace
  • Command line interface
  • Configuration with XML config
  • Modular design (just add jar with custom executors and/or reports to classpath)
  • API for custom checks and reporting

Getting started

Create config file

<config>
    <!-- Task group config -->
    <group id="GitHub.com">
        <!--
            'gitHubPing' task, runs every 10 seconds with PING executor,
            execution deadline - 3 secs
        -->
        <task id="gitHubPing" executor="PING">
            <run>10</run>
            <deadline>3</deadline>
    </task>
        <!--
            'gitHubTrace' task, runs every 30 seconds with TRACE executor,
            execution deadline - 10 secs
        -->
        <task id="gitHubTrace" executor="TRACE">
            <run>30</run>
            <deadline>10</deadline>
        </task>
    </group>
    <!--
        Un grouped 'Java.com' task, runs every 2 seconds with CUSTOM_EX executor,
        execution deadline - 1 secs
        Contains extra parameters for executor in executorConfig node
    -->
    <task id="Java.com" executor="CUSTOM_EX">
        <run>2</run>
        <deadline>1</deadline>
        <executorConfig>
            <property key="key">value</property>
        </executorConfig>
    </task>
   <!--
       Un grouped 'runOnce' task
       Runs only once with CUSTOM_ONE_RUN executor
   -->
   <task id="runOnce" executor="CUSTOM_ONE_RUN">
       <run>-1</run>
   </task>    
</config>

Build project

Build core module (Step 1)

#Build common module
cd <project_path>/common
mvn install

#Build worker module
cd <project_path>/worker
mvn install

Build moudules with checkes (Step 2)

Not implemented yet

Build custom modules if any (Step 3)

Build modules with custom checks and reports, look into the sample project for more info

  1. To add custom check
  1. To add custom report

Run project

###Windows

java -cp "common.jar;worker.jar;checks.jar;custom.jar" com.bot.worker.BotStarter --task-config-file=path_to_config_file

###Unix

java -cp "common.jar:worker.jar:checks.jar:custom.jar" com.bot.worker.BotStarter --task-config-file=path_to_config_file

###Where

  • worker.jar and common.jar - artifacts from Step 1
  • checks.jar - artifact from Step 2
  • checks.jar - artifact from Step 3
  • path_to_config_file - path to tasks XML config

Important

By default logs are written into the app home folder under ‘log’. 
Console is used for command line interface. Type --help to get command list.

More info

Beta notice

Bot is still in development. Core functionality has been implemented and significant code change are not expect, however some minor changes are likely. Stay tuned.

License

Copyright (C) 2017 Aleks Fedorov

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages