Skip to content
Snippets Groups Projects
Commit 0fecb6de authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

update markdown help for snmp_synology

parent 7a3bdcea
No related branches found
No related tags found
1 merge request!296Simple task/7546 icinga check für ablaufende gitlab tokens
......@@ -46,7 +46,6 @@
* [check_smartstatus](check_smartstatus.md)
* [check_snmp_data](check_snmp_data.md)
* [check_snmp_printer](check_snmp_printer.md)
* check_snmp_switch
* [check_snmp_synology](check_snmp_synology.md)
* check_ssl
* [check_ssl_certs](check_ssl_certs.md)
......
......@@ -24,15 +24,16 @@ Start the script without parameter to get the help.
______________________________________________________________________
CHECK_SNMP_SYNOLOGY
v1.4
v1.5
Based on script of Nicolas Ordonez.
Institute for Medical Education - University of Bern
(c) Institute for Medical Education - University of Bern
Licence: GNU GPL 3
https://os-docs.iml.unibe.ch/icinga-checks/Checks/check_snmp_synology.html
______________________________________________________________________
Check health of a Synology drive using SNMP.
Based on script of Nicolas Ordonez.
SYNTAX:
check_snmp_synology [options] -h TARGET
......
#!/bin/bash
tmpfile=/tmp/tmp_myfile_$USER__$$
cd "$( dirname "$0" )"
for f in *.md; do
if head "$f" | grep -q "^# "; then
echo
echo ">>>>> FIX $f"
echo
cp -p "$f" "$tmpfile"
if grep -q "^## Introduction" "$f"; then
echo "Replace '## Introduction'"
sed -i -e "s/^## Introduction.*//" "$tmpfile"
head -1 "$f" | tail -1 | grep "." && sed -i -e '2,3d' "$tmpfile"
# make 1st h1 smaller
sed -i -e "0,/^# /{s/^# /## /}" "$tmpfile"
else
echo "Move Headers"
if grep "^###### " "$f"; then
echo "ABORT: H6 was found that cannot moved to smaller level."
exit 1
fi
for header in "#####" "####" "###" "##" "#"
do
sed -i -e "s/^$header /#$header /g" "$tmpfile"
done
fi
diff -u --color "$f" "$tmpfile"
echo
read -p "Apply changes on '$f' [Y/n]? > " apply
if [ "$apply" = "" ] || [ "$apply" = "y" ]|| [ "$apply" = "Y" ]; then
echo "Applying ..."
mv "$tmpfile" "$f"
else
echo "Keeping current version."
rm "$tmpfile"
fi
sleep 1
echo
echo
echo
echo
echo
echo
echo ----------------------------------------------------------------------
else
echo "OK $f"
fi
done
\ No newline at end of file
#!/bin/bash
tmpfile=/tmp/tmp_myfile_$USER__$$
cd "$( dirname "$0" )"
for f in check*.md; do
if ! head "$f" | grep -q "^Script: \`"; then
myscript="${f//.md/}"
echo
echo ">>>>> FIX $f"
echo
sed -n "1,2p" "$f" > "$tmpfile"
echo "Script: \`${myscript}\`" >> "$tmpfile"
echo >> "$tmpfile"
sed -n "3,\$p" "$f" >> "$tmpfile"
if ! diff -u --color "$f" "$tmpfile"; then
echo
read -p "Apply changes on '$f' [Y/n]? > " apply
if [ "$apply" = "" ] || [ "$apply" = "y" ]|| [ "$apply" = "Y" ]; then
echo "Applying ..."
mv "$tmpfile" "$f"
else
echo "Keeping current version."
rm "$tmpfile"
fi
sleep 1
echo
echo
echo
echo
echo
echo
echo ----------------------------------------------------------------------
fi
else
echo "OK $f"
fi
done
\ No newline at end of file
#!/bin/bash
cd "$( dirname "$0" )" || exit
typeset -i iTotal
typeset -i iErr
typeset -i iWarn
# ----------------------------------------------------------------------
# FUNCTIONS
# ----------------------------------------------------------------------
function getChecks(){
grep "inc_pluginfunctions" * 2>/dev/null | cut -f 1 -d ":" | grep -vE "^(zz_|inc)"
}
# ----------------------------------------------------------------------
# MAIN
# ----------------------------------------------------------------------
iTotal=$( getChecks | wc -l )
echo
echo "CHECK IML CHECKS - $( date )"
echo
for check in $( getChecks )
do
if ./$check -h 2>/dev/null| grep -q "https://os-docs.iml.unibe.ch"; then
# echo "✅ OK $check"
url=$( ./$check -h | grep "https://os-docs.iml.unibe.ch" )
if curl -sI $url | grep -q "200 OK"; then
echo "✅ OK : $check"
else
echo "⚠️ WARN : $check - $url"
iWarn+=1
fi
else
echo "❌ ERROR: $check"
iErr+=1
# ./$check -h
fi
done
echo
echo "---- Total : $iTotal"
echo " Errors : $iErr checks with wrong help"
echo " Warnings : $iWarn checks with wrong url"
echo
# ----------------------------------------------------------------------
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment