Track and measure security program effectiveness with comprehensive metrics and KPIs.
Monitor security performance, measure control effectiveness, and track security program health.
- Security KPIs: Track key security performance indicators
- Metrics Collection: Collect and aggregate security metrics
- Health Monitoring: Monitor overall security health status
- Report Generation: Generate executive and technical reports
- Compliance Tracking: Track compliance scores and status
- Trend Analysis: Monitor security metrics trends over time
git clone https://github.com/hallucinaut/secmetrics.git
cd secmetrics
go build -o secmetrics ./cmd/secmetrics
sudo mv secmetrics /usr/local/bin/go install github.com/hallucinaut/secmetrics/cmd/secmetrics@latest# Collect security metrics
secmetrics collect# Display security KPIs
secmetrics kpis# Generate executive report
secmetrics report executive
# Generate technical report
secmetrics report technical
# Generate markdown report
secmetrics report markdown# Show metrics summary
secmetrics summary# Check security health status
secmetrics healthpackage main
import (
"fmt"
"github.com/hallucinaut/secmetrics/pkg/metrics"
"github.com/hallucinaut/secmetrics/pkg/reporting"
)
func main() {
// Create metrics collector
collector := metrics.NewMetricsCollector()
// Add common KPIs
commonKPIS := metrics.GetCommonKPIs()
for _, kpi := range commonKPIS {
collector.AddKPI(kpi)
}
// Get KPIs
kpis := collector.GetKPIS()
fmt.Printf("KPIs: %d\n", len(kpis))
// Get compliance score
complianceScore := collector.GetComplianceScore()
fmt.Printf("Compliance Score: %.1f%%\n", complianceScore)
// Get risk score
riskScore := collector.GetRiskScore()
fmt.Printf("Risk Score: %.1f\n", riskScore)
// Generate report
generator := reporting.NewReportGenerator()
report := generator.GenerateReport("Security Report", "Metrics report", reporting.FormatMarkdown)
// Set executive summary
report.Executive = reporting.ExecutiveSummary{
OverallHealth: "HEALTHY",
ComplianceScore: complianceScore,
RiskScore: riskScore,
}
fmt.Println(reporting.GenerateExecutiveReport(report))
}| KPI | Description | Target | Status |
|---|---|---|---|
| MTTR | Mean Time to Respond | 1.0 hours | Monitoring |
| MTTC | Mean Time to Contain | 2.0 hours | Monitoring |
| MTTD | Mean Time to Detect | 0.25 hours | Monitoring |
| KPI | Description | Target | Status |
|---|---|---|---|
| Coverage | Security Coverage | 100% | Monitoring |
| Patching | Security Patches Applied | 100% | Monitoring |
| KPI | Description | Target | Status |
|---|---|---|---|
| Compliance | Compliance Score | 100% | Monitoring |
| KPI | Description | Target | Status |
|---|---|---|---|
| Remediation | Vulnerability Remediation Rate | 95% | Monitoring |
Average time to respond to security incidents.
responseTimes := []float64{2.0, 3.0, 1.5, 2.5}
mttr := metrics.CalculateMTTR(responseTimes)
fmt.Printf("MTTR: %.1f hours\n", mttr)Average time to detect security incidents.
detectionTimes := []float64{0.5, 0.3, 0.4, 0.6}
mttd := metrics.CalculateMTTD(detectionTimes)
fmt.Printf("MTTD: %.1f hours\n", mttd)Average time to contain security incidents.
containmentTimes := []float64{3.0, 4.0, 2.5, 3.5}
mttc := metrics.CalculateMTTC(containmentTimes)
fmt.Printf("MTTC: %.1f hours\n", mttc)Percentage of assets with security controls.
covered := 85
total := 100
coverage := metrics.CalculateCoverage(covered, total)
fmt.Printf("Coverage: %.1f%%\n", coverage)Percentage of vulnerabilities remediated within SLA.
remediated := 95
total := 100
rate := metrics.CalculateRemediationRate(remediated, total)
fmt.Printf("Remediation Rate: %.1f%%\n", rate)High-level summary for leadership and board members.
- Overall security health
- Top concerns and achievements
- Strategic recommendations
- Key metrics and trends
Detailed metrics and technical analysis.
- Security metrics details
- KPI performance analysis
- Technical recommendations
- Trend analysis
Formatted report in Markdown format.
- Clean formatting
- Tables and charts
- Easy to share
- Version control friendly
| Health | Compliance | Risk | Action |
|---|---|---|---|
| HEALTHY | β₯90% | β€30% | Maintain posture |
| GOOD | β₯70% | β€50% | Address concerns |
| FAIR | β₯50% | β€70% | Improve security |
| POOR | <50% | >70% | Immediate action |
# Run all tests
go test ./...
# Run with coverage
go test -cover ./...
# Run specific test
go test -v ./pkg/metrics -run TestCalculateMTTR$ secmetrics kpis
Security KPIs
=============
Key Performance Indicators:
[1] Mean Time to Respond (MTTR)
Value: 2.5 hours
Target: 1.0 hours
Status: BELOW_TARGET
Trend: IMPROVING
Category: Response
[2] Security Coverage
Value: 85.0%
Target: 100.0%
Status: BELOW_TARGET
Trend: IMPROVING
Category: Prevention
[3] Compliance Score
Value: 92.0%
Target: 100.0%
Status: BELOW_TARGET
Trend: STABLE
Category: Compliance
Summary:
Compliance Score: 92.0%
Risk Score: 45.5
Overall Health: GOOD
secmetrics/
βββ cmd/
β βββ secmetrics/
β βββ main.go # CLI entry point
βββ pkg/
β βββ metrics/
β β βββ metrics.go # Metrics collection
β β βββ metrics_test.go # Unit tests
β βββ reporting/
β βββ reporting.go # Report generation
β βββ reporting_test.go # Unit tests
βββ README.md
- Security Program Management: Track and measure security program effectiveness
- Board Reporting: Generate executive reports for leadership
- Compliance Audits: Document compliance metrics and status
- Security Operations: Monitor security operations performance
- Risk Management: Track security risk metrics
- Continuous Improvement: Identify areas for security improvement
- Set realistic targets based on industry benchmarks
- Track metrics consistently over time
- Review KPIs regularly in security meetings
- Share reports with stakeholders
- Use metrics to drive security improvements
- Benchmark against peers and industry standards
MIT License
- Security metrics community
- CISO forums
- Industry working groups
Built with GPU by hallucinaut