initial: no secrets

This commit is contained in:
2024-02-12 17:01:18 +01:00
commit cf9efd55b5
186 changed files with 8697 additions and 0 deletions
+63
View File
@@ -0,0 +1,63 @@
https://github.com/weiss/nsca-ng/blob/master/COPYING
Unless otherwise noted, all files distributed as part of NSCA-ng are covered
by the copyright and license statement below. Some files (outside the `src'
directory) are subject to different copyright and/or license terms, as
specified at the top of those files. However, all NSCA-ng code is believed
to be covered by terms which are at least as permissive as the following
license.
| Copyright (c) 2013 Holger Weiss <holger@weiss.in-berlin.de>
| All rights reserved.
|
| Redistribution and use in source and binary forms, with or without
| modification, are permitted provided that the following conditions are
| met:
|
| 1. Redistributions of source code must retain the above copyright notice,
| this list of conditions and the following disclaimer.
|
| 2. Redistributions in binary form must reproduce the above copyright
| notice, this list of conditions and the following disclaimer in the
| documentation and/or other materials provided with the distribution.
|
| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
| IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
| THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
| PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
| CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
| EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
| PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
| PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
| LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
| NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
In addition to these copyright and license terms, binary redistributions may
be required to reproduce the following copyright notices, depending on which
source files are compiled. The above license statement applies to all of
them.
If any files in the `lib/ev' directory are used during compilation:
| Copyright (c) 2007-2018 Marc Alexander Lehmann <libev@schmorp.de>
| Copyright (c) 2011 Emanuele Giaquinta
If any files in the `lib/pidfile' directory are used during compilation:
| Copyright (c) 2005 Pawel Jakub Dawidek <pjd@FreeBSD.org>
| Copyright (c) 2007 Dag-Erling Coidan Smoergrav
If the file `lib/pidfile/flock.c' is used during compilation:
| Copyright (c) 2001 The NetBSD Foundation, Inc.
If any files in the `python' directory (except for `uthash.h') are used:
| Copyright (c) 2014 Alexander Golovko
If any files in the `perl' directory are used:
| Copyright (c) 2015 Matthias Bethke
Additional requirements may be imposed by external libraries.
+50
View File
@@ -0,0 +1,50 @@
#!/usr/bin/python3
import subprocess
import sys
import os
import argparse
import json
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Backup Dir Size helper")
parser.add_argument('PATH')
parser.add_argument('--save-new-size', action='store_const',
default=False, const=True)
args = parser.parse_args()
# check parameter #
if not args.PATH.replace("/", "").replace("-","").isalnum():
print("Illegal Path: {} (must be alphanum + /)".format(args.PATH))
sys.exit(1)
elif not args.PATH.startswith("/"):
print("Path mus be absolute ({})".format(args.PATH))
sys.exit(1)
elif not os.path.isdir(args.PATH):
print("Path does not exist ({}".format(args.PATH))
sys.exit(1)
savedir = "/opt/backup-info"
savepath = os.path.join(savedir, args.PATH.lstrip("/").replace("/", "-"))
currentSize = 0
if os.path.isfile(savepath):
with open(savepath) as f:
currentSize = int(f.read())
# check #
p = subprocess.run(["du", args.PATH], capture_output=True, encoding="utf-8")
size = int(p.stdout.split("\n")[-2].split("\t")[0])
if currentSize and currentSize == size:
result = { "changed" : False, "old" : currentSize, "new" : size }
else:
result = { "changed" : True, "old" : currentSize, "new" : size }
if args.save_new_size:
with open(savepath, "w") as f:
f.write(str(size))
# return result
print(json.dumps(result))
Binary file not shown.
+1
View File
@@ -0,0 +1 @@
deb [signed-by=/usr/share/keyrings/influx-repo.gpg] https://repos.influxdata.com/debian bullseye stable
Executable
BIN
View File
Binary file not shown.
+106
View File
@@ -0,0 +1,106 @@
#!/usr/bin/python3
"""
You can redistribute it and/or modify it under the terms of the GNU General
Public License as published by the Free Software Foundation, either version 2
of the License.
Copyright Andrea Briganti a.k.a 'Kbyte'
"""
import io
import subprocess
import argparse
import nagiosplugin
class SystemdStatus(nagiosplugin.Resource):
name = 'SYSTEMD'
def probe(self):
# Execute systemctl --failed --no-legend and get output
try:
p = subprocess.Popen(['systemctl', '--failed', '--no-legend'],
stderr=subprocess.PIPE,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE)
pres, err = p.communicate()
except OSError as e:
raise nagiosplugin.CheckError(e)
if err:
raise nagiosplugin.CheckError(err)
if pres:
result = ""
for line in io.StringIO(pres.decode('utf-8')):
# format is DOT_SPECIA_CHAR name service failed ..
result = "%s %s" % (result, line.split(' ')[1])
return [nagiosplugin.Metric('systemd', (False, result), context='systemd')]
return [nagiosplugin.Metric('systemd', (True, None), context='systemd')]
class ServiceStatus(nagiosplugin.Resource):
name = 'SYSTEMD'
def __init__(self, *args, **kwargs):
self.service = kwargs.pop('service')
super(nagiosplugin.Resource, self).__init__(*args, **kwargs)
def probe(self):
# Execute systemctl is-active and get output
try:
p = subprocess.Popen(['systemctl', 'is-active', self.service],
stderr=subprocess.PIPE,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE)
pres, err = p.communicate()
except OSError as e:
raise nagiosplugin.CheckError(e)
if err:
raise nagiosplugin.CheckError(err)
if pres:
result = ""
for line in io.StringIO(pres.decode('utf-8')):
result = "%s %s" % (result, line.split(' ')[0])
result = result.strip()
if result == "active":
return [nagiosplugin.Metric('systemd', (True, None), context='systemd')]
else:
return [nagiosplugin.Metric('systemd', (False, self.service), context='systemd')]
return [nagiosplugin.Metric('systemd', (False, "No Service given"), context='systemd')]
class SystemdContext(nagiosplugin.Context):
def __init__(self):
super(SystemdContext, self).__init__('systemd')
def evaluate(self, metric, resource):
value, output = metric.value
if value:
return self.result_cls(nagiosplugin.Ok, metric=metric)
else:
return self.result_cls(nagiosplugin.Critical, metric=metric, hint='failed units: %s' % output)
def main():
parser = argparse.ArgumentParser()
parser.add_argument("-s", "--service", type=str, dest="service", help="Name of the Service that is beeing tested")
args = parser.parse_args()
if args.service is None:
check = nagiosplugin.Check(
SystemdStatus(),
SystemdContext())
else:
check = nagiosplugin.Check(
ServiceStatus(service=args.service),
SystemdContext())
check.main()
if __name__ == '__main__':
main()
BIN
View File
Binary file not shown.