(Resolved) enable/disable thold from command line?
Moderators: Developers, Moderators
- _raindrop18
- Cacti User
- Posts: 194
- Joined: Thu Jan 29, 2009 5:52 pm
- Location: US
(Resolved) enable/disable thold from command line?
Hello All,
thold has Weekend exemptions but not time base like turn off at non business hrs. I have seen this question on the forum all the way back 2006 but didn't see this future yet. may be the developer busy on his life. is that possible enable and disable thold from command line? run php command to start and stop thold?if that work I can setup cronjob to run the command to stop and start. currently manually I am enable and disable from the setting every night not to send any alert. I want to do that option automatically. till this future added. thanks in advance for any suggestion.
thold has Weekend exemptions but not time base like turn off at non business hrs. I have seen this question on the forum all the way back 2006 but didn't see this future yet. may be the developer busy on his life. is that possible enable and disable thold from command line? run php command to start and stop thold?if that work I can setup cronjob to run the command to stop and start. currently manually I am enable and disable from the setting every night not to send any alert. I want to do that option automatically. till this future added. thanks in advance for any suggestion.
Last edited by _raindrop18 on Tue Aug 10, 2010 9:01 am, edited 2 times in total.
In rough method for Cacti 0.8.7e (at your own risk):
To disable
To enable
That simulates clicking 'Disable all thresholds' checkbox in Alerting/Thold tab.
To disable
Code: Select all
% mysql -ucactiuser -pcactiuser -e "UPDATE settings SET value='on' WHERE name='thold_disable_all'" cacti
Code: Select all
% mysql -ucactiuser -pcactiuser -e "UPDATE settings SET value='' WHERE name='thold_disable_all'" cacti
- _raindrop18
- Cacti User
- Posts: 194
- Joined: Thu Jan 29, 2009 5:52 pm
- Location: US
- _raindrop18
- Cacti User
- Posts: 194
- Joined: Thu Jan 29, 2009 5:52 pm
- Location: US
there is no error (on sql or cacti log). the command execute without the problem but nothing change on the hold. yes I did use my sql user name and password. because of the command execute properly. I assume it was
working and waited for hours but thold continue working. I did other way around too. disable from GUI then try to start by using your command to enable but stayed as disable. I am really wondering the command you gave me executed properly but why not do nothing on the thold. thanks again!
working and waited for hours but thold continue working. I did other way around too. disable from GUI then try to start by using your command to enable but stayed as disable. I am really wondering the command you gave me executed properly but why not do nothing on the thold. thanks again!
Hmm..
Try this command before and after enabling/disabling from CLI and GUI:
% mysql -uusername -ppassword -e "SELECT * FROM settings WHERE name='thold_disable_all'" cacti
Does the value change?
I got a idea from these part of thold 0.4.1:
Try this command before and after enabling/disabling from CLI and GUI:
% mysql -uusername -ppassword -e "SELECT * FROM settings WHERE name='thold_disable_all'" cacti
Does the value change?
I got a idea from these part of thold 0.4.1:
Code: Select all
[thold_functions.php]
432: // Do not proceed if we have chosen to globally disable all alerts
433: if (read_config_option('thold_disable_all') == 'on') {
434: return;
435: }
- _raindrop18
- Cacti User
- Posts: 194
- Joined: Thu Jan 29, 2009 5:52 pm
- Location: US
here is the out put on cli (it's say disabled) but thold keep running not bothered
# ./mysql -ucacti -pcacti -e "SELECT * FROM settings WHERE name='thold_disable_all'" cacti
+-------------------+-------+
| name | value |
+-------------------+-------+
| thold_disable_all | |
+-------------------+-------+
so, the sql command working but not affecting the the apps. operation. may be something else should run along with command. because very interested the sql said disabled but how thold keep running? weird.
I am really admire your effort. thanks
# ./mysql -ucacti -pcacti -e "SELECT * FROM settings WHERE name='thold_disable_all'" cacti
+-------------------+-------+
| name | value |
+-------------------+-------+
| thold_disable_all | |
+-------------------+-------+
so, the sql command working but not affecting the the apps. operation. may be something else should run along with command. because very interested the sql said disabled but how thold keep running? weird.
I am really admire your effort. thanks
When you checked 'Disable all thresholds' in 'Alerting/Thold' tab, is this also the same output ?_raindrop18 wrote:# ./mysql -ucacti -pcacti -e "SELECT * FROM settings WHERE name='thold_disable_all'" cacti
+-------------------+-------+
| name | value |
+-------------------+-------+
| thold_disable_all | |
+-------------------+-------+
If you can manually set the value of 'thold_disable_all' by any other ways (via SQL Buddy, phpMyAdmin, etc.), I hope thold's behavior will be changed..
- _raindrop18
- Cacti User
- Posts: 194
- Joined: Thu Jan 29, 2009 5:52 pm
- Location: US
When you checked 'Disable all thresholds' in 'Alerting/Thold' tab, is this also the same output ?
which output? when I checked manually on setting/thold. the thold disabled properly and I didn't get any alert. I am agree it's should work if the sql result say " disable' the thold should disable. but not so far. have you used this command on your system? and is working? thanks again!
which output? when I checked manually on setting/thold. the thold disabled properly and I didn't get any alert. I am agree it's should work if the sql result say " disable' the thold should disable. but not so far. have you used this command on your system? and is working? thanks again!
> which output?
Output that MySQL select command shows.
My cacti is 0.8.7e + PIA 2.4 + thold 0.4.1.
When I clicked the checkbox 'Disable all thresholds' in Settings > Alerting/Thold tab and saved,
the database changed as follows:
And when checkbox is turned off, thold_disable_all is changed to blank.
In addition, paradoxically, when I set 'on' to thold_disable_all, then the checkbox is turned 'checked' in GUI.
(and I set blank value to to thold_disable_all, the checkbox is turned 'unchecked' in GUI)
MySQL update command that I posted first simply emulates this action via CLI...
Both via CLI and GUI, thold's behavior is disabled and enabled properly in my cacti.
Output that MySQL select command shows.
My cacti is 0.8.7e + PIA 2.4 + thold 0.4.1.
When I clicked the checkbox 'Disable all thresholds' in Settings > Alerting/Thold tab and saved,
the database changed as follows:
Code: Select all
% mysql -ucactiuser -pcactiuser -e "SELECT * FROM settings WHERE name='thold_disable_all'" cacti
+-------------------+-------+
| name | value |
+-------------------+-------+
| thold_disable_all | on |
+-------------------+-------+
In addition, paradoxically, when I set 'on' to thold_disable_all, then the checkbox is turned 'checked' in GUI.
(and I set blank value to to thold_disable_all, the checkbox is turned 'unchecked' in GUI)
MySQL update command that I posted first simply emulates this action via CLI...
Both via CLI and GUI, thold's behavior is disabled and enabled properly in my cacti.
- _raindrop18
- Cacti User
- Posts: 194
- Joined: Thu Jan 29, 2009 5:52 pm
- Location: US
I have tested on 2 cacti server the result is the same. here is what happen,
1st - disable (checked) thold on "GUI" run the sql command
./mysql -ucacti2 -pcacti2 -e "SELECT * FROM settings WHERE name='thold_disable_all'" cacti
+-------------------+-------+
| name | value |
+-------------------+-------+
| thold_disable_all | on |
+-------------------+-------+
2nd - enable (unchecked) thold on "GUI" runthe sql command
./mysql -ucacti2 -pcacti2 -e "SELECT * FROM settings WHERE name='thold_disable_all'" cacti
+-------------------+-------+
| name | value |
+-------------------+-------+
| thold_disable_all | |
+-------------------+-------+
so everything is working as you said now, let me show you what happen when I run from "CLI
##############################################
1st - disable thold from " cli"
./mysql -ucacti2 -pcacti2 -e "SELECT * FROM settings WHERE name='thold_disable_all'" cacti
result check=
./mysql -ucacti2 -pcacti2 -e "SELECT * FROM settings WHERE name='thold_disable_all'" cacti
+-------------------+-------+
| name | value |
+-------------------+-------+
| thold_disable_all | |
+-------------------+-------+
2nd - enable thold from "cli"
./mysql -ucacti2 -pcacti2 -e "SELECT * FROM settings WHERE name='thold_enable_all'" cacti
result check =
./mysql -ucacti2 -pcacti2 -e "SELECT * FROM settings WHERE name='thold_disable_all'" cacti
+-------------------+-------+
| name | value |
+-------------------+-------+
| thold_disable_all | |
+-------------------+-------+
##########################################
do you see any error on my procuder?
both enable and disable didn't change the value. my Cacti setup is 0.8.7e + PIA 2.5 + thold 0.4.1 + mysql 5.0.67 and running on Solaris 10. your system is on windows? or Unix base OS? I am not sure this is even a factor.
Thanks so very much!!
1st - disable (checked) thold on "GUI" run the sql command
./mysql -ucacti2 -pcacti2 -e "SELECT * FROM settings WHERE name='thold_disable_all'" cacti
+-------------------+-------+
| name | value |
+-------------------+-------+
| thold_disable_all | on |
+-------------------+-------+
2nd - enable (unchecked) thold on "GUI" runthe sql command
./mysql -ucacti2 -pcacti2 -e "SELECT * FROM settings WHERE name='thold_disable_all'" cacti
+-------------------+-------+
| name | value |
+-------------------+-------+
| thold_disable_all | |
+-------------------+-------+
so everything is working as you said now, let me show you what happen when I run from "CLI
##############################################
1st - disable thold from " cli"
./mysql -ucacti2 -pcacti2 -e "SELECT * FROM settings WHERE name='thold_disable_all'" cacti
result check=
./mysql -ucacti2 -pcacti2 -e "SELECT * FROM settings WHERE name='thold_disable_all'" cacti
+-------------------+-------+
| name | value |
+-------------------+-------+
| thold_disable_all | |
+-------------------+-------+
2nd - enable thold from "cli"
./mysql -ucacti2 -pcacti2 -e "SELECT * FROM settings WHERE name='thold_enable_all'" cacti
result check =
./mysql -ucacti2 -pcacti2 -e "SELECT * FROM settings WHERE name='thold_disable_all'" cacti
+-------------------+-------+
| name | value |
+-------------------+-------+
| thold_disable_all | |
+-------------------+-------+
##########################################
do you see any error on my procuder?
both enable and disable didn't change the value. my Cacti setup is 0.8.7e + PIA 2.5 + thold 0.4.1 + mysql 5.0.67 and running on Solaris 10. your system is on windows? or Unix base OS? I am not sure this is even a factor.
Thanks so very much!!
Oh...
The command you typed is not correct.
Please, please look again carefully at my first post._raindrop18 wrote:##############################################
1st - disable thold from " cli"
./mysql -ucacti2 -pcacti2 -e "SELECT * FROM settings WHERE name='thold_disable_all'" cacti
--snip--
2nd - enable thold from "cli"
./mysql -ucacti2 -pcacti2 -e "SELECT * FROM settings WHERE name='thold_enable_all'" cacti
--snip--
##########################################
The command you typed is not correct.
- _raindrop18
- Cacti User
- Posts: 194
- Joined: Thu Jan 29, 2009 5:52 pm
- Location: US
oh..shame on me . sorry taking your valuable time!! and thank you so very much about your patient with me!!! it's working perfectly!! you made my day!!!!!
if you don't mind can I ask you one more question since it's hard to get such help! I have looking for long time if any one modify thold to send snmp trap instead or email for threshold breach. have you tried that? one guy on this forum told me he did for thold v3. but didn't find for v4.1.
this is extra question.
once again thousends thakns to you!!!!!
if you don't mind can I ask you one more question since it's hard to get such help! I have looking for long time if any one modify thold to send snmp trap instead or email for threshold breach. have you tried that? one guy on this forum told me he did for thold v3. but didn't find for v4.1.
this is extra question.
once again thousends thakns to you!!!!!
> it's working perfectly!! you made my day!!!!!
I'm glad to hear that.
Many users talk about sending traps from cacti... That is the interesting theme, but I don't have solutions.
How about this post?
I'm glad to hear that.
Ah, this topic.I have looking for long time if any one modify thold to send snmp trap instead or email for threshold breach. have you tried that? one guy on this forum told me he did for thold v3. but didn't find for v4.1.
Many users talk about sending traps from cacti... That is the interesting theme, but I don't have solutions.
How about this post?
- _raindrop18
- Cacti User
- Posts: 194
- Joined: Thu Jan 29, 2009 5:52 pm
- Location: US
Who is online
Users browsing this forum: No registered users and 0 guests