hslogstash-0.3.3: A library to work with, or as, a logstash server

Safe HaskellNone

Logstash.Counter

Description

This module is not very well named, as it has almost nothing to do with Logstash. It is used to define counters that will then be logged by collectd.

You should configure collectd to create a Unix socket :

 LoadPlugin unixsock

 <Plugin "unixsock">
    SocketFile "/var/run/collectd-unixsock"
    SocketGroup "collectdsocket"
    SocketPerms "0660"
 </Plugin>

Synopsis

Documentation

data Counter Source

The opaque counter type. It is actually just a TVar Integer.

newCounter :: IO CounterSource

Gives you a new empty counter.

incrementCounterConduit :: (Monad m, MonadIO m) => Counter -> Conduit a m aSource

This is a conduits-specific function that will increase a counter for each piece of data that traverses this conduit. It will not alter the data.

incrementCounter :: Counter -> IO ()Source

Increments a counter.

readCounter :: Counter -> IO IntegerSource

Retrieve the current value of a counter.

counter2collectdSource

Arguments

:: Counter

the counter to export

-> FilePath

path to the unix socket

-> String

name of the node, usually the server's fully qualified domain name

-> String

name of the plugin + instance

-> String

name of the counter instance

-> IO () 

This registers a counter to a Collectd server. This can be used in this way :

 counter2collectd nbmsg "/var/run/collectd-unixsock" nodename "logstash-shipper" "messages"