Package: kubemon
kubemonA tool for distributed container monitoring over Kubernetes.TranslationsPortuguêsTable of contentsEnvironment RequirementsApplication RequirementsIllustrationsMain FunctionalitiesCollected MetricsInstallationConfigurationRunningStartingStoppingCommandsReferencesEnvironment requirementsUbuntu 18.04Kubernetes v1.19Docker v19.03.13Python 3.8GNU Make 4.2.1Application requirementspsutilrequestsdocker-pyvirtualenvflaskflask_restfullgunicornIllustrationsBasic diagramMain functionalitiesCollect data within the provider domainThe data are collected within Kubernetes PodsCan be configured through Kubernetes environment variablesCollects metrics from operating system, Docker containers and processes created by the containerSend the collected metrics to thecollectormodule, which saves the data in a CSV fileCan be controlled remotely by either a basic CLI or Python APICollected metricsFor more information about the collected metrics, please refer to:Operating System Metrics: These metrics are collected from linux/procfilesystem using bothpsutilPython API and/sys/block/<dev>/stat.CPU:Miscellaneous kernel statistics in /proc/statMemory:proc - process information pseudo-filesystem: /proc/vmstatDisk :Block layer statistics in /sys/block/<dev>/statNetwork:proc - process information pseudo-filesystem: /proc/net/devDocker: These metrics are collected from linuxcgroups.CPU:cgroups - Linux control groups: cpu,cpuacctMemory:cgroups - Linux control groups: memoryDisk:cgroups - Linux control groups: blkioNetwork:proc - process information pseudo-filesystem: /proc/net/devDocker Processes: These metrics are collected from linux/procfilesystem usingpsutilPython API.CPU:Miscellaneous kernel statistics in /proc/statMemory:proc - process information pseudo-filesystem: /proc/vmstatDisk:Block layer statistics in /sys/block/<dev>/statNetwork:proc - process information pseudo-filesystem: /proc/net/devOperating SystemTypeUnitMetricCPUQuantityQuantityQuantityQuantityClock TicksClock TicksClock TicksClock TicksClock TicksClock TicksClock TicksClock TicksClock TicksContext SwitchesInterruptsSoft InterruptsSyscallsTimes UserTimes SystemTimes NiceTimes SoftirqTimes IRQTimes IOWaitTimes GuestTimes Guest NiceTimes IdleMemoryQuantityQuantityQuantityQuantityQuantityKBKBQuantityQuantityQuantityQuantityActive (Anon)Inactive (Anon)Inactive (file)Active (file)Mapped PagesKB Paged In Since Boot (pgpgin)KB Paged Out Since Boot (pgpgout)Pages Free (pgfree)Page Faults (pgfault)Major Page Faults (pgmajfault)Pages Reused (pgreuse)DiskRequestsRequestsSectorsMillisecondsRequestsRequestsSectorsMillisecondsRequestsMillisecondsMillisecondsRequestsRequestsSectorsMillisecondsRequestsMillisecondsRead I/ORead I/O Merged with In-queue I/ORead SectorsTotal Wait Time for Read RequestsWrite I/OWrite I/O Merged with In-Queue I/OWrite SectorsTotal Wait Time for Write RequestsI/O in FlightTotal Time This Block Device Has Been ActiveTotal Wait Time for All RequestsDiscard I/O ProcessedDiscard I/O Processed with In-Queue I/ODiscard SectorsTotal Wait Time for Discard RequestsFlush I/O ProcessedTotal Wait Time for Flush RequestsNetworkBytesBytesPacketsPacketsSentReceivedSentReceivedDocker ProcessesTypeUnitMetricCPUClock TicksClock TicksClock TicksClock TicksClock TicksUser TimeSystem TimeChildren UserChildren SystemIOWaitMemoryPagesPagesPagesPagesPagesPagesPagesTotal Program Size (size)Resident Set Size (resident)Resident Shared Pages (shared)Text (text)Library (lib)Data + Stack (data)Dirty Pages (dt)DiskRequestsRequestsBytesBytesCharsCharsReadWriteReadWriteReadWriteNetworkBytesBytesPacketsPacketsSentReceivedSentReceivedDockerTypeUnitMetricCPUClock TicksClock TicksQuantityQuantityClock TicksUserSystemPeriodsThrottledThrottled TimeMemoryPagesPagesPagesPagesPagesPagesPagesPagesPagesPagesPagesPagesResident Set Size (rss)ChachedMapped (mapped_file)Paged In (pgpgin)Paged Out (pgpgout)Page Faults (pgfault)Major Page Faults (pgmajfault)Active (active_anon)Inactive (inactive_anon)Active File (active_file)Inactive File (inactive_file)UnevictableDiskBytesBytesBytesBytesBytesBytesReadWriteSyncAsyncDiscardTotalNetworkBytesBytesPacketsPacketsSentReceivedSentReceivedInstallationBefore installing Kubemon, make sure Kubernetes and Docker are properly installed in the system.Download the latest version here:kubemonExtract the zip file and go on the extracted directoryUpdate thenodeNamefield inkubernetes/04_collector.yamlto your the name of your Kubernetes control-plane node.Apply the Kubernetes objects withinkubernetes/:$kubectlapply-fkubernetes/
namespace/kubemoncreated
configmap/kubemon-envcreated
persistentvolume/kubemon-volumecreated
persistentvolumeclaim/kubemon-volume-claimcreated
service/collectorcreated
service/monitorcreated
pod/collectorcreated
daemonset.apps/kubemon-monitorcreatedThe following subsection will detail about how to configure and execute the data collecting process.ConfigurationKubemon has a few variables that can be defined by the user. For instance, some of the required fields to be configured before running the tool isNUM_DAEMONS, which denotes the expected amount ofclientinstances should be connected to thecollectorcomponent. In addition, the Kubemon components are configured through environment variables inside the Kubernetes pods.The configuration file is atkubernetes/01_configmap.yaml. At the current version of Kubemon, the configmap lists all the configurable variables. You can update according to your needs.The collected metrics will be saved in the Kubernetes control-plane node by default, in/mnt/kubemon-data. This setting can be changed in./kubernetes/02_volumes.yamlby updating thehostPathfield.Example:# Before...hostPath:path:"/mnt/kubemon-data"# After...hostPath:path:"/home/user/data"RunningStartingTo start the collecting process, you can either start the CLI or execute commands within Python.Example with the CLI:$makeclihost=10.0.1.2
Waitingforcollectortobealive
Collectorisalive!
>>>starttest000
Starting2daemonsandsavingdataat10.0.1.2:/home/kubemon/output/data/test000Example by using the CLI API within Python:>>>fromkubemon.collectorimportCollectorClient>>>fromkubemon.settingsimportCLI_PORT>>>>>>cc=CollectorClient('10.0.1.2',CLI_PORT)>>>cc.start('test000')Starting2daemonsandsavingdataat10.0.1.2:/home/kubemon/output/data/test000StoppingWithin the CLI:>>>stop
StoppedcollectorUsing the API:...>>>cc.stop()StoppedcollectorAll the CLI commands:You can retrieve all the implemented commands by either typinghelpwithin the CLI prompt or by running.help()method from the API.All the commands:'start': Start collecting metrics from all connected daemons in the collector.

    Args:
        - Directory name to be saving the data collected. Ex.: start test000
    
'instances': Lists all the connected monitor instances.
    
'daemons': Lists all the daemons (hosts) connected.
    
'stop': Stop all monitors if they're running.
    
'help': Lists all the available commands.
    
'alive': Tells if the collector is alive.ReferencesBlock layer statistics/proc virtual file systemEvaluation of desktop operating systems under thrashing conditionscgroupsDocker runtime metrics