Skip to content

Instantly share code, notes, and snippets.

@ipcjk
Created October 29, 2019 08:27
Show Gist options
  • Save ipcjk/670cb682d8ff0ea6b5041ee1df883def to your computer and use it in GitHub Desktop.
Save ipcjk/670cb682d8ff0ea6b5041ee1df883def to your computer and use it in GitHub Desktop.
Check supervisor processes for checkMK
#! /usr/bin/perl
foreach (split /[\r\n]+/, `supervisorctl status`) {
/([\w\-\d_]+)\s+([A-Z]+)\s+(.*)$/;
if($2 eq 'RUNNING') { print "0";} else { print "1";}
print " $1 - $3\n";
}
@techtug-a
Copy link

updated the script to output the full process name:


#!/usr/bin/perl

foreach (split /[\r\n]+/, `supervisorctl status`) {
    /(\S+:\S+)\s+([A-Z]+)\s+(.*)$/;
    if($2 eq 'RUNNING') { print "0";} else { print "1";}
    print " $1 - $3\n";
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment