ochlero 0.2.0

Creator: bradpython12

Last updated:

Add to Cart

Description:

ochlero 0.2.0

# OCHLEROOchlero is a script that monitors the systemd journal for specific events thattrigger publications on an MQTT queue."Ochlero" comes from "Ochlerotatus Triseriatus", a species of tree hole breedingmosquitoes (https://en.wikipedia.org/wiki/Ochlerotatus_triseriatus), iemosquitoes that like logs...## Running and testingOchlero is tested against and runs on python 2.7 and python 3.5.With python 2.x you need to install the systemd and mqtt wrappers on your system.On CentOS or Fedora, you can do so with the following command (extra repositoriessuch as EPEL might need to be activated):```bashsudo yum install systemd-python python-paho-mqtt```This is necessary due to a problem in the PyPI version of the systemd wrapper.With python 3.5, running```bashpip install -r requiremenits.txt```should be enough.To start ochlero, simply run```bashochlero -c /path/to/config/file.yaml```## The configuration fileOchlero uses a yaml configuration file to define the mosquitto service to publishto, and the processes and events to look for. See etc/ochlero.yaml for an example.### Writing patternsWhen ochlero is running, it will attempt to match log lines associated with a givenunit or command against patterns. A pattern is basically a regular expression.Please refer to python's documentation for details on syntax, for examplehttps://docs.python.org/2/howto/regex.htmlMost of the time, you will want to pick some information from the log line andpublish it to MQTT. These elements of interest are defined in the pattern likebash variables, ie "ELEMENTNAME.Youmustthendefinetheregexmatchingforeachvariableinthedirective"where"ofyourevent.Forexample:‘‘‘yamlevents−name:helloworldpattern:"hello,mynameis{PERSON}" where: PERSON: [A-Za-z]+ publish: "Hi ${PERSON}!"```A log message like "Hello, my name is Mark" will publish the message "Hi Mark!".### Predefined substitution typesTo make it easier for you, some substitutions are included in ochlero so you don'thave to write annoying regular expressions:* \_ALPHANUMERIC\_* \_INT\_* \_URL\_* \_EMAIL\_* \_IPv4\_* \_SYSLOGTIMESTAMP\_### Writing messages to publishVariables can be reused as they are in publish messages (see previous example). Somepredefined "macros" can also be used:* \_EPOCH\_ : the Unix Epoch timestamp at parsing time.## ContributingOchlero is developped in **Software Factory** and contributions follow a review workflow.To contribute:1. Log in once to Software Factory at https://softwarefactory-project.io2. Set up your ssh key in Gerrit's settings page3. Clone the project:```bashgit clone ssh://<your_username>@softwarefactory-project.io:29418/software-factory/ochlero.git```4. Set up git review```bashcd ochlero && git review -s```5. Work on your feature, make a commit, then send the review```bashgit commit -m'my feature' && git review```

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.