Initial import
This commit is contained in:
commit
fd00feae06
4 changed files with 84 additions and 0 deletions
30
LICENSE
Normal file
30
LICENSE
Normal file
|
@ -0,0 +1,30 @@
|
|||
Copyright (c)2011, Johan Tibell
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided
|
||||
with the distribution.
|
||||
|
||||
* Neither the name of Johan Tibell nor the names of other
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
2
Setup.hs
Normal file
2
Setup.hs
Normal file
|
@ -0,0 +1,2 @@
|
|||
import Distribution.Simple
|
||||
main = defaultMain
|
33
System/Remote/Monitoring.hs
Normal file
33
System/Remote/Monitoring.hs
Normal file
|
@ -0,0 +1,33 @@
|
|||
{-# LANGUAGE OverloadedStrings, RecordWildCards #-}
|
||||
module System.Remote.Monitoring where
|
||||
|
||||
import qualified Data.Aeson.Encode as A
|
||||
import Data.Aeson.Types ((.=))
|
||||
import qualified Data.Aeson.Types as A
|
||||
import qualified Data.ByteString.Lazy as L
|
||||
import GHC.Stats
|
||||
|
||||
instance A.ToJSON GCStats where
|
||||
toJSON (GCStats {..}) = A.object [
|
||||
"bytes_allocated" .= bytesAllocated
|
||||
, "num_gcs" .= numGcs
|
||||
, "max_bytes_used" .= maxBytesUsed
|
||||
, "num_bytes_usage_samples" .= numByteUsageSamples
|
||||
, "cumulative_butes_used" .= cumulativeBytesUsed
|
||||
, "bytes_copied" .= bytesCopied
|
||||
, "current_bytes_used" .= currentBytesUsed
|
||||
, "current_bytes_slop" .= currentBytesSlop
|
||||
, "max_bytes_slop" .= maxBytesSlop
|
||||
, "peak_megabytes_allocated" .= peakMegabytesAllocated
|
||||
, "mutator_cpu_seconds" .= mutatorCpuSeconds
|
||||
, "mutator_wall_seconds" .= mutatorWallSeconds
|
||||
, "gc_cpu_seconds" .= gcCpuSeconds
|
||||
, "gc_wall_seconds" .= gcWallSeconds
|
||||
, "cpu_seconds" .= cpuSeconds
|
||||
, "wall_seconds" .= wallSeconds
|
||||
, "par_avg_bytes_copied" .= parAvgBytesCopied
|
||||
, "par_max_bytes_copied" .= parMaxBytesCopied
|
||||
]
|
||||
|
||||
getStatsAsJson :: IO L.ByteString
|
||||
getStatsAsJson = (A.encode . A.toJSON) `fmap` getGCStats
|
19
ekg.cabal
Normal file
19
ekg.cabal
Normal file
|
@ -0,0 +1,19 @@
|
|||
Name: ekg
|
||||
Version: 0.1.0.0
|
||||
Synopsis: Remote monitoring of executables
|
||||
-- Description:
|
||||
Homepage: https://github.com/tibbe/ekg
|
||||
License: BSD3
|
||||
License-file: LICENSE
|
||||
Author: Johan Tibell
|
||||
Maintainer: johan.tibell@gmail.com
|
||||
Category: System
|
||||
Build-type: Simple
|
||||
Cabal-version: >=1.2
|
||||
|
||||
Library
|
||||
Exposed-modules: System.Remote.Monitoring
|
||||
|
||||
Build-depends: aeson < 0.4,
|
||||
base >= 4.3.1 && < 5,
|
||||
bytestring < 1.0
|
Loading…
Reference in a new issue