Linux server.edchosting.com 4.18.0-553.79.1.lve.el7h.x86_64 #1 SMP Wed Oct 15 16:34:46 UTC 2025 x86_64
LiteSpeed
Server IP : 75.98.162.185 & Your IP : 216.73.216.163
Domains :
Cant Read [ /etc/named.conf ]
User : goons4good
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
usr /
lib64 /
nagios /
plugins /
Delete
Unzip
Name
Size
Permission
Date
Action
eventhandlers
[ DIR ]
drwxr-xr-x
2024-03-10 06:52
a2_csf_modsecsync.mvps.mdedi
1.27
KB
-rwxr-xr-x
2025-09-10 09:31
a2_customerview.sh.shared
1.21
KB
-rwxr-xr-x
2025-09-10 09:31
a2_nf_conntrack_count.sh.all
977
B
-rwxr-xr-x
2025-09-10 09:31
a2_postgresql-monitor.shared
1.23
KB
-rwxr-xr-x
2025-09-10 09:31
a2_ram.shared.mdedi.bmi
611
B
-rwxr-xr-x
2025-09-10 09:31
a2_sssd_service_check.sh.all
1.4
KB
-rwxr-xr-x
2025-09-10 09:31
a2_system-updates.all
2.18
KB
-rwxr-xr-x
2025-09-10 09:31
a2_temperature_check.shared.bmi
3.17
KB
-rwxr-xr-x
2025-09-10 09:31
a2_user_mem.shared
1.13
KB
-rwxr-xr-x
2025-09-10 09:31
a2_yum_processes.shared
835
B
-rwxr-xr-x
2025-09-10 09:31
check_a2_backup_network
844
B
-rwxr-xr-x
2025-09-10 09:31
check_a2_backups
2.64
KB
-rwxr-xr-x
2025-09-10 09:31
check_a2_cagefs.shared.mvps.mdedi
762
B
-rwxr-xr-x
2025-09-10 09:31
check_a2_cagefs_503_errors
2.96
KB
-rwxr-xr-x
2025-09-10 09:31
check_a2_cpdavd_cpu.sh
701
B
-rwxr-xr-x
2025-09-10 09:31
check_a2_cpu_throttle.shared
1.61
KB
-rwxr-xr-x
2025-09-10 09:31
check_a2_dbgov.shared
1.23
KB
-rwxr-xr-x
2025-09-10 09:31
check_a2_dedi_nvme.mdedi
894
B
-rwxr-xr-x
2025-09-10 09:31
check_a2_devnull-perms.shared
161
B
-rwxr-xr-x
2025-09-10 09:31
check_a2_dimm.shared
1.49
KB
-rwxr-xr-x
2025-09-10 09:31
check_a2_disk.sh
2.05
KB
-rwxr-xr-x
2025-09-10 09:31
check_a2_dmi.sh.all
2.38
KB
-rwxr-xr-x
2025-09-10 09:31
check_a2_dnsdist_cache.sh
298
B
-rwxr-xr-x
2025-09-10 09:31
check_a2_dnsdist_health.sh
270
B
-rwxr-xr-x
2025-09-10 09:31
check_a2_dnsdist_pools.sh
414
B
-rwxr-xr-x
2025-09-10 09:31
check_a2_dnsdist_proc.sh
210
B
-rwxr-xr-x
2025-09-10 09:31
check_a2_dovecot
191
B
-rwxr-xr-x
2025-09-10 09:31
check_a2_extra_ips.shared
854
B
-rwxr-xr-x
2025-09-10 09:31
check_a2_fsstate.sh.all
2.28
KB
-rwxr-xr-x
2025-09-10 09:31
check_a2_fw.sh.internal
2.11
KB
-rwxr-xr-x
2025-09-10 09:31
check_a2_fw.sh.shared
1.04
KB
-rwxr-xr-x
2025-09-10 09:31
check_a2_grub.sh.all
1.22
KB
-rwxr-xr-x
2025-09-10 09:31
check_a2_httpdconf.shared
1.16
KB
-rwxr-xr-x
2025-04-15 08:48
check_a2_ifspeed.shared
784
B
-rwxr-xr-x
2025-09-10 09:31
check_a2_imap_auth
1.2
KB
-rwxr-xr-x
2025-02-19 06:03
check_a2_imunify_service
910
B
-rwxr-xr-x
2025-09-10 09:31
check_a2_ipaliases.shared
443
B
-rwxr-xr-x
2025-09-10 09:31
check_a2_ipastatus.sh
2.16
KB
-rwxr-xr-x
2025-09-10 09:31
check_a2_ipmi_ip.sh.shared
565
B
-rwxr-xr-x
2025-09-10 09:31
check_a2_jbk_client_limits.sh
1.13
KB
-rwxr-xr-x
2025-09-10 09:31
check_a2_jetbackup.sh
12.08
KB
-rwxr-xr-x
2025-09-10 09:31
check_a2_largelogs.shared
966
B
-rwxr-xr-x
2025-09-10 09:31
check_a2_le_certs.sh.saltmaster1
1.02
KB
-rwxr-xr-x
2025-09-10 09:31
check_a2_load.php
618
B
-rwxr-xr-x
2025-09-10 09:31
check_a2_long_mysql_queries
1.22
KB
-rwxr-xr-x
2025-09-10 09:31
check_a2_mailqueue.mvps.mdedi
1.26
KB
-rwxr-xr-x
2025-09-10 09:31
check_a2_memlimits-on.shared
458
B
-rwxr-xr-x
2025-09-10 09:31
check_a2_mod-passenger.shared
516
B
-rwxr-xr-x
2025-09-10 09:31
check_a2_monitor-randomize_sqlroot_password_cron.shared.mvps.mdedi
322
B
-rwxr-xr-x
2025-09-10 09:31
check_a2_mysql-monitor.shared.mvps.mdedi
2.62
KB
-rwxr-xr-x
2025-09-10 09:31
check_a2_mysql-replication.sh
1.33
KB
-rwxr-xr-x
2025-09-10 09:31
check_a2_mysql_tmp_size
242
B
-rwxr-xr-x
2025-09-10 09:31
check_a2_olderdrive_health.all
2.25
KB
-rwxr-xr-x
2025-09-10 09:31
check_a2_omni_mysql_backup.sh
1.15
KB
-rwxr-xr-x
2025-09-10 09:31
check_a2_omni_pxe_https_check.sh
1.27
KB
-rwxr-xr-x
2025-09-10 09:31
check_a2_omni_saltmaster1_authcheck.sh
2.76
KB
-rwxr-xr-x
2025-09-10 09:31
check_a2_omni_website.sh
1.01
KB
-rwxr-xr-x
2025-09-10 09:31
check_a2_outbound_nat.sh
436
B
-rwxr-xr-x
2025-09-10 09:31
check_a2_packets.mvps
1.73
KB
-rwxr-xr-x
2025-09-10 09:31
check_a2_pdns
462
B
-rwxr-xr-x
2025-09-10 09:31
check_a2_php_versions.shared
3.04
KB
-rwxr-xr-x
2025-09-10 09:31
check_a2_redis_opcache.shared
1.39
KB
-rwxr-xr-x
2025-09-10 09:31
check_a2_salt_minion_service
196
B
-rwxr-xr-x
2025-09-10 09:31
check_a2_salt_running.all
1.83
KB
-rwxr-xr-x
2025-09-10 09:31
check_a2_saltmaster_api.sh
1.13
KB
-rwxr-xr-x
2025-09-10 09:31
check_a2_smart.py.all
15.54
KB
-rwxr-xr-x
2025-09-10 09:31
check_a2_softy_version.sh.shared.mvps.mdedi
1.09
KB
-rwxr-xr-x
2025-09-10 09:31
check_a2_vps_memory.sh
411
B
-rwxr-xr-x
2025-09-10 09:31
check_a2_vz7-ikvm_backup.sh
1.2
KB
-rwxr-xr-x
2025-09-10 09:31
check_a2_whm_ssl
874
B
-rwxr-xr-x
2025-09-10 09:31
check_a2_whmcs_db_mysql-replication.sh
2.19
KB
-rwxr-xr-x
2025-09-10 09:31
check_a2_whmcs_nginx_connections.sh
745
B
-rwxr-xr-x
2025-09-10 09:31
check_a2_whmcs_phpfpm_status.sh
1.6
KB
-rwxr-xr-x
2025-09-10 09:31
check_a2_whmcs_th_network.sh
773
B
-rwxr-xr-x
2025-09-10 09:31
check_a2_whmcs_virtualizor.sh
534
B
-rwxr-xr-x
2025-09-10 09:31
check_a2_xen_guest_vm.sh.flexdedi
3.11
KB
-rwxr-xr-x
2025-09-10 09:31
check_a2_zpool.sh
1.31
KB
-rwxr-xr-x
2025-09-10 09:31
check_aad_ldaps
2.09
KB
-rwxr-xr-x
2025-11-03 05:31
check_apache_status.pl
6.09
KB
-rwxr-xr-x
2025-09-10 09:31
check_backup_zpool
17.68
KB
-rwxr-xr-x
2025-09-10 09:31
check_backuply.py
5.77
KB
-rwxr-xr-x
2025-09-10 09:31
check_backups.php
576
B
-rwxr-xr-x
2025-09-10 09:31
check_breeze
2.29
KB
-rwxr-xr-x
2024-04-11 07:27
check_by_ssh
61.16
KB
-rwxr-xr-x
2024-04-11 07:27
check_clamd
61.13
KB
-rwxr-xr-x
2024-04-11 07:27
check_cluster
40.35
KB
-rwxr-xr-x
2024-04-11 07:27
check_cpu
467
B
-rwxr-xr-x
2025-09-10 09:31
check_cpu_interrupts
353
B
-rwxr-xr-x
2025-09-10 09:31
check_cpu_steal
313
B
-rwxr-xr-x
2025-09-10 09:31
check_crond
227
B
-rwxr-xr-x
2025-09-10 09:31
check_csf
535
B
-rwxr-xr-x
2025-09-10 09:31
check_dhcp
56.75
KB
-rwsr-x---
2024-04-11 07:27
check_dig
56.83
KB
-rwxr-xr-x
2024-04-11 07:27
check_disk
86.26
KB
-rwxr-xr-x
2024-04-11 07:27
check_disk_smb
9.9
KB
-rwxr-xr-x
2024-04-11 07:27
check_dns
249
B
-rwxr-xr-x
2025-09-10 09:31
check_dummy
31.76
KB
-rwxr-xr-x
2024-04-11 07:27
check_elastic
10.49
KB
-rwxr-xr-x
2025-09-10 09:31
check_elasticsearch
335
B
-rwxr-xr-x
2025-09-10 09:31
check_enhance_backup
495
B
-rwxr-xr-x
2025-09-10 09:31
check_exim
184
B
-rwxr-xr-x
2025-09-10 09:31
check_exim_spam.sh
3.44
KB
-rwxr-xr-x
2025-09-10 09:31
check_eximqueue.sh
1.11
KB
-rwxr-xr-x
2025-09-10 09:31
check_file_age
4.95
KB
-rwxr-xr-x
2024-04-11 07:27
check_flexlm
6.35
KB
-rwxr-xr-x
2024-04-11 07:27
check_fping
56.76
KB
-rwsr-x---
2024-04-11 07:27
check_ftp
61.13
KB
-rwxr-xr-x
2024-04-11 07:27
check_ftpd
199
B
-rwxr-xr-x
2025-09-10 09:31
check_game
44.5
KB
-rwxr-xr-x
2024-04-11 07:27
check_hpjd
52.5
KB
-rwxr-xr-x
2024-04-11 07:27
check_http
106.2
KB
-rwxr-xr-x
2024-04-11 07:27
check_icmp
68.39
KB
-rwsr-x---
2024-04-11 07:27
check_ide_smart
44.57
KB
-rwsr-x---
2024-04-11 07:27
check_imap
61.13
KB
-rwxr-xr-x
2024-04-11 07:27
check_iowait
587
B
-rwxr-xr-x
2025-09-10 09:31
check_ipaliases.py
2.14
KB
-rwxr-xr-x
2025-09-10 09:31
check_ipmi_sensor
39.45
KB
-rwxr-xr-x
2025-09-10 09:31
check_ircd
6.82
KB
-rwxr-xr-x
2024-04-11 07:27
check_jabber
61.13
KB
-rwxr-xr-x
2024-04-11 07:27
check_jetbackup.py
12.8
KB
-rwxr-xr-x
2025-09-10 09:31
check_jetbackup_alerts
5.35
KB
-rwxr-xr-x
2025-09-10 09:31
check_jetbackup_license.sh
581
B
-rwxr-xr-x
2025-09-10 09:31
check_jetbackup_mongodb
915
B
-rwxr-xr-x
2025-09-10 09:31
check_jetbackup_queue
4.83
KB
-rwxr-xr-x
2025-09-10 09:31
check_kernel
393
B
-rwxr-xr-x
2025-09-10 09:31
check_ldap
61.07
KB
-rwxr-xr-x
2024-04-11 07:27
check_ldaps
61.07
KB
-rwxr-xr-x
2024-04-11 07:27
check_litespeed
2.43
KB
-rwxr-xr-x
2025-09-10 09:31
check_load
48.39
KB
-rwxr-xr-x
2024-04-11 07:27
check_load.php
422
B
-rwxr-xr-x
2025-09-10 09:31
check_load.py
401
B
-rwxr-xr-x
2025-09-10 09:31
check_local_users
2.01
MB
-rwxr-xr-x
2025-09-10 09:31
check_log
7.99
KB
-rwxr-xr-x
2024-04-11 07:27
check_lvm_thinpools
2.48
KB
-rwxr-xr-x
2025-09-10 09:31
check_mailq
25
KB
-rwxr-xr-x
2024-04-11 07:27
check_managed.sh
5.85
KB
-rwxr-xr-x
2025-09-10 09:31
check_md5files
1.2
KB
-rwxr-xr-x
2025-09-10 09:31
check_md_raid
782
B
-rwxr-xr-x
2025-09-10 09:31
check_megaraid_sas
6.75
KB
-rwxr-xr-x
2025-09-10 09:31
check_memcached
184
B
-rwxr-xr-x
2025-09-10 09:31
check_meminfo
2.79
KB
-rwxr-xr-x
2025-09-10 09:31
check_memory
330
B
-rwxr-xr-x
2025-09-10 09:31
check_memory.py
1.06
KB
-rwxr-xr-x
2025-09-10 09:31
check_mrtg
44.42
KB
-rwxr-xr-x
2024-04-11 07:27
check_mrtgtraf
44.36
KB
-rwxr-xr-x
2024-04-11 07:27
check_mysql
52.91
KB
-rwxr-xr-x
2024-04-11 07:27
check_mysql_all.sh
6.53
KB
-rwxr-xr-x
2025-09-10 09:31
check_mysql_connections
5.89
KB
-rwxr-xr-x
2025-09-10 09:31
check_mysql_engines
603
B
-rwxr-xr-x
2025-09-10 09:31
check_mysql_log
170
B
-rwxr-xr-x
2025-09-10 09:31
check_mysql_memory
733
B
-rwxr-xr-x
2025-09-10 09:31
check_mysql_processes
346
B
-rwxr-xr-x
2025-09-10 09:31
check_mysql_query
48.71
KB
-rwxr-xr-x
2024-04-11 07:27
check_nagios
44.34
KB
-rwxr-xr-x
2024-04-11 07:27
check_nimbus.sh
2.25
KB
-rwxr-xr-x
2025-09-10 09:31
check_nntp
61.13
KB
-rwxr-xr-x
2024-04-11 07:27
check_nntps
61.13
KB
-rwxr-xr-x
2024-04-11 07:27
check_nscp_api
5.84
MB
-rwxr-xr-x
2024-10-29 07:19
check_nt
56.65
KB
-rwxr-xr-x
2024-04-11 07:27
check_ntp
56.84
KB
-rwxr-xr-x
2024-04-11 07:27
check_ntp.pl
14.53
KB
-rwxr-xr-x
2024-04-11 07:27
check_ntp_peer
56.91
KB
-rwxr-xr-x
2024-04-11 07:27
check_ntp_time
52.84
KB
-rwxr-xr-x
2024-04-11 07:27
check_nwstat
68.52
KB
-rwxr-xr-x
2024-04-11 07:27
check_oracle
9.27
KB
-rwxr-xr-x
2024-04-11 07:27
check_overcr
48.49
KB
-rwxr-xr-x
2024-04-11 07:27
check_partitions
434
B
-rwxr-xr-x
2025-09-10 09:31
check_pgsql
56.95
KB
-rwxr-xr-x
2024-04-11 07:27
check_ping
60.77
KB
-rwxr-xr-x
2024-04-11 07:27
check_pop
61.13
KB
-rwxr-xr-x
2024-04-11 07:27
check_postfix
193
B
-rwxr-xr-x
2025-09-10 09:31
check_postfix_queue
930
B
-rwxr-xr-x
2025-09-10 09:31
check_postgres
445.78
KB
-rwxr-xr-x
2025-09-10 09:31
check_procs
60.99
KB
-rwxr-xr-x
2024-04-11 07:27
check_proxmox.sh
928
B
-rwxr-xr-x
2025-09-10 09:31
check_proxmox_backups.sh
1.86
KB
-rwxr-xr-x
2025-09-10 09:31
check_qps_dnsdist.sh
1.68
KB
-rwxr-xr-x
2025-09-10 09:31
check_real
48.59
KB
-rwxr-xr-x
2024-04-11 07:27
check_redis.sh
175
B
-rwxr-xr-x
2025-09-10 09:31
check_resolver.py
3.27
KB
-rwxr-xr-x
2025-09-10 09:31
check_rpc
9.45
KB
-rwxr-xr-x
2024-04-11 07:27
check_rpmdb
690
B
-rwxr-xr-x
2025-09-10 09:31
check_sensors
1.59
KB
-rwxr-xr-x
2024-04-11 07:27
check_service.sh
9.94
KB
-rwxr-xr-x
2025-09-10 09:31
check_simap
61.13
KB
-rwxr-xr-x
2024-04-11 07:27
check_smart.pl
35.16
KB
-rwxr-xr-x
2025-09-10 09:31
check_smartarray.py
10.07
KB
-rwxr-xr-x
2025-09-10 09:31
check_smartermail_queue
1.5
KB
-rwxr-xr-x
2025-09-10 09:31
check_smtp
69.23
KB
-rwxr-xr-x
2024-04-11 07:27
check_snmp
77.59
KB
-rwxr-xr-x
2024-04-11 07:27
check_spop
61.13
KB
-rwxr-xr-x
2024-04-11 07:27
check_ssh
48.59
KB
-rwxr-xr-x
2024-04-11 07:27
check_ssmtp
61.13
KB
-rwxr-xr-x
2024-04-11 07:27
check_sssd
1.32
KB
-rwxr-xr-x
2025-09-10 09:31
check_supervisord.py
15.71
KB
-rwxr-xr-x
2025-09-10 09:31
check_swap
44.33
KB
-rwxr-xr-x
2024-04-11 07:27
check_tcp
61.13
KB
-rwxr-xr-x
2024-04-11 07:27
check_time
48.55
KB
-rwxr-xr-x
2024-04-11 07:27
check_tmp
210
B
-rwxr-xr-x
2025-09-10 09:31
check_udp
61.13
KB
-rwxr-xr-x
2024-04-11 07:27
check_ups
52.61
KB
-rwxr-xr-x
2024-04-11 07:27
check_users
40.2
KB
-rwxr-xr-x
2024-04-11 07:27
check_vm_status.sh
635
B
-rwxr-xr-x
2025-09-10 09:31
check_wave
3.19
KB
-rwxr-xr-x
2024-04-11 07:27
check_webserver_status
2.93
KB
-rwxr-xr-x
2025-09-10 09:31
check_yum_updates
600
B
-rwxr-xr-x
2025-09-10 09:31
check_zfs
17.68
KB
-rwxr-xr-x
2025-09-10 09:31
check_zpool_usage.sh
885
B
-rwxr-xr-x
2025-09-10 09:31
md5list
61
B
-rw-r--r--
2025-09-10 09:31
negate
40.18
KB
-rwxr-xr-x
2024-04-11 07:27
urlize
35.97
KB
-rwxr-xr-x
2024-04-11 07:27
utils.pm
2.05
KB
-rw-r--r--
2024-04-11 07:27
utils.sh
2.73
KB
-rwxr-xr-x
2024-04-11 07:27
vz7_check_a2_backup_timer_enabled.sh
605
B
-rwxr-xr-x
2025-09-10 09:31
vz7_check_a2_backups-check.sh
8.4
KB
-rwxr-xr-x
2025-09-10 09:31
vz7_check_a2_backups-running.sh
2.18
KB
-rwxr-xr-x
2025-09-10 09:31
vz7_check_a2_fw.sh
1.37
KB
-rwxr-xr-x
2025-09-10 09:31
vz7_check_a2_ifspeed.sh
1.04
KB
-rwxr-xr-x
2025-09-10 09:31
vz7_check_a2_license.sh
749
B
-rwxr-xr-x
2025-09-10 09:31
vz7_check_a2_template_count.sh
856
B
-rwxr-xr-x
2025-09-10 09:31
vz7_check_a2_templates_mount.sh
940
B
-rwxr-xr-x
2025-09-10 09:31
vz7_check_a2_zombie-procs.sh
768
B
-rwxr-xr-x
2025-09-10 09:31
vz7_check_nfs_kill.sh
1000
B
-rwxr-xr-x
2025-09-10 09:31
Save
Rename
#!/usr/bin/env python # -*- coding: utf-8 -*- # nagios-check-supervisord # check_supervisord.py # Copyright (c) 2015-2021 Alexei Andrushievich <vint21h@vint21h.pp.ua> # Check supervisord programs status Nagios plugin [https://github.com/vint21h/nagios-check-supervisord/] # noqa: E501 # # This file is part of nagios-check-supervisord. # # nagios-check-supervisord 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 program 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/>. from __future__ import unicode_literals import os import sys import stat from collections import OrderedDict from argparse import Namespace, ArgumentParser # pylint: disable=W0611 # noqa: F401 try: import xmlrpc.client as xmlrpclib except ImportError: import xmlrpclib # type: ignore __all__ = [ "main", "CheckSupervisord", ] # metadata VERSION = (2, 2, 1) __version__ = ".".join(map(str, VERSION)) class CheckSupervisord(object): """ Check supervisord programs status Nagios plugin. """ OUTPUT_TEMPLATES = { "critical": {"text": "problem with '{name}': ({status})", "priority": 1}, "warning": { "text": "something curiously with '{name}': ({status})", "priority": 2, }, "unknown": {"text": "'{name}' not found in server response", "priority": 3}, "ok": {"text": "'{name}': OK", "priority": 4}, } STATUS_CRITICAL, STATUS_WARNING, STATUS_UNKNOWN, STATUS_OK = [ "critical", "warning", "unknown", "ok", ] EXIT_CODES = { STATUS_OK: 0, STATUS_WARNING: 1, STATUS_CRITICAL: 2, STATUS_UNKNOWN: 3, } ( STATE_STOPPED, STATE_RUNNING, STATE_STARTING, STATE_BACKOFF, STATE_STOPPING, STATE_EXITED, STATE_FATAL, STATE_UNKNOWN, ) = ( "STOPPED", "RUNNING", "STARTING", "BACKOFF", "STOPPING", "EXITED", "FATAL", "UNKNOWN", ) STATE_TO_TEMPLATE = { STATE_STOPPED: STATUS_OK, STATE_RUNNING: STATUS_OK, STATE_STARTING: STATUS_WARNING, STATE_BACKOFF: STATUS_WARNING, STATE_STOPPING: STATUS_WARNING, STATE_EXITED: STATUS_WARNING, STATE_FATAL: STATUS_CRITICAL, STATE_UNKNOWN: STATUS_UNKNOWN, } URI_TPL_HTTP, URI_TPL_HTTP_AUTH, URI_TPL_SOCKET = "http", "http-auth", "socket" URI_TEMPLATES = { URI_TPL_HTTP: "http://{server}:{port}", URI_TPL_HTTP_AUTH: "http://{username}:{password}@{server}:{port}", URI_TPL_SOCKET: "unix://{server}", } ( PRIORITY_CRITICAL, PRIORITY_WARNING, PRIORITY_UNKNOWN, PRIORITY_OK, ) = range(1, 5) PRIORITY_TO_STATUS = { PRIORITY_CRITICAL: STATUS_CRITICAL, PRIORITY_WARNING: STATUS_WARNING, PRIORITY_UNKNOWN: STATUS_UNKNOWN, PRIORITY_OK: STATUS_OK, } STATUS_TO_PRIORITY = { STATUS_CRITICAL: PRIORITY_CRITICAL, STATUS_WARNING: PRIORITY_WARNING, STATUS_UNKNOWN: PRIORITY_UNKNOWN, STATUS_OK: PRIORITY_OK, } HELP_STATUSES = "Possible variants: {statuses}".format( statuses=", ".join(EXIT_CODES.keys()) ) def __init__(self): """ Get command line args. """ self.options = self._get_options() # type: ignore def _get_options(self): """ Parse commandline options arguments. :return: parsed command line arguments :rtype: Namespace """ parser = ArgumentParser( description="Check supervisord programs status Nagios plugin" ) parser.add_argument( "-s", "--server", action="store", dest="server", type=str, default="", metavar="SERVER", help="server name, IP address or unix socket path", ) parser.add_argument( "-p", "--port", action="store", type=int, dest="port", default=9001, metavar="PORT", help="port number", ) parser.add_argument( "-P", "--programs", action="store", dest="programs", type=str, default="", metavar="PROGRAMS", help="comma separated programs list, or empty for all programs in supervisord response", # noqa: E501 ) parser.add_argument( "-u", "--username", action="store", dest="username", type=str, default="", metavar="USERNAME", help="supervisord user", ) parser.add_argument( "-S", "--password", action="store", dest="password", type=str, default="", metavar="PASSWORD", help="supervisord user password", ) parser.add_argument( "--stopped-state-exit-code", action="store", dest="stopped_state_exit_code", type=str, choices=self.EXIT_CODES.keys(), default=self.STATUS_OK, metavar="STOPPED_STATE_EXIT_CODE", help="stopped state exit code. {statuses}".format( statuses=self.HELP_STATUSES ), ) parser.add_argument( "--starting-state-exit-code", action="store", dest="starting_state_exit_code", type=str, choices=self.EXIT_CODES.keys(), default=self.STATUS_WARNING, metavar="STARTING_STATE_EXIT_CODE", help="starting state exit code. {statuses}".format( statuses=self.HELP_STATUSES ), ) parser.add_argument( "--network-errors-exit-code", action="store", dest="network_errors_exit_code", type=str, choices=self.EXIT_CODES.keys(), default=self.STATUS_UNKNOWN, metavar="NETWORK_ERRORS_EXIT_CODE", help="network errors exit code. {statuses}".format( statuses=self.HELP_STATUSES ), ) parser.add_argument( "--no-programs-defined-exit-code", action="store", dest="no_programs_defined_exit_code", type=str, choices=self.EXIT_CODES.keys(), default=self.STATUS_UNKNOWN, metavar="NO_PROGRAMS_DEFINED_EXIT_CODE", help="no programs defined exit code. {statuses}".format( statuses=self.HELP_STATUSES ), ) parser.add_argument( "-q", "--quiet", action="store_true", default=False, dest="quiet", help="be quiet", ) parser.add_argument( "-v", "--version", action="version", version="{version}".format(version=__version__), ) options = parser.parse_args() # update stopped state value from command line argument self.STATE_TO_TEMPLATE[self.STATE_STOPPED] = options.stopped_state_exit_code # update starting state value from command line argument self.STATE_TO_TEMPLATE[self.STATE_STARTING] = options.starting_state_exit_code # check mandatory command line options supplied if not options.server: parser.error(message="Required server address option missing") if options.username and not options.password: parser.error(message="Required supervisord user password missing") return options def _get_connection_uri(self, tpl): """ Creates server connection URI formatted connection string. :param tpl: connection string template name :type tpl: str :return: server connection URI formatted connection string :rtype: str """ payload = { "username": self.options.username, "password": self.options.password, "server": self.options.server, "port": self.options.port, } return self.URI_TEMPLATES[tpl].format(**payload) def _get_connection(self): """ Creates and return connection to supervisord. :return: connection to supervisord :rtype: ServerProxy """ if self.options.server.startswith("/") and stat.S_ISSOCK( os.stat(self.options.server).st_mode ): # communicate with server via unix socket # (check is server address is path and path is unix socket) try: import supervisor.xmlrpc except ImportError as error: # noqa: B014 sys.stdout.write( "ERROR: Couldn't load module. {error}\n".format(error=error) ) sys.stdout.write( "ERROR: Unix socket support not available! Please install nagios-check-supervisord with unix socket support: 'nagios-check-supervisord[unix-socket-support]' or install 'supervisor' separately.\n" # noqa: E501 ) sys.exit(3) if all([self.options.username, self.options.password]): # with auth connection = xmlrpclib.ServerProxy( uri="https://", transport=supervisor.xmlrpc.SupervisorTransport( self.options.username, self.options.password, serverurl=self._get_connection_uri(tpl=self.URI_TPL_SOCKET), # type: ignore # noqa: E501 ), ) else: connection = xmlrpclib.ServerProxy( uri="https://", transport=supervisor.xmlrpc.SupervisorTransport( username=None, password=None, serverurl=self._get_connection_uri(tpl=self.URI_TPL_SOCKET), # type: ignore # noqa: E501 ), ) else: # communicate with server via http if all([self.options.username, self.options.password]): # with auth connection = xmlrpclib.Server( uri=self._get_connection_uri(tpl=self.URI_TPL_HTTP_AUTH) # type: ignore # noqa: E501 ) else: connection = xmlrpclib.Server( uri=self._get_connection_uri(tpl=self.URI_TPL_HTTP) # type: ignore # noqa: E501 ) return connection def _get_data(self): """ Get and return data from supervisord. :return: data from supervisord :rtype: List[Dict[str, Union[str, int]]] """ try: connection = self._get_connection() # type: ignore # noqa: E501 return connection.supervisor.getAllProcessInfo() except Exception as error: if not self.options.quiet: sys.stdout.write( "ERROR: Server communication problem. {error}\n".format(error=error) ) sys.exit( self.EXIT_CODES.get( self.options.network_errors_exit_code, self.STATUS_UNKNOWN ) ) def _get_status(self, data): """ Create main status. :param data: devices states info :type data: List[Dict[str, Union[str, int]]] :return: main check status :rtype: str """ # for multiple check need to get main status by priority priority = ( min( # type: ignore # noqa: C407 [ self.OUTPUT_TEMPLATES[self.STATE_TO_TEMPLATE[info["statename"]]][ "priority" ] for info in data ] ) if data else self.STATUS_TO_PRIORITY[self.options.no_programs_defined_exit_code] ) status = self.PRIORITY_TO_STATUS.get(priority, self.PRIORITY_CRITICAL) # type: ignore # noqa: E501 return status def _get_code(self, status): """ Create exit code. :param status: main check status :type status: str :return: exit code :rtype: int """ # create exit code (unknown if something happened wrong) return self.EXIT_CODES.get(status, self.STATUS_UNKNOWN) def _get_output(self, data, status): """ Create Nagios and human readable supervisord statuses. :param data: supervisord XML-RPC call result :type data: List[Dict[str, Union[str, int]]] :param status: main check status :type status: str :return: human readable supervisord statuses :rtype: str """ states = OrderedDict() programs = ( map( lambda program: program.strip(), self.options.programs.strip().split(","), ) if self.options.programs else map(lambda x: x["name"], data) ) for program in programs: try: info = min(filter(lambda x: x["name"] == program, data)) states.update( { program: { "name": program, "template": self.STATE_TO_TEMPLATE[info["statename"]], "status": info["spawnerr"] if info["spawnerr"] else info["statename"], } } ) except ValueError: states.update( {program: {"name": program, "template": "unknown", "status": ""}} ) output = ( ", ".join( [ str( self.OUTPUT_TEMPLATES[states[program]["template"]]["text"] ).format(**states[program]) for program in sorted( states.keys(), key=lambda item: self.OUTPUT_TEMPLATES[ # type: ignore states[item]["template"] ]["priority"], ) ] ) if len(states) else "No program configured/found" ) # return full status string with main status # for multiple programs and all programs states return "{status}: {output}\n".format( **{"status": status.upper(), "output": output} ) def check(self): """ Get data from server and create plugin output. :return: plugin output and exit code :rtype: Tuple[str, int] """ data = self._get_data() # type: ignore status = self._get_status(data=data) # type: ignore code = self._get_code(status=status) # type: ignore return self._get_output(data=data, status=status), code # type: ignore def main(): """ Program main. """ checker = CheckSupervisord() # type: ignore output, code = checker.check() # type: ignore sys.stdout.write(output) sys.exit(code) if __name__ == "__main__": main() # type: ignore