Hacked By AnonymousFox

Current Path : /lib64/nagios/plugins/nccustom/
Upload File :
Current File : //lib64/nagios/plugins/nccustom/check-rpmdb-integrity.sh

#!/bin/bash

PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin

## check-rpmdb-integrity
## Created by Ihor Bilyi
##       Namecheap

##  This NRPE check "RPM Database Integrity" check the integrity of the RPM database packages file on shared hosting servers.


## Nagios Status
## 0 = OK (RPM database OK)
## 2 = CRITICAL (RPM database is corrupted)


##input option
PROGNAME=${0##*/}

print_usage() {
    echo ""
    echo "Usage: $PROGNAME  --help"
}

print_help() {
    print_usage
    echo ""
    echo "This check controls the integrity of the RPM database packages file on shared hosting servers (see TOP-1102)"
    echo ""
    echo "--help Print this help screen"
    echo ""
    exit 3
}

while [ $# -gt 0 ]; do

    case "$1" in
        --help)
        print_help
         ;;

        -h)
        print_help
         ;;

        *)
        echo >&2 "Unknown argument: $1"
        print_usage
        exit 3
        ;;

        esac
        shift
done



##check rpmdb file
res=$(timeout -s 9 1m repoquery --quiet --installed -a)

if  ! [ $? -gt 0 ] ; then
    echo "OK (RPM database OK)"
    exit 0
else
    echo "CRITICAL (RPM database is corrupted)"
    exit 2
fi

Hacked By AnonymousFox1.0, Coded By AnonymousFox