bundles/vnstat: introduce, add to home.router
This commit is contained in:
parent
9fa3757a96
commit
88dd587fb4
4 changed files with 108 additions and 0 deletions
61
bundles/vnstat/files/vnstat.conf
Normal file
61
bundles/vnstat/files/vnstat.conf
Normal file
|
@ -0,0 +1,61 @@
|
|||
Interface "${interface}"
|
||||
DatabaseDir "/var/lib/vnstat"
|
||||
Locale "-"
|
||||
MonthRotate 1
|
||||
DayFormat "%Y-%m-%d"
|
||||
MonthFormat "%Y-%m"
|
||||
TopFormat "%Y-%m-%d"
|
||||
RXCharacter "%"
|
||||
TXCharacter ":"
|
||||
RXHourCharacter "r"
|
||||
TXHourCharacter "t"
|
||||
UnitMode 0
|
||||
RateUnitMode 1
|
||||
OutputStyle 3
|
||||
RateUnit 1
|
||||
DefaultDecimals 2
|
||||
HourlyDecimals 1
|
||||
HourlySelectionStyle 2
|
||||
BandwidthDetection 0
|
||||
MaxBandwidth ${bandwidth}
|
||||
SampleTime 5
|
||||
QueryMode 2
|
||||
CheckDiskSpace 1
|
||||
UseFileLocking 1
|
||||
BootVariation 5
|
||||
TrafficlessDays 1
|
||||
|
||||
# vnstatd
|
||||
DaemonUser ""
|
||||
DaemonGroup ""
|
||||
TimeSyncWait 5
|
||||
UpdateInterval 10
|
||||
PollInterval 5
|
||||
SaveInterval 5
|
||||
OfflineSaveInterval 15
|
||||
BandwidthDetectionInterval 30
|
||||
SaveOnStatusChange 1
|
||||
UseLogging 2
|
||||
CreateDirs 1
|
||||
UpdateFileOwner 1
|
||||
PidFile "/var/run/vnstat/vnstat.pid"
|
||||
|
||||
# vnstati
|
||||
HeaderFormat "%Y-%m-%d %H:%M"
|
||||
HourlyRate 1
|
||||
SummaryRate 1
|
||||
SummaryLayout 1
|
||||
TransparentBg 0
|
||||
CBackground "FFFFFF"
|
||||
CEdge "AEAEAE"
|
||||
CHeader "606060"
|
||||
CHeaderTitle "FFFFFF"
|
||||
CHeaderDate "FFFFFF"
|
||||
CText "000000"
|
||||
CLine "B0B0B0"
|
||||
CLineL "-"
|
||||
CRx "92CF00"
|
||||
CTx "606060"
|
||||
CRxD "-"
|
||||
CTxD "-"
|
||||
|
18
bundles/vnstat/items.py
Normal file
18
bundles/vnstat/items.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
files = {
|
||||
'/etc/vnstat.conf': {
|
||||
'content_type': 'mako',
|
||||
'context': node.metadata['vnstat'],
|
||||
'triggers': {
|
||||
'svc_systemd:vnstat:restart',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
svc_systemd = {
|
||||
'vnstat': {
|
||||
'needs': {
|
||||
'pkg_apt:vnstat',
|
||||
'file:/etc/vnstat.conf',
|
||||
},
|
||||
},
|
||||
}
|
25
bundles/vnstat/metadata.py
Normal file
25
bundles/vnstat/metadata.py
Normal file
|
@ -0,0 +1,25 @@
|
|||
defaults = {
|
||||
'apt': {
|
||||
'packages': {
|
||||
'vnstat': {},
|
||||
'vnstati': {},
|
||||
},
|
||||
},
|
||||
'vnstat': {
|
||||
'bandwidth': '1000',
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@metadata_reactor
|
||||
def get_default_interface(metadata):
|
||||
interfaces = sorted(metadata.get('interfaces', {}).keys())
|
||||
|
||||
if len(interfaces):
|
||||
return {
|
||||
'vnstat': {
|
||||
'interface': interfaces[0],
|
||||
},
|
||||
}
|
||||
|
||||
return {}
|
|
@ -8,6 +8,7 @@ nodes['home.router'] = {
|
|||
'pppd',
|
||||
'radvd',
|
||||
'dhcpd',
|
||||
'vnstat',
|
||||
'wide-dhcp6c',
|
||||
},
|
||||
'groups': set(),
|
||||
|
@ -105,6 +106,9 @@ nodes['home.router'] = {
|
|||
},
|
||||
},
|
||||
},
|
||||
'vnstat': {
|
||||
'interface': 'enp1s0.100',
|
||||
},
|
||||
'vm': {
|
||||
'cpu': 2,
|
||||
'ram': 2,
|
||||
|
|
Loading…
Reference in a new issue