#!/bin/bash

# /etc/nagios-cache.d/.ncrc
# base rc and funcs for nagios-cache cronjob scripts
# $Id: .ncrc 691 2017-06-04 23:12:04Z fwbergm $

# no nagios-cache-script should be started on high load
export LOAD1=$(cut -d. -f1 /proc/loadavg)
[ $LOAD1 -gt 35 ] && exit 0

# don't change this unless ya kno wot yar doing
PATH=/nagios-cache/bin:/bin:/opt/nagios-fwb/bin:/usr/bin:/sbin:/usr/sbin:/command:/usr/local/bin:/usr/local/sbin

# some base checks
cd /nagios-cache 2>/dev/null || { echo "ERROR: no /nagios-cache" | tee /dev/stderr; exit 1; }
# FWB 2009-10-07: don't use df, we actually don't want stats, maybe a nfs-mount has gone away
grep " .nagios-cache " /proc/mounts|cut -d\  -f1|grep -q "^\/dev\/r[ad][m/]" || { echo "ERROR: /nagios-cache doesn't seem to be a ramdisk" | tee /dev/stderr; exit 1; }

OVZ_PRIVATE_DIR=/var/lib/vz/private
unset OVZ_CHECK_MASTER_ID
umask 077
