Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 94 additions & 6 deletions graph_explorer/structured_metrics/plugins/collectd.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def __init__(self, config):

self.targets = [
{
'match': prefix + '(?P<server>[^\.]+)\.(?P<collectd_plugin>cpu)\.(?P<core>[^\.]+)\.cpu\.(?P<type>[^\.]+)$',
'match': prefix + '(?P<server>[^\.]+)\.(?P<collectd_plugin>cpu)[\-\.](?P<core>[^\.]+)\.cpu[\-\.](?P<type>[^\.]+)$',
'target_type': 'gauge_pct',
'tags': {
'unit': 'Jiff',
Expand All @@ -23,28 +23,116 @@ def __init__(self, config):
'configure': lambda self, target: self.fix_load(target)
},
{
'match': prefix + '(?P<server>[^\.]+)\.interface\.(?P<device>[^\.]+)\.if_(?P<wt>[^\.]+)\.(?P<dir>[^\.]+)$',
'match': prefix + '(?P<server>[^\.]+)\.interface[\-\.](?P<device>[^\.]+)\.if_(?P<wt>[^\.]+)\.(?P<dir>[^\.]+)$',
'target_type': 'counter',
'tags': {'collectd_plugin': 'network'},
'configure': lambda self, target: self.fix_network(target)
},
{
'match': prefix + '(?P<server>[^\.]+)\.memory\.memory\.(?P<type>[^\.]+)$',
'match': prefix + '(?P<server>[^\.]+)\.memory\.memory[\-\.](?P<type>[^\.]+)$',
'target_type': 'gauge',
'tags': {
'unit': 'B',
'where': 'system_memory'
}
},
{
'match': prefix + '(?P<server>[^\.]+)\.df\.(?P<mountpoint>[^\.]+)\.df_complex\.(?P<type>[^\.]+)$',
'match': prefix + '(?P<server>[^\.]+)\.df[\-\.](?P<mountpoint>[^\.]+)\.df_complex[\-\.](?P<type>[^\.]+)$',
'target_type': 'gauge',
'tags': {'unit': 'B'}
},
{
'match': prefix + '(?P<server>[^\.]+)\.(?P<collectd_plugin>disk)\.(?P<device>[^\.]+)\.disk_(?P<wt>[^\.]+)\.(?P<operation>[^\.]+)$',
'match': prefix + '(?P<server>[^\.]+)\.(?P<collectd_plugin>disk)[\-\.](?P<device>[^\.]+)\.disk_(?P<wt>[^\.]+)\.(?P<operation>[^\.]+)$',
'configure': lambda self, target: self.fix_disk(target)
}
},
{
'match': prefix + '(?P<server>.+?)\.(?P<collectd_plugin>irq)\.irq[\-\.](?P<wt>.*)$',
'target_type': 'counter',
'tags': {
'unit': 'calls',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should introduce a new unit for this, like Irq

'what': 'irq_calls'
}

},
{
'match': prefix + '(?P<server>.+?)\.(?P<collectd_plugin>processes)\.ps_state[\-\.](?P<state>.*)$',
'target_type': 'gauge',
'tags': {
'unit': 'procs',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be Process (see http://metrics20.org/spec/)

'what': 'procs_in_state'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can be left out entirely (doesn't bring any new info that's not in unit tag or state tag)

}

},
{
'match': prefix + '(?P<server>.+?)\.(?P<collectd_plugin>processes)\.(?P<value>fork_rate)$',
'target_type': 'counter',
'tags': {
'unit': 'procs',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Process

'what': 'fork_rate'
}

},
{
'match': prefix + '(?P<server>[^\.]+)\.swap\.swap[\-\.](?P<type>[^\.]+)$',
'target_type': 'gauge',
'tags': {
'unit': 'B',
'where': 'swap'
}
},
{
'match': prefix + '(?P<server>[^\.]+)\.swap\.swap_io[\-\.](?P<dir>[^\.]+)$',
'target_type': 'counter',
'tags': {
'unit': 'B',
'where': 'swap_io'
}
},
{
'match': prefix + '(?P<server>.+?)\.(?P<collectd_plugin>tcpconns)[\-\.](?P<port>\d+)[\-\.]local\.tcp_connections[\-\.](?P<state>.*)$',
'target_type': 'gauge',
'tags': {
'unit': 'connections',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'what': 'tcp_connections_in_state'
}

},
{
'match': prefix + '(?P<server>.+?)\.(?P<collectd_plugin>contextswitch)\.(?P<value>contextswitch)$',
'target_type': 'counter',
'tags': {
'unit': 'fork/s',
'what': 'contextswitch'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

forks/s and contextswitches are different things? you can do context switches without doing any forks.
if this metric describes contextswitches than i would use unit=Contextswitch, and no what tag needed

}

},
{
'match': prefix + '(?P<server>.+?)\.(?P<collectd_plugin>users)\.(?P<value>users)$',
'target_type': 'gauge',
'tags': {
'unit': 'users',
'what': 'users_logged'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can use unit=User for this (and add it to the spec)
what does logged mean in this context though? is this from a log of user login sessions or something?

}

},
{
'match': prefix + '(?P<server>.+?)\.(?P<collectd_plugin>entropy)\.(?P<value>entropy)$',
'target_type': 'gauge',
'tags': {
'unit': 'bits',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unit=b

'what': 'entropy'
}

},
{
'match': prefix + '(?P<server>.+?)\.(?P<collectd_plugin>conntrack)\.(?P<value>conntrack)$',
'target_type': 'gauge',
'tags': {
'unit': 'entries',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be unit=Conn, cause we track connections right? and this metric denotes how many connections are in the conntrack table?

'what': 'conntrack'
}

},
]
super(CollectdPlugin, self).__init__(config)

Expand Down