Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bsa_miner
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nazarf
bsa_miner
Commits
0a5d8d83
Commit
0a5d8d83
authored
Jul 25, 2023
by
nazarf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix send notification
parent
1908a7ed
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
26 deletions
+28
-26
miners.rake
lib/tasks/miners.rake
+28
-26
No files found.
lib/tasks/miners.rake
View file @
0a5d8d83
namespace
:miners
do
namespace
:miners
do
task
miners_status_notification: :environment
do
require
'logger'
require
'telegram_bot'
TELEGRAM_BOT_TOKEN
=
"5829604433:AAG5CeFBygU1lvV5oeeDyT_v0CqzjAWCNlY"
CHAT_ID
=
"-1001516309000"
bot
=
TelegramBot
.
new
(
token:
TELEGRAM_BOT_TOKEN
,
logger:
Logger
.
new
(
STDOUT
))
channel
=
TelegramBot
::
Channel
.
new
(
id:
CHAT_ID
)
message
=
TelegramBot
::
OutMessage
.
new
message
.
chat
=
channel
miss_miner
=
Miner
.
where
(
status:
Miner
::
STATUSES
[
0
])
restart_miner
=
Miner
.
where
(
status:
Miner
::
STATUSES
[
2
])
active_miner
=
Miner
.
where
(
status:
Miner
::
STATUSES
[
1
])
message
.
text
=
"Date:
#{
DateTime
.
now
.
strftime
(
"%d.%m.%Y %H:%M"
)
}
\n
Total:
#{
Miner
.
count
}
\n
Active:
#{
active_miner
.
count
}
\n
Restart:
#{
restart_miner
.
count
}
\n
#{
restart_miner
.
map
(
&
:name
).
join
(
', '
)
}
\n
Miss:
#{
miss_miner
.
count
}
\n
#{
miss_miner
.
map
(
&
:name
).
join
(
', '
)
}
"
message
.
send_with
(
bot
)
end
task
check_active_list: :environment
do
task
check_active_list: :environment
do
url
=
'http://149.28.218.119:4243/active_list'
url
=
'http://149.28.218.119:4243/active_list'
response
=
HTTParty
.
get
(
url
)
response
=
HTTParty
.
get
(
url
)
...
@@ -133,30 +161,4 @@ namespace :miners do
...
@@ -133,30 +161,4 @@ namespace :miners do
end
end
end
end
end
end
end
task
miners_status_notification: :environment
do
require
'logger'
require
'telegram_bot'
TELEGRAM_BOT_TOKEN
=
"5829604433:AAG5CeFBygU1lvV5oeeDyT_v0CqzjAWCNlY"
CHAT_ID
=
"-1001516309000"
bot
=
TelegramBot
.
new
(
token:
TELEGRAM_BOT_TOKEN
,
logger:
Logger
.
new
(
STDOUT
))
channel
=
TelegramBot
::
Channel
.
new
(
id:
CHAT_ID
)
message
=
TelegramBot
::
OutMessage
.
new
message
.
chat
=
channel
miss_miner
=
Miner
.
where
(
status:
Miner
::
STATUSES
[
0
])
restart_miner
=
Miner
.
where
(
status:
Miner
::
STATUSES
[
1
])
active_miner
=
Miner
.
where
(
status:
Miner
::
STATUSES
[
2
])
message
.
text
=
"Date:
#{
DateTime
.
now
.
strftime
(
"%d.%m.%Y %H:%M"
)
}
\n
Total:
#{
Miner
.
count
}
\n
Active:
#{
active_miner
.
count
}
\n
Restart:
#{
restart_miner
.
count
}
\n
Miss:
#{
miss_miner
.
count
}
\n
#{
miss_miner
.
map
(
&
:name
).
join
(
', '
)
}
"
message
.
send_with
(
bot
)
end
end
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment