# ############################################################################### import os import subprocess import uuid import collectd from fm_api import constants as fm_constants from fm_api import fm_api import tsconfig.tsconfig as tsc import plugin_common as pc import socket api = fm_api.FaultAPIsV2() PLUGIN = 'NTP query plugin' PLUGIN_INTERVAL = 300 # audit interval in secs PLUGIN_CONF = '/etc/ntp.conf' PLUGIN_EXEC = '/usr/sbin/ntpq' PLUGIN_EXEC_OPTIONS = '-pn' PLUGIN_ALARMID = "100.114" # define a class here that will persist over read calls class NtpqObject(pc.PluginObject): alarm_raised = False # True when the major alarm is asserted server_list_conf = [] # list of servers in the /etc/ntp.conf file
# not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import sys from fm_api import fm_api from fm_api import constants ser = fm_api.FaultAPIsV2() def print_alarm(alarm): alarm_str = "alarm_id: " + alarm.alarm_id + ", " alarm_str += "uuid: " + alarm.uuid + ", " alarm_str += "alarm_type: " + alarm.alarm_type + "\n" alarm_str += "state: " + alarm.alarm_state + ", " alarm_str += "severity: " + alarm.severity + ", " alarm_str += "entity_type_id: " + alarm.entity_type_id + ", " alarm_str += "timestamp: " + alarm.timestamp + "\n" alarm_str += "entity_instance_id: " + alarm.entity_instance_id + ", " alarm_str += "probable cause:" + alarm.probable_cause + "\n" print(alarm_str)