Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
check_nginx_status
Manage
Activity
Members
Labels
Plan
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Perun
deployment
ProxyIdP
check_nginx_status
Commits
6a6fdaf8
Commit
6a6fdaf8
authored
6 years ago
by
lazydog
Browse files
Options
Downloads
Patches
Plain Diff
shodan query credits now the right api-endpoint
parent
ff38153b
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Readme.md
+1
-1
1 addition, 1 deletion
Readme.md
cachet_shodan_credits
+2
-2
2 additions, 2 deletions
cachet_shodan_credits
check_shodan_credits
+37
-9
37 additions, 9 deletions
check_shodan_credits
with
40 additions
and
12 deletions
Readme.md
+
1
−
1
View file @
6a6fdaf8
...
...
@@ -19,7 +19,7 @@ execute $check_plugin -h
-
check_selenium - extract runtime/status-values from selenium-tests
-
check_redis - checks and monitors values on a redis_server
-
check_shodan_credits - checks how many credits available on a certain account
-
cachet_shodan_credits - sends status-report to ca
h
cet-metric
-
cachet_shodan_credits - sends status-report to cac
h
et-metric
...
...
This diff is collapsed.
Click to expand it.
cachet_shodan_credits
+
2
−
2
View file @
6a6fdaf8
...
...
@@ -82,7 +82,7 @@ ERROR you need to give all values (k,c,m,u)
url
=
"
https://api.shodan.io/a
ccount/profile
?key=%s
"
%
k
url
=
"
https://api.shodan.io/a
pi-info
?key=%s
"
%
k
shodan_answer
=
requests
.
get
(
url
)
...
...
@@ -93,7 +93,7 @@ if shodan_answer.status_code != 200:
sys
.
exit
(
2
)
sj
=
json
.
loads
(
shodan_answer
.
text
)
creditz
=
sj
[
"
credits
"
]
creditz
=
sj
[
"
query_
credits
"
]
url
=
"
%s/api/v1/metrics/%s/points
"
%
(
u
,
m
)
headers
=
{
...
...
This diff is collapsed.
Click to expand it.
check_shodan_credits
+
37
−
9
View file @
6a6fdaf8
...
...
@@ -10,6 +10,34 @@
# - python-requests, python-simplejson
#
#
#
# checkcommands.cfg
#
#
#
#~ define command {
#~ command_name check_shodan_credits
#~ command_line $USER1$/check_shodan_credits -k $ARG1$ -D $ARG2$ -w $ARG3$ -c $ARG4$
#~ }
#~ services.cfg
#~ #
#~ #
#~ define service {
#~ hostname EXTERNAL_API
#~ service_description check_shodan_credits_dev
#~ check_command check_shodan_credits!DEV!SHODAN_API_KEY!10!2
#~ use cysmo-service
#~ register 1
#~ notifications_enabled 1
#~ normal_check_interval 10
#~ retry_check_interval 5
#~ max_check_attempts 3
#~ }
...
...
@@ -100,7 +128,7 @@ ERROR you need to give an API-key
url
=
"
https://api.shodan.io/a
ccount/profile
?key=%s
"
%
k
url
=
"
https://api.shodan.io/a
pi-info
?key=%s
"
%
k
shodan_answer
=
requests
.
get
(
url
)
if
shodan_answer
.
status_code
!=
200
:
...
...
@@ -111,23 +139,23 @@ if shodan_answer.status_code != 200:
return_exit
(
return_d
)
sj
=
json
.
loads
(
shodan_answer
.
text
)
if
sj
[
"
credits
"
]
<
c
:
if
sj
[
"
query_
credits
"
]
<
c
:
return_d
[
"
status
"
]
=
"
Critical
"
return_d
[
"
exit
"
]
=
2
return_d
[
"
text
"
]
=
"
Critical, Credits: %s
"
%
sj
[
"
credits
"
]
return_d
[
"
perfdata
"
]
=
"
| credits: %s;
"
%
sj
[
"
credits
"
]
return_d
[
"
text
"
]
=
"
Critical, Credits: %s
"
%
sj
[
"
query_
credits
"
]
return_d
[
"
perfdata
"
]
=
"
| credits: %s;
"
%
sj
[
"
query_
credits
"
]
elif
sj
[
"
credits
"
]
<
w
:
elif
sj
[
"
query_
credits
"
]
<
w
:
return_d
[
"
status
"
]
=
"
Warning
"
return_d
[
"
exit
"
]
=
1
return_d
[
"
text
"
]
=
"
Warning, Credits: %s
"
%
sj
[
"
credits
"
]
return_d
[
"
perfdata
"
]
=
"
| credits: %s;
"
%
sj
[
"
credits
"
]
return_d
[
"
text
"
]
=
"
Warning, Credits: %s
"
%
sj
[
"
query_
credits
"
]
return_d
[
"
perfdata
"
]
=
"
| credits: %s;
"
%
sj
[
"
query_
credits
"
]
else
:
return_d
[
"
status
"
]
=
"
Ok
"
return_d
[
"
exit
"
]
=
0
return_d
[
"
text
"
]
=
"
All OK, Credits: %s
"
%
sj
[
"
credits
"
]
return_d
[
"
perfdata
"
]
=
"
| credits: %s;
"
%
sj
[
"
credits
"
]
return_d
[
"
text
"
]
=
"
All OK, Credits: %s
"
%
sj
[
"
query_
credits
"
]
return_d
[
"
perfdata
"
]
=
"
| credits: %s;
"
%
sj
[
"
query_
credits
"
]
return_exit
(
return_d
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment