Skip to content

Commit

Permalink
Merge pull request #6 from LaFermeDuMineur/init/hiveos_worker
Browse files Browse the repository at this point in the history
Init/hiveos worker
  • Loading branch information
Tocard authored Mar 15, 2022
2 parents 1c8e654 + bec47b0 commit 55db8eb
Show file tree
Hide file tree
Showing 11 changed files with 540 additions and 295 deletions.
Binary file modified 2miner-monitoring
Binary file not shown.
24 changes: 12 additions & 12 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,36 +17,36 @@ type WalletToWatch struct {
type Config struct {
ElasticsearchUser string `yaml:"elasticsearch_user"`
ElasticsearchPassword string `yaml:"elasticsearch_password"`
ElasticsearchHosts []string `yaml:"elasticsearch_hosts"`
ElasticsearchPort int `yaml:"elasticsearch_port"`
APITokenEtherscan string `yaml:"api_token_etherscan"`
LogLevel string `yaml:"log_level"`
CaPath string `yaml:"ca_path"`
TwoMinersURL string `yaml:"2miners_url"`
RedisHost string `yaml:"redis_host"`
RedisPort int `yaml:"redis_port"`
RedisPassword string `yaml:"redis_password"`
RedisShortLifetime int `yaml:"redis_short_lifetime"`
RedisMidLifetime int `yaml:"redis_mid_lifetime"`
RedisLongLifetime int `yaml:"redis_long_lifetime"`
Factor float64 `yaml:"factor"`
EthFactor float64 `yaml:"ether_factor"`
GazFactor float64 `yaml:"gaz_factor"`
MinerListing string `yaml:"miner_listing"`
APIPort int `yaml:"api_port"`
APIFrontPort int `yaml:"api_front_port"`
APILogFile string `yaml:"api_log_file"`
APIUsername string `yaml:"api_username"`
APIPassword string `yaml:"api_password"`
APIAdress string `yaml:"api_adress"`
AdressFilePath string `yaml:"adress_file_path"`
LockPath string `yaml:"lock_path"`
CardsConfigFile string `yaml:"cards_config_file"`
CoinList []string `yaml:"coin_list"`
HiveosUrl string `yaml:"hiveos_api_url"`
MinotorHiveOsUser string `yaml:"hiveos_minotor_user"`
MinotorHiveOsPass string `yaml:"hiveos_minotor_password"`
MinotorHiveosToken string `yaml:"hiveos_minotor_token"`
CoinList []string `yaml:"coin_list"`
ElasticsearchHosts []string `yaml:"elasticsearch_hosts"`
ElasticsearchPort int `yaml:"elasticsearch_port"`
RedisPort int `yaml:"redis_port"`
RedisShortLifetime int `yaml:"redis_short_lifetime"`
RedisMidLifetime int `yaml:"redis_mid_lifetime"`
RedisLongLifetime int `yaml:"redis_long_lifetime"`
APIPort int `yaml:"api_port"`
APIFrontPort int `yaml:"api_front_port"`
Factor float64 `yaml:"factor"`
EthFactor float64 `yaml:"ether_factor"`
GazFactor float64 `yaml:"gaz_factor"`
}

func LoadYamlConfig(ConfigFilePath string) {
Expand Down
233 changes: 9 additions & 224 deletions data/hiveos.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
package data

var HiveOsController *HiveosControl

type HiveosControl struct {
Id []int
}

type EsMinimal struct {
Timestamp string `json:"@timestamp"`
HiveOwner string `json:"hive_owner"`
Expand Down Expand Up @@ -143,228 +149,7 @@ type Farm struct {
Tags []interface{} `json:"tags"`
}

type Overclock struct {
Aggressive bool `json:"aggressive"`
LogoOff bool `json:"logo_off"`
MemMvdd string `json:"mem_mvdd"`
CoreVddc string `json:"core_vddc"`
FanSpeed string `json:"fan_speed"`
MemClock string `json:"mem_clock"`
MemVddci string `json:"mem_vddci"`
CoreClock string `json:"core_clock"`
PowerLimit string `json:"power_limit"`
CoreState string `json:"core_state"`
Tweakers struct {
Amdmemtweak []struct {
Gpus []int `json:"gpus"`
Params struct {
Ref string `json:"ref"`
} `json:"params"`
} `json:"amdmemtweak"`
} `json:"tweakers"`
}

type Overclocks struct {
Overclock `json:"amd,nvidia"`
}

type FlightSheet struct {
ID int `json:"id"`
FarmID int `json:"farm_id"`
Name string `json:"name"`
Items []struct {
Coin string `json:"coin"`
Pool string `json:"pool"`
Miner string `json:"miner"`
MinerAlt string `json:"miner_alt,omitempty"`
WalID int `json:"wal_id"`
} `json:"items"`
}

type EsFlightSheet struct {
EsMinimal
FarmID int `json:"farm_id"`
Name string `json:"name"`
Coin string `json:"coin"`
Pool string `json:"pool"`
Miner string `json:"miner"`
MinerAlt string `json:"miner_alt,omitempty"`
WalID int `json:"wal_id"`
}

type Workers struct {
Data []struct {
EsMinimal
ID int `json:"id"`
FarmID int `json:"farm_id"`
Name string `json:"name"`
Active bool `json:"active"`
SystemType string `json:"system_type"`
NeedsUpgrade bool `json:"needs_upgrade"`
Versions struct {
Hive string `json:"hive"`
Kernel string `json:"kernel"`
AmdDriver string `json:"amd_driver"`
NvidiaDriver string `json:"nvidia_driver"`
} `json:"versions"`
Stats struct {
Online bool `json:"online"`
BootTime int `json:"boot_time"`
StatsTime int `json:"stats_time"`
GpusOnline int `json:"gpus_online"`
GpusOffline int `json:"gpus_offline"`
GpusOverheated int `json:"gpus_overheated"`
CpusOnline int `json:"cpus_online"`
MinerStartTime int `json:"miner_start_time"`
PowerDraw int `json:"power_draw"`
Invalid bool `json:"invalid"`
LowAsr bool `json:"low_asr"`
Overloaded bool `json:"overloaded"`
Overheated bool `json:"overheated"`
Problems []string `json:"problems"`
} `json:"stats"`
HardwareInfo struct {
Motherboard struct {
Manufacturer string `json:"manufacturer"`
Model string `json:"model"`
Bios string `json:"bios"`
} `json:"motherboard"`
CPU struct {
ID string `json:"id"`
Model string `json:"model"`
Cores int `json:"cores"`
Aes bool `json:"aes"`
} `json:"cpu"`
Disk struct {
Model string `json:"model"`
} `json:"disk"`
} `json:"hardware_info"`
HardwareStats struct {
Df string `json:"df"`
Cpuavg []float64 `json:"cpuavg"`
Cputemp []int `json:"cputemp"`
Memory struct {
Total int `json:"total"`
Free int `json:"free"`
} `json:"memory"`
CPUCores int `json:"cpu_cores"`
} `json:"hardware_stats"`
UnitsCount int `json:"units_count"`
RedTemp int `json:"red_temp"`
RedFan int `json:"red_fan"`
RedAsr int `json:"red_asr"`
RedLa int `json:"red_la"`
RedCPUTemp int `json:"red_cpu_temp"`
RedMemTemp int `json:"red_mem_temp"`
HasAmd bool `json:"has_amd"`
HasNvidia bool `json:"has_nvidia"`
FlightSheet `json:"flight_sheet"`
Overclocks `json:"overclock"`
MinersSummary struct {
Hashrates []struct {
Miner string `json:"miner"`
Ver string `json:"ver"`
Algo string `json:"algo"`
Coin string `json:"coin"`
Hash float64 `json:"hash"`
Shares struct {
Accepted int `json:"accepted"`
Rejected int `json:"rejected"`
Invalid int `json:"invalid"`
Total int `json:"total"`
Ratio int `json:"ratio"`
} `json:"shares,omitempty"`
} `json:"hashrates"`
} `json:"miners_summary"`
MinersStats struct {
Hashrates []struct {
Miner string `json:"miner"`
Algo string `json:"algo"`
Coin string `json:"coin"`
Hashes []float64 `json:"hashes"`
Temps []int `json:"temps"`
Fans []int `json:"fans,omitempty"`
BusNumbers []int `json:"bus_numbers,omitempty"`
} `json:"hashrates"`
} `json:"miners_stats"`
Watchdog struct {
Enabled bool `json:"enabled"`
RestartTimeout int `json:"restart_timeout"`
RebootTimeout int `json:"reboot_timeout"`
CheckPower bool `json:"check_power"`
CheckConnection bool `json:"check_connection"`
PowerAction string `json:"power_action"`
CheckGpu bool `json:"check_gpu"`
Type string `json:"type"`
Options struct {
ByMiner []interface{} `json:"by_miner"`
ByAlgo []struct {
Algo string `json:"algo"`
Minhash float64 `json:"minhash"`
Units string `json:"units"`
} `json:"by_algo"`
} `json:"options"`
} `json:"watchdog,omitempty"`
GpuSummary struct {
Gpus []struct {
Name string `json:"name"`
Amount int `json:"amount"`
} `json:"gpus"`
MaxTemp int `json:"max_temp"`
MaxFan int `json:"max_fan"`
} `json:"gpu_summary"`
GpuStats []struct {
BusID string `json:"bus_id"`
BusNumber int `json:"bus_number"`
BusNum int `json:"bus_num"`
Temp int `json:"temp"`
Fan int `json:"fan"`
Power int `json:"power"`
Memtemp int `json:"memtemp"`
Hash float64 `json:"hash"`
} `json:"gpu_stats"`
GpuInfo []struct {
BusID string `json:"bus_id"`
BusNumber int `json:"bus_number"`
Index int `json:"index"`
Brand string `json:"brand"`
Model string `json:"model"`
ShortName string `json:"short_name"`
Details struct {
Mem string `json:"mem"`
MemGb int `json:"mem_gb"`
MemType string `json:"mem_type"`
MemOem string `json:"mem_oem"`
Vbios string `json:"vbios"`
Subvendor string `json:"subvendor"`
Oem string `json:"oem"`
} `json:"details"`
} `json:"gpu_info"`
Options struct {
MaintenanceMode int `json:"maintenance_mode"`
} `json:"options,omitempty"`
Autofan struct {
Enabled bool `json:"enabled"`
TargetTemp int `json:"target_temp"`
TargetMemTemp int `json:"target_mem_temp"`
MinFan int `json:"min_fan"`
MaxFan int `json:"max_fan"`
CriticalTemp int `json:"critical_temp"`
NoAmd bool `json:"no_amd"`
RebootOnErrors bool `json:"reboot_on_errors"`
SmartMode bool `json:"smart_mode"`
} `json:"autofan,omitempty"`
} `json:"data"`
Tags []struct {
EsMinimal
ID int `json:"id"`
TypeID int `json:"type_id"`
FarmID int `json:"farm_id"`
UserID interface{} `json:"user_id"`
Name string `json:"name"`
Color int `json:"color"`
IsAuto bool `json:"is_auto"`
WorkersCount int `json:"workers_count"`
FarmsCount interface{} `json:"farms_count"`
} `json:"tags"`
func InitHiveosControl() {
HiveosTmpControl := HiveosControl{}
HiveOsController = &HiveosTmpControl
}
Loading

0 comments on commit 55db8eb

Please sign in to comment.