
Research
Security News
The Landscape of Malicious Open Source Packages: 2025 Mid‑Year Threat Report
A look at the top trends in how threat actors are weaponizing open source packages to deliver malware and persist across the software supply chain.
github.com/meysam81/prometheus-command-timer
A utility that executes commands and reports execution metrics to a Prometheus Pushgateway.
Prometheus Command Timer is a lightweight tool that wraps around command execution to collect and send performance metrics to a Prometheus Pushgateway.
It measures execution time, tracks exit status, and records timestamps, making it ideal for monitoring batch jobs, cron tasks, and other command-line operations in a Kubernetes environment.
docker run --rm -v \
$(pwd):/cwd ghcr.io/meysam81/prometheus-command-timer \
-d /cwd
The script will automatically detect your OS and architecture:
curl -sL https://raw.githubusercontent.com/meysam81/prometheus-command-timer/main/install.sh | sh
./prometheus-command-timer -version
$PATH
Basic usage:
prometheus-command-timer \
--pushgateway-url http://pushgateway:9091 \
--job-name backup \
-- \
pg_dump database
Create a job that runs a command with timing metrics:
apiVersion: batch/v1
kind: Job
metadata:
name: sleep
spec:
template:
spec:
containers:
- args:
- |
sleep 10
command:
- prometheus-command-timer
- --pushgateway-url=http://pushgateway.monitoring.svc.cluster.local:9091
- --job-name=sleep
- "--"
image: busybox:1
name: sleep
volumeMounts:
- mountPath: /usr/local/bin/prometheus-command-timer
name: tmp
subPath: prometheus-command-timer
initContainers:
- args:
- -d
- /tmp
image: ghcr.io/meysam81/prometheus-command-timer
name: install-prometheus-command-timer
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
runAsGroup: 65534
runAsNonRoot: true
runAsUser: 65534
volumeMounts:
- mountPath: /tmp
name: tmp
restartPolicy: OnFailure
volumes:
- emptyDir: {}
name: tmp
Usage: prometheus-command-timer [OPTIONS] -- COMMAND [ARGS...]
Executes a command and reports its duration to a Prometheus Pushgateway.
Options:
-pushgateway-url string
Pushgateway URL (required)
-job-name string
Job name for metrics (required)
-instance-name string
Instance name for metrics (default: hostname)
-labels string
Additional labels in key=value format, comma-separated (e.g., env=prod,team=infra)
-version
Output version
-help, -h
Show help message
Example:
prometheus-command-timer \
--pushgateway-url http://pushgateway:9091 \
--job-name backup --instance-name db01 \
--labels env=prod,team=infra,type=full \
-- \
pg_dump database
Note: Use -- to separate the wrapper options from the command to be executed.
The following metrics are collected:
job_duration_seconds
- Total time taken for job execution in secondsjob_exit_status
- Exit status code of the last job execution (0=success)job_last_execution_timestamp
- Timestamp of the last job executionjob_executions_total
- Total number of job executionsgit clone https://github.com/meysam81/prometheus-command-timer.git
cd prometheus-command-timer
go build -o prometheus-command-timer
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A look at the top trends in how threat actors are weaponizing open source packages to deliver malware and persist across the software supply chain.
Security News
ESLint now supports HTML linting with 48 new rules, expanding its language plugin system to cover more of the modern web development stack.
Security News
CISA is discontinuing official RSS support for KEV and cybersecurity alerts, shifting updates to email and social media, disrupting automation workflows.