Advanced Web Server Manager
Complete File Manager & Terminal - Standalone Version
By Sid Gifari | Gifari Industries
Current path:
/
/
usr
/
local
/
lib
/
python3.6
/
site-packages
/
nixstatsagent
/
__pycache__
✏️
Editing: nixstatsagent.cpython-36.pyc
3 ��`_ � @ s� d dl mZ d dlZd dlZejdkrzyd dlmZ W n ek rN eZY nX d dl Z d dl Zd dlm Z mZ d dlZn(d dlZd dlZd dlZd dl m Z mZ d dlZd dlZyd dlZW n ek r� d dlZY nX d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dl Z y0d dl!m"Z"m#Z# d dl$m%Z%m&Z& d dl'm(Z( W nB ek �r� d d l"m"Z" d d l m#Z# d dl)m%Z%m&Z&m(Z( Y nX dZ*ej+j,ej+j-e.��Z/ej+j0d d�ej+j0d d�ej+j0ej+j,e/�d�ej+j0ej+j,e/�d�ej+j-d�ej+j-d�fZ1ej2dk�r8ej+j0e/d�ej+j0e/d�fZ1dd� Z3d dd�Z4dd� Z5g fdd�Z6G dd� d�Z7dd� Z8e9dk�r�e8� dS )!� )�print_functionN� )� basestring)�Queue�Empty)�urlparse� urlencode)�urlopen�Request)� HTTPError)r )r )r r r z1.2.17z/etcznixstats.iniznixstats-token.ini�win32c C sV t dd�} | jjdd�}| jdd�}djdt d d j|� d| d| jjdd � f�S )z� Return string with info about nixstatsagent: - version - plugins enabled - absolute path to plugin directory - server id from configuration file T)�dry_instance�agent�plugins�enabled)�state� zVersion: %szPlugins enabled: %sz, zPlugins directory: %sz Server: %s�server)�Agent�config�get�_get_plugins�join�__version__)r �plugins_pathZplugins_enabled� r �E/usr/local/lib/python3.6/site-packages/nixstatsagent/nixstatsagent.py�infoB s r �httpsc C s. t jd }tdd�}tt j�dkr.t jd }ntjjtd�}tt j�dkrVt jd }nd}d|kr�|jd�d }|jd�d }njytj � d }W n t k r� tj� }Y nX t | d |jjdd� d t|||d��jd�d�j� j� }t|�dk�rtd| � t|d�jd||f � ntd| � d S )N� T)r � znixstats-token.inir � �_r z://�data�api_hostz /hello.php)�user�hostname� unique_idzutf-8)r# � zGot server_id: %s�wz[DEFAULT] user=%s server=%s z Could not retrieve server_id: %s)�sys�argvr �len�os�pathr �__FILEABSDIRNAME__�split�uname�AttributeError�socket�getfqdnr r r r �encode�read�decode�print�open�write)�protoZuser_idr Ztoken_filenamer'