Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pve-manager
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
pve-manager
Commits
d100ceaa
Commit
d100ceaa
authored
Mar 26, 2012
by
Dietmar Maurer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add subscription status to datacenter summary
parent
670b1cb9
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
79 additions
and
28 deletions
+79
-28
Cluster.pm
PVE/API2/Cluster.pm
+15
-23
Subscription.pm
PVE/API2/Subscription.pm
+7
-2
API2Tools.pm
PVE/API2Tools.pm
+26
-0
pvestatd
bin/pvestatd
+5
-1
changelog.Debian
debian/changelog.Debian
+6
-0
defines.mk
defines.mk
+1
-1
Utils.js
www/manager/Utils.js
+11
-0
Summary.js
www/manager/dc/Summary.js
+8
-1
No files found.
PVE/API2/Cluster.pm
View file @
d100ceaa
...
@@ -206,26 +206,7 @@ __PACKAGE__->register_method({
...
@@ -206,26 +206,7 @@ __PACKAGE__->register_method({
if
(
!
$param
->
{
type
}
||
$param
->
{
type
}
eq
'
node
')
{
if
(
!
$param
->
{
type
}
||
$param
->
{
type
}
eq
'
node
')
{
foreach
my
$node
(
@$nodelist
)
{
foreach
my
$node
(
@$nodelist
)
{
my
$entry
=
{
my
$entry
=
PVE::API2Tools::
extract_node_stats
(
$node
,
$members
,
$rrd
);
id
=>
"
node/
$node
",
node
=>
$node
,
type
=>
"
node
",
};
if
(
my
$d
=
$rrd
->
{"
pve2-node/
$node
"})
{
if
(
!
$members
||
# no cluster
(
$members
->
{
$node
}
&&
$members
->
{
$node
}
->
{
online
}))
{
$entry
->
{
uptime
}
=
(
$d
->
[
0
]
||
0
)
+
0
;
$entry
->
{
cpu
}
=
(
$d
->
[
4
]
||
0
)
+
0
;
$entry
->
{
mem
}
=
(
$d
->
[
7
]
||
0
)
+
0
;
$entry
->
{
disk
}
=
(
$d
->
[
11
]
||
0
)
+
0
;
}
$entry
->
{
maxcpu
}
=
(
$d
->
[
3
]
||
0
)
+
0
;
$entry
->
{
maxmem
}
=
(
$d
->
[
6
]
||
0
)
+
0
;
$entry
->
{
maxdisk
}
=
(
$d
->
[
10
]
||
0
)
+
0
;
}
push
@$res
,
$entry
;
push
@$res
,
$entry
;
}
}
}
}
...
@@ -357,7 +338,7 @@ __PACKAGE__->register_method({
...
@@ -357,7 +338,7 @@ __PACKAGE__->register_method({
}});
}});
my
$parse_clustat
=
sub
{
my
$parse_clustat
=
sub
{
my
(
$clinfo
,
$members
,
$nodename
,
$raw
)
=
@_
;
my
(
$clinfo
,
$members
,
$
rrd
,
$
nodename
,
$raw
)
=
@_
;
my
$createNode
=
sub
{
my
$createNode
=
sub
{
my
(
$expat
,
$tag
,
%
attrib
)
=
@_
;
my
(
$expat
,
$tag
,
%
attrib
)
=
@_
;
...
@@ -390,6 +371,11 @@ my $parse_clustat = sub {
...
@@ -390,6 +371,11 @@ my $parse_clustat = sub {
$node
->
{
ip
}
=
$ip
;
$node
->
{
ip
}
=
$ip
;
}
}
}
}
if
(
my
$entry
=
PVE::API2Tools::
extract_node_stats
(
$name
,
$members
,
$rrd
))
{
$node
->
{
level
}
=
$entry
->
{
level
}
||
'';
}
}
elsif
(
$tag
eq
'
group
')
{
}
elsif
(
$tag
eq
'
group
')
{
my
$name
=
$node
->
{
name
};
my
$name
=
$node
->
{
name
};
return
if
!
$name
;
# just to be sure
return
if
!
$name
;
# just to be sure
...
@@ -467,15 +453,20 @@ __PACKAGE__->register_method({
...
@@ -467,15 +453,20 @@ __PACKAGE__->register_method({
my
$clinfo
=
PVE::Cluster::
get_clinfo
();
my
$clinfo
=
PVE::Cluster::
get_clinfo
();
my
$members
=
PVE::Cluster::
get_members
();
my
$members
=
PVE::Cluster::
get_members
();
my
$nodename
=
PVE::INotify::
nodename
();
my
$nodename
=
PVE::INotify::
nodename
();
my
$rrd
=
PVE::Cluster::
rrd_dump
();
if
(
$members
)
{
if
(
$members
)
{
my
$cmd
=
['
clustat
',
'
-x
'];
my
$cmd
=
['
clustat
',
'
-x
'];
my
$out
=
'';
my
$out
=
'';
PVE::Tools::
run_command
(
$cmd
,
outfunc
=>
sub
{
$out
.=
shift
;
});
PVE::Tools::
run_command
(
$cmd
,
outfunc
=>
sub
{
$out
.=
shift
;
});
return
&
$parse_clustat
(
$clinfo
,
$members
,
$nodename
,
$out
);
return
&
$parse_clustat
(
$clinfo
,
$members
,
$
rrd
,
$
nodename
,
$out
);
}
else
{
}
else
{
# fake entry for local node if no cluster defined
# fake entry for local node if no cluster defined
my
$pmxcfs
=
(
$clinfo
&&
$clinfo
->
{
version
})
?
1
:
0
;
# pmxcfs online ?
my
$pmxcfs
=
(
$clinfo
&&
$clinfo
->
{
version
})
?
1
:
0
;
# pmxcfs online ?
my
$subinfo
=
PVE::INotify::
read_file
('
subscription
');
my
$sublevel
=
$subinfo
->
{
level
}
||
'';
return
[{
return
[{
type
=>
'
node
',
type
=>
'
node
',
id
=>
"
node/
$nodename
",
id
=>
"
node/
$nodename
",
...
@@ -483,7 +474,8 @@ __PACKAGE__->register_method({
...
@@ -483,7 +474,8 @@ __PACKAGE__->register_method({
'
local
'
=>
1
,
'
local
'
=>
1
,
nodeid
=>
0
,
nodeid
=>
0
,
pmxcfs
=>
$pmxcfs
,
pmxcfs
=>
$pmxcfs
,
state
=>
1
state
=>
1
,
level
=>
$sublevel
,
}];
}];
}
}
}});
}});
...
...
PVE/API2/Subscription.pm
View file @
d100ceaa
...
@@ -57,7 +57,7 @@ sub parse_key {
...
@@ -57,7 +57,7 @@ sub parse_key {
my
(
$key
)
=
@_
;
my
(
$key
)
=
@_
;
if
(
$key
=~
m/^pve([124])([cbsp])-[0-9a-f]{10}$/
)
{
if
(
$key
=~
m/^pve([124])([cbsp])-[0-9a-f]{10}$/
)
{
return
wantarray
?
(
$1
,
$2
)
:
$1
;
# number of sockets,
type
return
wantarray
?
(
$1
,
$2
)
:
$1
;
# number of sockets,
level
}
}
return
undef
;
return
undef
;
}
}
...
@@ -110,7 +110,8 @@ sub read_etc_pve_subscription {
...
@@ -110,7 +110,8 @@ sub read_etc_pve_subscription {
my
$key
=
<
$fh
>
;
# first line is the key
my
$key
=
<
$fh
>
;
# first line is the key
chomp
$key
;
chomp
$key
;
die
"
Wrong subscription key format
\n
"
if
!
parse_key
(
$key
);
my
(
$sockets
,
$level
)
=
parse_key
(
$key
);
die
"
Wrong subscription key format
\n
"
if
!
$sockets
;
my
$csum
=
<
$fh
>
;
# second line is a checksum
my
$csum
=
<
$fh
>
;
# second line is a checksum
...
@@ -153,6 +154,10 @@ sub read_etc_pve_subscription {
...
@@ -153,6 +154,10 @@ sub read_etc_pve_subscription {
}
}
}
}
if
(
$info
->
{
status
}
eq
'
Active
')
{
$info
->
{
level
}
=
$level
;
}
return
$info
;
return
$info
;
}
}
...
...
PVE/API2Tools.pm
View file @
d100ceaa
...
@@ -3,6 +3,32 @@ package PVE::API2Tools;
...
@@ -3,6 +3,32 @@ package PVE::API2Tools;
use
strict
;
use
strict
;
use
warnings
;
use
warnings
;
sub
extract_node_stats
{
my
(
$node
,
$members
,
$rrd
)
=
@_
;
my
$entry
=
{
id
=>
"
node/
$node
",
node
=>
$node
,
type
=>
"
node
",
};
if
(
my
$d
=
$rrd
->
{"
pve2-node/
$node
"})
{
if
(
!
$members
||
# no cluster
(
$members
->
{
$node
}
&&
$members
->
{
$node
}
->
{
online
}))
{
$entry
->
{
uptime
}
=
(
$d
->
[
0
]
||
0
)
+
0
;
$entry
->
{
cpu
}
=
(
$d
->
[
5
]
||
0
)
+
0
;
$entry
->
{
mem
}
=
(
$d
->
[
8
]
||
0
)
+
0
;
$entry
->
{
disk
}
=
(
$d
->
[
12
]
||
0
)
+
0
;
}
$entry
->
{
level
}
=
$d
->
[
1
];
$entry
->
{
maxcpu
}
=
(
$d
->
[
4
]
||
0
)
+
0
;
$entry
->
{
maxmem
}
=
(
$d
->
[
7
]
||
0
)
+
0
;
$entry
->
{
maxdisk
}
=
(
$d
->
[
11
]
||
0
)
+
0
;
}
return
$entry
;
}
sub
extract_vm_stats
{
sub
extract_vm_stats
{
my
(
$vmid
,
$data
,
$rrd
)
=
@_
;
my
(
$vmid
,
$data
,
$rrd
)
=
@_
;
...
...
bin/pvestatd
View file @
d100ceaa
...
@@ -15,6 +15,7 @@ use PVE::Storage;
...
@@ -15,6 +15,7 @@ use PVE::Storage;
use
PVE::
QemuServer
;
use
PVE::
QemuServer
;
use
PVE::
OpenVZ
;
use
PVE::
OpenVZ
;
use
PVE::
RPCEnvironment
;
use
PVE::
RPCEnvironment
;
use
PVE::API2::
Subscription
;
$SIG
{'
__WARN__
'}
=
sub
{
$SIG
{'
__WARN__
'}
=
sub
{
my
$err
=
$@
;
my
$err
=
$@
;
...
@@ -144,6 +145,9 @@ sub update_node_status {
...
@@ -144,6 +145,9 @@ sub update_node_status {
my
$maxcpu
=
$cpuinfo
->
{
cpus
};
my
$maxcpu
=
$cpuinfo
->
{
cpus
};
my
$subinfo
=
PVE::INotify::
read_file
('
subscription
');
my
$sublevel
=
$subinfo
->
{
level
}
||
'';
# traffic from/to physical interface cards
# traffic from/to physical interface cards
my
$netin
=
0
;
my
$netin
=
0
;
my
$netout
=
0
;
my
$netout
=
0
;
...
@@ -162,7 +166,7 @@ sub update_node_status {
...
@@ -162,7 +166,7 @@ sub update_node_status {
# everything not free is considered to be used
# everything not free is considered to be used
my
$dused
=
$dinfo
->
{
blocks
}
-
$dinfo
->
{
bfree
};
my
$dused
=
$dinfo
->
{
blocks
}
-
$dinfo
->
{
bfree
};
my
$data
=
"
$uptime
:
$ctime
:
$avg1
:
$maxcpu
:
$stat
->{cpu}:
$stat
->{wait}:
"
.
my
$data
=
"
$uptime
:
$
sublevel
:
$
ctime
:
$avg1
:
$maxcpu
:
$stat
->{cpu}:
$stat
->{wait}:
"
.
"
$meminfo
->{memtotal}:
$meminfo
->{memused}:
"
.
"
$meminfo
->{memtotal}:
$meminfo
->{memused}:
"
.
"
$meminfo
->{swaptotal}:
$meminfo
->{swapused}:
"
.
"
$meminfo
->{swaptotal}:
$meminfo
->{swapused}:
"
.
"
$dinfo
->{blocks}:
$dused
:
$netin
:
$netout
";
"
$dinfo
->{blocks}:
$dused
:
$netin
:
$netout
";
...
...
debian/changelog.Debian
View file @
d100ceaa
pve-manager (2.0-46) unstable; urgency=low
* code cleanups
-- Proxmox Support Team <support@proxmox.com> Mon, 26 Mar 2012 10:38:33 +0200
pve-manager (2.0-45) unstable; urgency=low
pve-manager (2.0-45) unstable; urgency=low
* fix bug 124: correctly return maxfiles flag
* fix bug 124: correctly return maxfiles flag
...
...
defines.mk
View file @
d100ceaa
...
@@ -2,7 +2,7 @@ RELEASE=2.0
...
@@ -2,7 +2,7 @@ RELEASE=2.0
VERSION=2.0
VERSION=2.0
PACKAGE=pve-manager
PACKAGE=pve-manager
PACKAGERELEASE=4
5
PACKAGERELEASE=4
6
BINDIR=${DESTDIR}/usr/bin
BINDIR=${DESTDIR}/usr/bin
PERLLIBDIR=${DESTDIR}/usr/share/perl5
PERLLIBDIR=${DESTDIR}/usr/share/perl5
...
...
www/manager/Utils.js
View file @
d100ceaa
...
@@ -100,6 +100,13 @@ Ext.define('PVE.Utils', { statics: {
...
@@ -100,6 +100,13 @@ Ext.define('PVE.Utils', { statics: {
7
:
"
debug
"
7
:
"
debug
"
},
},
support_level_hash
:
{
'
c
'
:
gettext
(
'
Community
'
),
'
b
'
:
gettext
(
'
Basic
'
),
'
s
'
:
gettext
(
'
Standard
'
),
'
p
'
:
gettext
(
'
Premium
'
)
},
kvm_ostypes
:
{
kvm_ostypes
:
{
other
:
gettext
(
'
Other OS types
'
),
other
:
gettext
(
'
Other OS types
'
),
wxp
:
'
Microsoft Windows XP/2003
'
,
wxp
:
'
Microsoft Windows XP/2003
'
,
...
@@ -723,6 +730,10 @@ Ext.define('PVE.Utils', { statics: {
...
@@ -723,6 +730,10 @@ Ext.define('PVE.Utils', { statics: {
return
PVE
.
Utils
.
format_duration_long
(
uptime
);
return
PVE
.
Utils
.
format_duration_long
(
uptime
);
},
},
render_support_level
:
function
(
value
,
metaData
,
record
)
{
return
PVE
.
Utils
.
support_level_hash
[
value
]
||
'
-
'
;
},
render_upid
:
function
(
value
,
metaData
,
record
)
{
render_upid
:
function
(
value
,
metaData
,
record
)
{
var
type
=
record
.
data
.
type
;
var
type
=
record
.
data
.
type
;
var
id
=
record
.
data
.
id
;
var
id
=
record
.
data
.
id
;
...
...
www/manager/dc/Summary.js
View file @
d100ceaa
...
@@ -45,6 +45,13 @@ Ext.define('PVE.dc.NodeView', {
...
@@ -45,6 +45,13 @@ Ext.define('PVE.dc.NodeView', {
dataIndex
:
'
state
'
,
dataIndex
:
'
state
'
,
renderer
:
PVE
.
Utils
.
format_boolean
renderer
:
PVE
.
Utils
.
format_boolean
},
},
{
header
:
gettext
(
'
Support
'
),
width
:
100
,
sortable
:
true
,
dataIndex
:
'
level
'
,
renderer
:
PVE
.
Utils
.
render_support_level
},
{
{
header
:
gettext
(
'
Estranged
'
),
header
:
gettext
(
'
Estranged
'
),
width
:
100
,
width
:
100
,
...
@@ -94,7 +101,7 @@ Ext.define('PVE.dc.NodeView', {
...
@@ -94,7 +101,7 @@ Ext.define('PVE.dc.NodeView', {
Ext
.
define
(
'
pve-dc-nodes
'
,
{
Ext
.
define
(
'
pve-dc-nodes
'
,
{
extend
:
'
Ext.data.Model
'
,
extend
:
'
Ext.data.Model
'
,
fields
:
[
'
id
'
,
'
type
'
,
'
name
'
,
'
state
'
,
'
nodeid
'
,
'
ip
'
,
fields
:
[
'
id
'
,
'
type
'
,
'
name
'
,
'
state
'
,
'
nodeid
'
,
'
ip
'
,
'
pmxcfs
'
,
'
rgmanager
'
,
'
estranged
'
],
'
pmxcfs
'
,
'
rgmanager
'
,
'
estranged
'
,
'
level
'
],
idProperty
:
'
id
'
idProperty
:
'
id
'
});
});
...
...
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