Nextcloud Quality Measurement with Munin

Count of open bugs on GitHub over the past 12 months

Munin Plugin

#!/usr/bin/perl
use strict;
use warnings;
use LWP::UserAgent;
use JSON;

# Required Packages (Debian/Ubuntu)
# Install these before running the script:
# apt install libjson-perl libwww-perl

# GitHub API URLs
my %repos = (
    "server"   => "https://api.github.com/search/issues?q=repo:nextcloud/server+is:issue+state:open+label:bug",
    "android"  => "https://api.github.com/search/issues?q=repo:nextcloud/android+is:issue+state:open+label:bug",
    "ios"      => "https://api.github.com/search/issues?q=repo:nextcloud/ios+is:issue+state:open+label:bug",
    "desktop"  => "https://api.github.com/search/issues?q=repo:nextcloud/desktop+is:issue+state:open+label:bug"
);

# Munin config mode
if ($ARGV[0] and $ARGV[0] eq "config") {
    print "graph_title Nextcloud Open Bug Issues\n";
    print "graph_vlabel Bug Count\n";
    print "graph_category GitHub\n";
    print "server.label Nextcloud Server Bugs\n";
    print "android.label Android Client Bugs\n";
    print "ios.label iOS Client Bugs\n";
    print "desktop.label Desktop Client Bugs\n";
    exit 0;
}

# User-Agent setup
my $ua = LWP::UserAgent->new;
$ua->timeout(10);
$ua->env_proxy;

# Function to fetch issue count
sub fetch_bug_count {
    my ($url) = @_;
    my $response = $ua->get($url);

    if ($response->is_success) {
        my $data = decode_json($response->decoded_content);
        return $data->{'total_count'} // "U";  # Return 'U' (unknown) if key is missing
    } else {
        return "U";  # API request failed
    }
}

# Fetch bug counts
my %bug_counts;
foreach my $key (keys %repos) {
    $bug_counts{$key} = fetch_bug_count($repos{$key});
}

# Output data for Munin
print "server.value $bug_counts{server}\n";
print "android.value $bug_counts{android}\n";
print "ios.value $bug_counts{ios}\n";
print "desktop.value $bug_counts{desktop}\n";

You might find it interesting to monitor closed out bug reports too - e.g.

repo:nextcloud/server closed:2025-01-01..2025-12-31 state:closed