]> git.proxmox.com Git - pve-manager.git/commitdiff
add ceph log view
authorDietmar Maurer <dietmar@proxmox.com>
Fri, 15 Nov 2013 07:02:35 +0000 (08:02 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 15 Nov 2013 07:02:35 +0000 (08:02 +0100)
PVE/API2/Ceph.pm
www/manager/node/Ceph.js

index a649a822be2156600aa96d7856cfcb6229cef4d1..17e77f24b4514433bf51bf1150a49ad236ae9943 100644 (file)
@@ -266,6 +266,7 @@ __PACKAGE__->register_method ({
            { name => 'status' },
            { name => 'crush' },
            { name => 'config' },
+           { name => 'log' },
        ];
 
        return $result;
@@ -834,4 +835,61 @@ __PACKAGE__->register_method ({
        return $txt;
     }});
 
+__PACKAGE__->register_method({
+    name => 'log', 
+    path => 'log', 
+    method => 'GET',
+    description => "Read ceph log",
+    proxyto => 'node',
+    permissions => {
+       check => ['perm', '/nodes/{node}', [ 'Sys.Syslog' ]],
+    },
+    protected => 1,
+    parameters => {
+       additionalProperties => 0,
+       properties => {
+           node => get_standard_option('pve-node'),
+           start => {
+               type => 'integer',
+               minimum => 0,
+               optional => 1,
+           },
+           limit => {
+               type => 'integer',
+               minimum => 0,
+               optional => 1,
+           },
+       },
+    },
+    returns => {
+       type => 'array',
+       items => { 
+           type => "object",
+           properties => {
+               n => {
+                 description=>  "Line number",
+                 type=> 'integer',
+               },
+               t => {
+                 description=>  "Line text",
+                 type => 'string',
+               }
+           }
+       }
+    },
+    code => sub {
+       my ($param) = @_;
+
+       my $rpcenv = PVE::RPCEnvironment::get();
+       my $user = $rpcenv->get_user();
+       my $node = $param->{node};
+
+       my $logfile = "/var/log/ceph/ceph.log";
+       my ($count, $lines) = PVE::Tools::dump_logfile($logfile, $param->{start}, $param->{limit});
+
+       $rpcenv->set_result_attrib('total', $count);
+           
+       return $lines; 
+    }});
+
 
index bcc27217a830105dc36e7ec8917e0370613ba3c0..0180c75d5c19fe3df979e95b9b37eacb91504393 100644 (file)
@@ -463,6 +463,12 @@ Ext.define('PVE.node.Ceph', {
                    title: 'Crush',
                    xtype: 'pveNodeCephCrushMap',
                    itemId: 'crushmap'
+               },
+               {
+                   title: 'Log',
+                   itemId: 'log',
+                   xtype: 'pveLogView',
+                   url: "/api2/extjs/nodes/" + nodename + "/ceph/log"
                }
            ],
            listeners: {