Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Kea
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
415
Issues
415
List
Boards
Labels
Service Desk
Milestones
Merge Requests
65
Merge Requests
65
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
ISC Open Source Projects
Kea
Commits
1bb96c51
Commit
1bb96c51
authored
Aug 09, 2012
by
Jelte Jansen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[2172] use 3-tuple instead of fixed-size list for loadavg
parent
3fc727f1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
5 deletions
+4
-5
src/bin/sysinfo/sysinfo.py.in
src/bin/sysinfo/sysinfo.py.in
+1
-2
src/lib/python/isc/sysinfo/sysinfo.py
src/lib/python/isc/sysinfo/sysinfo.py
+3
-3
No files found.
src/bin/sysinfo/sysinfo.py.in
View file @
1bb96c51
...
@@ -90,8 +90,7 @@ def main():
...
@@ -90,8 +90,7 @@ def main():
write_value(f, ' + Hostname: %s\n', s.get_platform_hostname)
write_value(f, ' + Hostname: %s\n', s.get_platform_hostname)
write_value(f, ' + Uptime: %d seconds\n', s.get_uptime)
write_value(f, ' + Uptime: %d seconds\n', s.get_uptime)
l = s.get_loadavg()
write_value(f, ' + Loadavg: %f %f %f\n', s.get_loadavg)
f.write(' + Loadavg: %f %f %f\n' % (l[0], l[1], l[2]))
f.write('\nMemory\n');
f.write('\nMemory\n');
write_value(f, ' + Total: %d bytes\n', s.get_mem_total)
write_value(f, ' + Total: %d bytes\n', s.get_mem_total)
...
...
src/lib/python/isc/sysinfo/sysinfo.py
View file @
1bb96c51
...
@@ -164,7 +164,7 @@ class SysInfoLinux(SysInfoPOSIX):
...
@@ -164,7 +164,7 @@ class SysInfoLinux(SysInfoPOSIX):
with
open
(
'/proc/loadavg'
)
as
f
:
with
open
(
'/proc/loadavg'
)
as
f
:
l
=
f
.
read
().
strip
().
split
(
' '
)
l
=
f
.
read
().
strip
().
split
(
' '
)
if
len
(
l
)
>=
3
:
if
len
(
l
)
>=
3
:
self
.
_loadavg
=
[
float
(
l
[
0
]),
float
(
l
[
1
]),
float
(
l
[
2
])]
self
.
_loadavg
=
(
float
(
l
[
0
]),
float
(
l
[
1
]),
float
(
l
[
2
]))
with
open
(
'/proc/meminfo'
)
as
f
:
with
open
(
'/proc/meminfo'
)
as
f
:
m
=
f
.
readlines
()
m
=
f
.
readlines
()
...
@@ -315,7 +315,7 @@ class SysInfoOpenBSD(SysInfoBSD):
...
@@ -315,7 +315,7 @@ class SysInfoOpenBSD(SysInfoBSD):
s
=
subprocess
.
check_output
([
'sysctl'
,
'-n'
,
'vm.loadavg'
])
s
=
subprocess
.
check_output
([
'sysctl'
,
'-n'
,
'vm.loadavg'
])
l
=
s
.
decode
(
'utf-8'
).
strip
().
split
(
' '
)
l
=
s
.
decode
(
'utf-8'
).
strip
().
split
(
' '
)
if
len
(
l
)
>=
3
:
if
len
(
l
)
>=
3
:
self
.
_loadavg
=
[
float
(
l
[
0
]),
float
(
l
[
1
]),
float
(
l
[
2
])]
self
.
_loadavg
=
(
float
(
l
[
0
]),
float
(
l
[
1
]),
float
(
l
[
2
]))
except
(
subprocess
.
CalledProcessError
,
OSError
):
except
(
subprocess
.
CalledProcessError
,
OSError
):
pass
pass
...
@@ -370,7 +370,7 @@ class SysInfoFreeBSDOSX(SysInfoBSD):
...
@@ -370,7 +370,7 @@ class SysInfoFreeBSDOSX(SysInfoBSD):
else
:
else
:
la
=
l
.
split
(
' '
)
la
=
l
.
split
(
' '
)
if
len
(
la
)
>=
3
:
if
len
(
la
)
>=
3
:
self
.
_loadavg
=
[
float
(
la
[
0
]),
float
(
la
[
1
]),
float
(
la
[
2
])]
self
.
_loadavg
=
(
float
(
la
[
0
]),
float
(
la
[
1
]),
float
(
la
[
2
]))
except
(
subprocess
.
CalledProcessError
,
OSError
):
except
(
subprocess
.
CalledProcessError
,
OSError
):
pass
pass
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment